This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

data_start, __data_start


This seems to be an issue that recurs every year or so ...

Should ld on Linux define either or both of data_start and __data_start?

I maintain a garbage collecting allocator that's used with a number of
applications including gcj.  It needs to find the bounds of writable data
segments, especially the main one, since it needs to scan those for pointers
to collectable memory.  Under Linux, it currently it finds the beginning of
the main .data segment by looking for either data_start or __data_start,
whichever one is defined.  I arrived at this "solution" after determining
that Linux distributions were inconsistent in which one they defined.

Unfortunately, it now appears that there is at least one distribution (RH6.2
for Alpha, possibly others) that defines neither.  Questions:

1) Is this a bug in the Linux distribution(s)?  Is this the wrong place to
ask this question?
2) Is there a better way to determine the beginning of the main data
segment?  Note that the program asking the question, i.e. the collector
itself, may reside in a shared library.  This precludes all sorts of
plausible solutions that we tried in the past.  (The best known generic
alternatives seem to be to start at &_end and walk backwards until you get a
page fault, or to read /proc/self/maps.  The code to do either of those is
basically already there, but neither seems ideal.)
3) Is there any hope of standardizing the linker scripts again?  I would
vote for the old name __data_start, since the user can legitimately define
the symbol data_start, which would break the collector.  This should stay
out of the user namespace.

Thanks.

Hans

(Please cc: me on any replies, since I'm not on the mailing list.)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]