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

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 10:24:59 PST 2021


zatrazz created this revision.
zatrazz added reviewers: grimar, peter.smith, ruiu, MaskRay.
Herald added subscribers: danielkiss, kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.
zatrazz requested review of this revision.
Herald added a project: LLVM.

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 instead of .got.plt.

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 in some
cases).

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94809

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


Index: lld/test/ELF/global-offset-table-position-aarch64.s
===================================================================
--- lld/test/ELF/global-offset-table-position-aarch64.s
+++ lld/test/ELF/global-offset-table-position-aarch64.s
@@ -27,4 +27,4 @@
 // CHECK-NEXT:     Other [ (0x2)
 // CHECK-NEXT:       STV_HIDDEN (0x2)
 // CHECK-NEXT:     ]
-// CHECK-NEXT:     Section: .got.plt
+// CHECK-NEXT:     Section: .got
Index: lld/ELF/Arch/AArch64.cpp
===================================================================
--- lld/ELF/Arch/AArch64.cpp
+++ lld/ELF/Arch/AArch64.cpp
@@ -70,6 +70,7 @@
   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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94809.317016.patch
Type: text/x-patch
Size: 845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210115/5307fde5/attachment.bin>


More information about the llvm-commits mailing list