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]
Other format: [Raw text]

ELF section identification and gld


Just having run into an issue with ld silently discarding a section that
was intended to be part of the linux kernel image, I'd like to raise the
following questions to get an understanding how far current ld behavior
is intended, and when so what specifications this is based on:

1) Encountering two input sections with different allocation flags but
identical names, ld renames the second one encountered by attaching a
.<number> suffix. While the ELF spec isn't really explicit about this,
it would have been my understanding that an ELF section is uniquely
identified by {name,type,flags} rather than just by its name. At the
very least I'd expect ld to be able to optionally issue a warning to the
user that this happened (especially when -r is in effect), because (for
instance) linker scripts subsequently used to deal with the resulting
output may deal only with the un-renamed sections unless the
programmer(s) learn(s) that it needs to deal with more.

2) Related to the above, I wonder why bfd doesn't permit multiple
sections with the same name in a single object (gas silently replaces
the section type on an incompatible redeclaration, and ignores [with a
warning] the change of the attributes, while ld as described above
simply [and silently] renames the section); the ELF spec here does not
say anything precluding multiple identically named sections in a single
object.

3) Encountering a relocation for a section with the alloc flag set and
targeting a section with the alloc flag clear is currently being carried
out silently. However, it seems rather unlikely that this would ever
result in a sensible executable, so I wonder what the reason is to
permit such a relocation and not even warn about it.

Thanks, Jan


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