[llvm-branch-commits] [lld] 2f92386 - [LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got

Adhemerval Zanella via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 18 09:55:42 PST 2021


Author: Adhemerval Zanella
Date: 2021-01-18T14:51:14-03:00
New Revision: 2f92386e721acd7badac06b67229537c4f0adfad

URL: https://github.com/llvm/llvm-project/commit/2f92386e721acd7badac06b67229537c4f0adfad
DIFF: https://github.com/llvm/llvm-project/commit/2f92386e721acd7badac06b67229537c4f0adfad.diff

LOG: [LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index 61230a6dabbd..1d9418c22134 100644
--- a/lld/ELF/Arch/AArch64.cpp
+++ b/lld/ELF/Arch/AArch64.cpp
@@ -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.

diff  --git a/lld/test/ELF/global-offset-table-position-aarch64.s b/lld/test/ELF/global-offset-table-position-aarch64.s
index 1a3e8062546f..a2b22732f2b5 100644
--- a/lld/test/ELF/global-offset-table-position-aarch64.s
+++ b/lld/test/ELF/global-offset-table-position-aarch64.s
@@ -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


        


More information about the llvm-branch-commits mailing list