Subject: Re: simplify data_start configuration for Emacs

From: Eli Zaretskii <[email-masked]>
Date: Sat, 23 Feb 2013 12:47:17 +0200

> Date: Fri, 22 Feb 2013 17:36:13 -0800
> From: Paul Eggert <[email-masked]>
> CC: [email-masked]
> 
> With the patch, data_start is used only by vm-limit.c.
> And vm-limit.c is compiled only when using gmalloc,
> as its isn't valid when using a system malloc.
> 
> > It seems like data_start and data_size derived from it matter only
> > when displaying memory usage warnings -- is that correct?
> 
> Yes.
> 
> > If so, why doesn't this matter when system malloc is used?
> 
> When the system malloc is used Emacs can't warn about low memory,
> because it has no way of knowing when memory is low.

I see, thanks.

> > The MS-Windows build computes data_start and data_size inside
> > unexw32.c at dump time -- is that good enough?  (I'm asking because
> > your change doesn't touch the Windows build.)
> 
> Yes, it should be, but that points out a problem with the latest
> patch -- it should use DATA_START for MS platforms.  Here's a further
> patch to fix that, and I'm attaching the resulting combined patch,
> relative to trunk bzr 111860.

Thanks.

> --- src/unexcoff.c	2013-01-02 16:13:04 +0000
> +++ src/unexcoff.c	2013-02-22 19:43:17 +0000
> @@ -99,7 +99,7 @@
>  
>  #include <sys/file.h>
>  
> -#include "mem-limits.h"
> +extern int etext[];
>  
>  static long block_copy_start;		/* Old executable start point */
>  static struct filehdr f_hdr;		/* File header */
> @@ -168,7 +168,7 @@
>    pagemask = getpagesize () - 1;
>  
>    /* Adjust text/data boundary. */
> -  data_start = (int) start_of_data ();
> +  data_start = (int) (etext + 1);

I suggest to use DATA_START here (which is defined to '&etext + 1' by
msdos/sed2v2.inp).