[PATCH] D53993: [ELF] Set sh_link to 0 in static link to make GNU strip happy
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 1 13:10:21 PDT 2018
ruiu added inline comments.
================
Comment at: ELF/SyntheticSections.cpp:1494
void RelocationBaseSection::finalizeContents() {
- // If all relocations are R_*_{,I}RELATIVE they don't refer to any dynamic
- // symbol and we don't need a dynamic symbol table. If that is the case, use
- // the index of the regular symbol table section (if exists) or 0.
- if (In.DynSymTab)
- getParent()->Link = In.DynSymTab->getParent()->SectionIndex;
- else if (In.SymTab)
- getParent()->Link = In.SymTab->getParent()->SectionIndex;
- else
- getParent()->Link = 0;
+ // When linking glibc statically, .rela?.plt contains R_*_IRELATIVE
+ // relocations due to IFUNC (e.g. strcpy). Just set sh_link to 0 as there is
----------------
Looks like this new comment is not easy to understand for those who do not already know the problem you are trying to fix in this. What is this `link` supposed to have by the spec? You shouldn't focus too much on a workaround when describing something, but focus on what it is supposed to be (and briefly mention the deviation from the expected situation.)
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D53993
More information about the llvm-commits
mailing list