[RFC] PR ld/13621
Mark Wielaard
mjw@redhat.com
Tue Jan 31 09:58:00 GMT 2012
More information about the Binutils mailing list
Tue Jan 31 09:58:00 GMT 2012
- Previous message (by thread): [RFC] PR ld/13621
- Next message (by thread): [RFC] PR ld/13621
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 2012-01-31 at 09:46 +1030, Alan Modra wrote: > As far as symbols go, the ELF spec says that st_value for (non-common) > symbols in relocatable object files is an offset from the beginning of > a section. There is nothing to say that values should be within the > section bounds. But it does also say "If a symbol's value refers to a specific location within a section, its section index member, st_shndx, holds an index into the section header table." and again when defining SHN_XINDEX it says "It indicates that the symbol refers to a specific location within a section...". So I would interpret that as saying the offset shouldn't be outside the section. IMHO it doesn't really make sense to have a symbol value outside a section (except maybe to mark the end of it). At least I wouldn't know what it represents then (given that you are dealing with section tables, see below, and it isn't one of the special section index values). > In an executable or shared object the ELF spec > says of symbol values that "the section number is irrelevant", since > st_value is no longer a section offset but a virtual memory address. > (That doesn't mean to say the section is totally irrelevant, just that > it is irrelevant so far as the value is concerned.) So that's why I > claim that the elflint warning is a little silly. I see. But that only really holds if you wouldn't output the section table in the first place (which you don't have to for executables, which only require a program table). If you do output a section table then it is IMHO reasonable to assume that the section indexes used in the symbol tables are consistent with the section table description. For example some analyzers/debuggers use it to provide the user with the section name that a symbol address falls within, that can be really helpful if the section has a useful name (like in this case .tm_clone_table would immediately give someone a hint of what structure one is dealing with). So IMHO as long as you are dealing with sections, and even for executables ld does output sections, they should be consistent with the usage of section indexes in symbol tables. That is what elflint checks, that the internal structure of the elf file is consistent. Cheers, Mark
- Previous message (by thread): [RFC] PR ld/13621
- Next message (by thread): [RFC] PR ld/13621
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list