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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 14 13:38:41 PST 2019


ruiu marked an inline comment as done.
ruiu 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;
----------------
grimar wrote:
> 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();
> }
> ```
> 
> 
Thanks. I applied that suggested change.


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

https://reviews.llvm.org/D56623





More information about the llvm-commits mailing list