[ELF] ifunc implementation using synthetic sections
authorPeter Smith <peter.smith@linaro.org>
Thu, 8 Dec 2016 12:58:55 +0000 (12:58 +0000)
committerPeter Smith <peter.smith@linaro.org>
Thu, 8 Dec 2016 12:58:55 +0000 (12:58 +0000)
commitbaffdb8bc28e870de0810c4517a1ade1f4cc6390
tree85cd00afaa29f47da6182c05dc9039a9e3281389
parent0f77869d5838d260239709b1d6726f6eb5952325
[ELF] ifunc implementation using synthetic sections

This change introduces new synthetic sections IpltSection, IgotPltSection
that represent the ifunc entries that would previously have been put in
the PltSection and the GotPltSection. The separation makes sure that
the R_*_IRELATIVE relocations are placed after the non R_*_IRELATIVE
relocations, which permits ifunc resolvers to know that the .got.plt
slots will be initialized prior to the resolver being called.

A secondary benefit is that for ARM we can move the IgotPltSection and its
dynamic relocations to the .got and .rel.dyn as the ARM glibc expects all
the R_*_IRELATIVE relocations to be in the .rel.dyn

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

llvm-svn: 289045
16 files changed:
lld/ELF/Relocations.cpp
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Writer.cpp
lld/test/ELF/Inputs/arm-shared.s [new file with mode: 0644]
lld/test/ELF/Inputs/shared2-x86-64.s [new file with mode: 0644]
lld/test/ELF/aarch64-gnu-ifunc-plt.s [new file with mode: 0644]
lld/test/ELF/aarch64-gnu-ifunc.s
lld/test/ELF/arm-gnu-ifunc-plt.s [new file with mode: 0644]
lld/test/ELF/arm-gnu-ifunc.s
lld/test/ELF/gnu-ifunc-i386.s
lld/test/ELF/gnu-ifunc-plt.s [new file with mode: 0644]
lld/test/ELF/gnu-ifunc-shared.s [new file with mode: 0644]
lld/test/ELF/gnu-ifunc.s