PATCH: SHN_XINDEX support is broken
H. J. Lu
hjl@lucon.org
Mon Feb 7 03:41:00 GMT 2005
More information about the Binutils mailing list
Mon Feb 7 03:41:00 GMT 2005
- Previous message (by thread): PATCH: SHN_XINDEX support is broken
- Next message (by thread): PATCH: SHN_XINDEX support is broken
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Feb 06, 2005 at 11:48:10PM +1030, Alan Modra wrote: > > "SHT_GROUP sections are typically ordered before SHT_SYMTAB and > SHT_SYMTAB_SHNDX in the ELF section headers, and thus are loaded by > elf_object_p before the symbol table sections. When loading a group > section, bfd_section_from_shdr calls group_signature to read a symbol > name associated with the group. group_signature ensures that the > SHT_SYMTAB section is loaded, but doesn't load SHT_SYMTAB_SHNDX. This > can lead to an abort if the symbol st_shndx is SHN_XINDEX." > > > > It only works without SHN_XINDEX > > > since SHT_REL/SHT_RELA sections will load SHT_SYMTAB. The problem > > > affects both bfd and readelf. I will see what I can do. > > > > > > > 2005-02-04 H.J. Lu <hongjiu.lu@intel.com> > > > > * elfcode.h (elf_object_p): Read in SHT_SYMTAB and > > SHT_SYMTAB_SHNDX sections first. > > I don't think this is the best place to fix this problem. One reason is > that elfcode.h is compiled twice, once for 32-bit support and once for > 64-bit, so we should avoid adding code to elfcode.h if at all possible. > Another reason is that bfd_section_from_shdr already handles a number of > similar section dependecies, so that's where I would add code to load > SHT_SYMTAB_SHNDX when handling SHT_SYMTAB. > > Like this. Plus a few cleanups and minor optimizations. I'll commit in > the morning assuming my overnight tests look good. > > * elf-bfd.h (elf_string_from_elf_strtab): Delete macro. > * elf.c (bfd_elf_string_from_elf_section): Expand occurrence of > elf_string_from_elf_strtab. > (_bfd_elf_setup_group_pointers, bfd_section_from_shdr): Likewise. > (bfd_section_from_shdr): For SHT_SYMTAB, load SHT_SYMTAB_SHNDX too > if it exists. Don't do the reverse for SHT_SYMTAB_SHNDX. For > SHT_STRTAB, check whether the strtab is for symtab or dynsymtab by > looking at cached symtab info first, before iterating over headers. > For SHT_REL and SHT_RELA, load dynsymtab if needed. > * elfcode.h (elf_object_p): Don't load section header stringtab > specially. > I have been looking at the change. I am not 100% sure if it will be always correct. Will the symbol table be read in by SHT_REL/SHT_RELA? What if a file doesn't have them and does have SHT_GROUP? I will try to come up with a testcase for that. H.J.
- Previous message (by thread): PATCH: SHN_XINDEX support is broken
- Next message (by thread): PATCH: SHN_XINDEX support is broken
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list