[ELF] Recommit 327248 with Arm using the .got for _GLOBAL_OFFSET_TABLE_
authorPeter Smith <peter.smith@linaro.org>
Mon, 19 Mar 2018 06:52:51 +0000 (06:52 +0000)
committerPeter Smith <peter.smith@linaro.org>
Mon, 19 Mar 2018 06:52:51 +0000 (06:52 +0000)
commit3d044f57d490c225064b272359bb3ae845c55362
treeb373b6ef3e19ffee0c5f003483a8928162ba66d4
parent529f42331e425aa812a48ab385dd00a67be9ea37
[ELF] Recommit 327248 with Arm using the .got for _GLOBAL_OFFSET_TABLE_

This is the same as 327248 except Arm defining _GLOBAL_OFFSET_TABLE_ to
be the base of the .got section as some existing code is relying upon it.

For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at
the start of the .got.plt section so that _GLOBAL_OFFSET_TABLE_[0] =
reserved value that is by convention the address of the dynamic section.
Previously we had defined _GLOBAL_OFFSET_TABLE_ as either the start or end
of the .got section with the intention that the .got.plt section would
follow the .got. However this does not always hold with the current
default section ordering so _GLOBAL_OFFSET_TABLE_[0] may not be consistent
with the reserved first entry of the .got.plt.

X86, X86_64 and AArch64 will use the .got.plt. Arm, Mips and Power use .got

Fixes PR36555

Differential Revision: https://reviews.llvm.org/D44259

llvm-svn: 327823
16 files changed:
lld/ELF/Arch/ARM.cpp
lld/ELF/Arch/Mips.cpp
lld/ELF/Arch/PPC.cpp
lld/ELF/Arch/X86.cpp
lld/ELF/Arch/X86_64.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Target.h
lld/ELF/Writer.cpp
lld/test/ELF/dynamic-got.s
lld/test/ELF/global-offset-table-position-aarch64.s
lld/test/ELF/global-offset-table-position-i386.s
lld/test/ELF/global-offset-table-position.s
lld/test/ELF/global_offset_table_shared.s
lld/test/ELF/got32x-i386.s
lld/test/ELF/i386-gotpc.s