This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 1/2] ld: Define _edata, __bss_start, and _end only for executables
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 1 Jun 2018 11:45:32 -0700
- Subject: Re: [PATCH 1/2] ld: Define _edata, __bss_start, and _end only for executables
- References: <20180530215940.20797-1-hjl.tools@gmail.com> <20180530215940.20797-2-hjl.tools@gmail.com> <20180531004407.GR23663@bubble.grove.modra.org>
On Wed, May 30, 2018 at 5:44 PM, Alan Modra <amodra@gmail.com> wrote:
> On Wed, May 30, 2018 at 02:59:39PM -0700, H.J. Lu wrote:
>> _edata, __bss_start, and _end are defined for executables. FreeBSD's
>> libc.so uses executable's _end to initialize curbrk. But there is no
>> good reason to access values of _edata, __bss_start, and _end defined
>> in shared libraries. We should define _edata, __bss_start, and _end
>> only for executables.
>
> I agree with the idea, but the patch isn't complete. You'll need to
> look at all the target OTHER_END_SYMBOLS, OTHER_BSS_SYMBOLS, and
> OTHER_BSS_END_SYMBOLS. For instance, elf32mep.sh defines __heap = _end
> in OTHER_END_SYMBOLS, which is going to go wrong when _end isn't
> defined in a shared library.. Ah, no, mep uses its own mep.sc so
> won't be affected by your elf.sc patch, but I'm sure you can see the
> potential problem in other targets. So please do look for _edata,
> edata, __bss_start, _end and end in emulparams/*.sh. A quick look
> says this patch will likely cause fails on some targets, eg. see
> elf32epiphany.sh EXECUTABLE_SYMBOLS.
>
> If you're lucky you might be able to wrap the occurrences of
> OTHER_END_SYMBOLS, OTHER_BSS_SYMBOLS, OTHER_BSS_END_SYMBOLS and
> EXECUTABLE_SYMBOLS in elf.sc with ${CREATE_SHLIB- }.
>
> Also, do test this sort of patch on a large set of ELF targets before
> posting.
>
The new set of patches are posted at
https://sourceware.org/ml/binutils/2018-06/msg00021.html
--
H.J.