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
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.
--
Alan Modra
Australia Development Lab, IBM