[ELF] Add IpltSection
authorFangrui Song <maskray@google.com>
Sat, 14 Dec 2019 22:17:35 +0000 (14:17 -0800)
committerFangrui Song <maskray@google.com>
Tue, 17 Dec 2019 08:06:04 +0000 (00:06 -0800)
commit891a8655ab563055e21c1f8a3907f9c43fe5c583
treeb6c0b7a6292228bd6ed8be3bea006126510fda84
parenta57adc7a0b0dac5484f19f9061eba432d0db19e8
[ELF] Add IpltSection

PltSection is used by both PLT and IPLT. The PLT section may have a
header while the IPLT section does not. Split off IpltSection from
PltSection to be clearer.

Unlike other targets, PPC64 cannot use the same code sequence for PLT
and IPLT. This helps make a future PPC64 patch (D71509) more isolated.

On EM_386 and EM_X86_64, when PLT is empty while IPLT is not, currently
we are inconsistent whether the PLT header is conceptually attached to
in.plt or in.iplt .  Consistently attach the header to in.plt can make
the -z retpolineplt logic simpler. It also makes `jmp` point to an
aesthetically better place for non-retpolineplt cases.

Reviewed By: grimar, ruiu

Differential Revision: https://reviews.llvm.org/D71519
18 files changed:
lld/ELF/Arch/AArch64.cpp
lld/ELF/Arch/ARM.cpp
lld/ELF/Arch/PPC.cpp
lld/ELF/Arch/PPC64.cpp
lld/ELF/Arch/RISCV.cpp
lld/ELF/Arch/X86.cpp
lld/ELF/Arch/X86_64.cpp
lld/ELF/Relocations.cpp
lld/ELF/Symbols.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Target.h
lld/ELF/Writer.cpp
lld/test/ELF/gnu-ifunc-i386.s
lld/test/ELF/gnu-ifunc-plt-i386.s
lld/test/ELF/gnu-ifunc-plt.s
lld/test/ELF/gnu-ifunc-shared.s
lld/test/ELF/gnu-ifunc.s