This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][RFC] Explicitly set ELF symbol size to zero for undefined symbols -- libbfd, gold
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Simon Baldwin <simonb at google dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 21 Jul 2008 10:44:51 +0930
- Subject: Re: [PATCH][RFC] Explicitly set ELF symbol size to zero for undefined symbols -- libbfd, gold
- References: <20080714104825.141AC3FF272@localhost>
On Mon, Jul 14, 2008 at 11:48:25AM +0100, Simon Baldwin wrote:
> This patch explicitly sets the size of undefined ELF symbols to zero for
> linker output.
>
> Currently, the size of an undefined ELF symbol is copied out of the object
> file or DSO that supplies the symbol, on linking. This size is unreliable,
> for example in the case of two DSOs, one linking to the other. The lower-
> level DSO could make an ABI-preserving change that alters the symbol size,
> with no hard requirement to rebuild the higher-level DSO. And if the higher-
> level DSO is rebuilt, tools that monitor file checksums will register a
> change due to the altered size of the undefined symbol, even though nothing
> else about the higher-level DSO has altered. This can lead to unnecessary
> and undesirable rebuild and change cascades in checksum-based systems.
>
> Confirmed test parity between pre- and post-patch source trees.
>
> Any objections? Thanks.
I feel uncomfortable about this patch, simply because it loses
information. Not that I can think of a solid reason why this would
matter. SHN_COMMON symbols need both size and value, and SHN_UNDEF
can't lose a non-zero value (plt symbol hint to ld.so), but SHN_UNDEF
size doesn't seem to be that useful. However, people do weird things
with linkers..
I'd be much happier if you modified elf_link_add_object_symbols to
zero size on reading undefined symbols from dynamic objects. In fact,
there seems to be code there already that would do this. See
"/* Remember the symbol size if it isn't undefined. */". Why isn't
this code effective?
--
Alan Modra
Australia Development Lab, IBM