[PATCH] D56623: Do not emit a corrupt symbol table entry for .rela_iplt_{start,end}.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 12 03:18:29 PST 2019


grimar added inline comments.


================
Comment at: lld/ELF/Writer.cpp:961
+    // symbols point to the same location, their actual locations don't matter.
+    if (Size == 0) {
+      ElfSym::RelaIpltStart->Section = Out::ElfHeader;
----------------
Will it be better to do in the same way we do for `ElfSym::GlobalOffsetTable` (lines 943-950 right above).
`ElfSym::GlobalOffsetTable` is created with `Out::ElfHeader` initially and then the appropriate section is set,
it seems to be a bit more convenient/simple way. So the code would be something like:

```
  ElfSym::RelaIpltStart =
      addOptionalRegular(S, **Out::ElfHeader**, 0, STV_HIDDEN, STB_WEAK);
...
  ElfSym::RelaIpltEnd =
      addOptionalRegular(S, **Out::ElfHeader**, 0, STV_HIDDEN, STB_WEAK);
```

```
if (ElfSym::RelaIpltStart && !In.RelaIplt->empty()) {
  ElfSym::RelaIpltStart->Section = In.RelaIplt;
  ElfSym::RelaIpltEnd->Section = In.RelaIplt;
  ElfSym::RelaIpltEnd->Value = In.RelaIplt->getSize();
}
```




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56623/new/

https://reviews.llvm.org/D56623





More information about the llvm-commits mailing list