Created attachment 9799 [details] Testcase elf It's possible to create an ELF file that readelf will perfectly read, but isn't valid according to the spec, this later caused some confusion when ld tried to link it against something. I spoke with Alan Modra to figure out what was going on with the attached testcase I was given, and he informed me the ELF has a local after a global in the symtab, which is not allowed. Would it be possible to get a warning added to readelf for this? I had assumed if readelf could understand it that the ELF was proper. It along with nm slightly misleadingly suggest that _start is a valid global symbol, when ld will silently ignore it.
Hi Peter, > Would it be possible to get a warning added to readelf for this? We added a warning for this last year. :-) It will be in the 2.28 release, or you could download the latest development sources and try for yourself. You should see: $ readelf --syms basm.o Symbol table '.symtab' contains 7 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS file.asm 2: 0000000000000000 0 SECTION LOCAL DEFAULT 1 3: 0000000000000000 0 SECTION LOCAL DEFAULT 2 4: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 message 5: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 _start 6: 000000000000000a 0 NOTYPE LOCAL DEFAULT 2 bar readelf: Warning: local symbol 6 found at index >= .symtab's sh_info value of 6 Cheers Nick