[lld] a700ed6 - [ELF][test] Test the order of PPC64 .got, .toc, and .branch_lt

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 19:08:27 PDT 2023


Author: Fangrui Song
Date: 2023-09-13T19:08:22-07:00
New Revision: a700ed6909534a43e124733acc4a35352041bb3d

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

LOG: [ELF][test] Test the order of PPC64 .got, .toc, and .branch_lt

Added: 
    lld/test/ELF/ppc64-section-layout.s

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/ppc64-section-layout.s b/lld/test/ELF/ppc64-section-layout.s
new file mode 100644
index 000000000000000..ae5843e1608a1f4
--- /dev/null
+++ b/lld/test/ELF/ppc64-section-layout.s
@@ -0,0 +1,32 @@
+# REQUIRES: ppc
+## Test PPC64 specific section layout. See also section-layout.s.
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %p/Inputs/shared.s -o %t1.o
+# RUN: ld.lld -shared -soname=t1.so %t1.o -o %t1.so
+# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readelf -S %t | FileCheck %s
+
+# CHECK:      .text
+# CHECK-NEXT: .tdata
+# CHECK-NEXT: .tbss
+# CHECK-NEXT: .dynamic
+# CHECK-NEXT: .got
+# CHECK-NEXT: .toc
+# CHECK-NEXT: .data
+# CHECK-NEXT: .branch_lt
+
+.globl _start
+_start:
+  addis 3, 2, bar2 at got@ha
+  ld    3, bar2 at got@l(3)
+  addis 5, 2, .Lbar at toc@ha
+  ld    5, .Lbar at toc@l(5)
+
+.section .toc,"aw", at progbits
+.Lbar:
+  .tc bar[TC], bar
+
+.section .tdata,"awT", at progbits; .space 1
+.section .tbss,"awT", at nobits; .space 1
+.section .data,"aw", at progbits; .space 1


        


More information about the llvm-commits mailing list