[PATCH] D20956: [ELF] - Assign sh_link field of SHT_GNU_versym section to DynSymTab section index

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 14:25:19 PDT 2016


grimar added inline comments.

================
Comment at: ELF/OutputSections.cpp:1421
@@ -1420,2 +1420,3 @@
   this->Header.sh_entsize = sizeof(Elf_Versym);
+  this->Header.sh_link = Out<ELFT>::DynSymTab->SectionIndex;
 }
----------------
emaste wrote:
> ruiu wrote:
> > Please add a comment saying that setting sh_link is not required by any spec but we do since readelf assumes it.
> It is actually required (in the link I posted above). I just think it's also a bug in readelf.
> 
> versym sh_link has to point to .dynsym per above, while I believe verdef and verneed do not have to (but in practice always do), while readelf relies on all three pointing to .dynsym.
I think verdef and verneed should point to DynStrTab in sh_link field, when 
versym points to DynSymTab. At least that how that stuff works in binutils now I believe.


http://reviews.llvm.org/D20956





More information about the llvm-commits mailing list