[ELF] - Set sh_info and sh_link for .rela.plt sections.

Description

[ELF] - Set sh_info and sh_link for .rela.plt sections.

This is https://bugs.llvm.org/show_bug.cgi?id=37538,

Currently, LLD may set both sh_link and sh_info for
.rela.plt section to zero when we have only .rela.iplt section part used.

ELF spec (https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html)
says that for SHT_REL and SHT_RELA, sh_link references the associated symbol table
and sh_info the "section to which the relocation applies."

When we set the sh_link field, for the regular case we use the .dynsym index.
For .rela.iplt sections, it is unclear what is the associated symbol table,
because R_*_RELATIVE relocations do not use symbol names and we might have no
.dynsym section at all so this patch uses .symtab section index.

Differential revision: https://reviews.llvm.org/D52830

Details

Committed
grimarThu, Oct 11, 1:25 AM
Differential Revision
D52830: [ELF] - Set sh_info and sh_link for .rela.plt sections.
Branches
Unknown
Tags
Unknown