[lld] [lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (PR #81739)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 08:54:16 PST 2024


================
@@ -12,6 +12,14 @@
 # RUN: llvm-objdump --section .data --full-contents %t | FileCheck --check-prefix=LE-DATA %s
 # RUN: llvm-objdump --section .got --full-contents %t | FileCheck --check-prefix=LE-GOT %s
 
+## With -pie we still have the R_390_RELATIVE for the data element, but all GOT
+## entries should be fully resolved without any remaining R_390_TLS_TPOFF.
+# RUN: ld.lld -pie %t.o -o %t.pie
+# RUN: llvm-readelf -r %t.pie | FileCheck --check-prefix=PIE-REL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t.pie | FileCheck --check-prefix=PIE %s
+# RUN: llvm-objdump --section .data --full-contents %t.pie | FileCheck --check-prefix=PIE-DATA %s
----------------
MaskRay wrote:

To inspect section content, `llvm-readelf -x .data` is shorter:)

https://github.com/llvm/llvm-project/pull/81739


More information about the llvm-commits mailing list