Page MenuHomePhabricator

Do not emit a corrupt symbol table entry for .rela_iplt_{start,end}.

Authored by ruiu on Jan 11 2019, 4:57 PM.



If .rela.iplt does not exist, we used to emit a corrupt symbol table
that contains two symbols, .rela_iplt_{start,end}, pointing to a
nonexisting section.

This patch fixes the issue by setting section index 0 to the symbols
if .rel.iplt section does not exist.

Diff Detail

rLLD LLVM Linker

Event Timeline

ruiu created this revision.Jan 11 2019, 4:57 PM
grimar added inline comments.Jan 12 2019, 3:17 AM
961 ↗(On Diff #181398)

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();
ruiu updated this revision to Diff 181642.Jan 14 2019, 1:38 PM
  • apply code review suggestion
ruiu marked an inline comment as done.Jan 14 2019, 1:38 PM
ruiu added inline comments.
961 ↗(On Diff #181398)

Thanks. I applied that suggested change.

grimar accepted this revision.Jan 15 2019, 12:59 AM


This revision is now accepted and ready to land.Jan 15 2019, 12:59 AM
This revision was automatically updated to reflect the committed changes.