OSDN Git Service

[LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 15 Jan 2021 17:58:43 +0000 (17:58 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 18 Jan 2021 17:51:14 +0000 (14:51 -0300)
The commit 18aa0be36ed9 changed the default GotBaseSymInGotPlt to true
for AArch64.  This is different than binutils, where
_GLOBAL_OFFSET_TABLE_ points at the start or .got.

It seems to not intefere with current relocations used by LLVM.  However
as indicated by PR#40357 [1] gcc generates R_AARCH64_LD64_GOTPAGE_LO15
for -pie (in fact it also generated the relocation for -fpic).

This change is requires to correctly handle R_AARCH64_LD64_GOTPAGE_LO15
by lld from objects generated by gcc.

[1] https://bugs.llvm.org/show_bug.cgi?id=40357

lld/ELF/Arch/AArch64.cpp
lld/test/ELF/global-offset-table-position-aarch64.s

index 61230a6..1d9418c 100644 (file)
@@ -70,6 +70,7 @@ AArch64::AArch64() {
   pltEntrySize = 16;
   ipltEntrySize = 16;
   defaultMaxPageSize = 65536;
+  gotBaseSymInGotPlt = false;
 
   // Align to the 2 MiB page size (known as a superpage or huge page).
   // FreeBSD automatically promotes 2 MiB-aligned allocations.
index 1a3e806..a2b2273 100644 (file)
@@ -27,4 +27,4 @@ _start:
 // CHECK-NEXT:     Other [ (0x2)
 // CHECK-NEXT:       STV_HIDDEN (0x2)
 // CHECK-NEXT:     ]
-// CHECK-NEXT:     Section: .got.plt
+// CHECK-NEXT:     Section: .got