[ELF][test] Test .glink code sequence and DT_PPC64_GLINK
authorFangrui Song <i@maskray.me>
Fri, 21 Apr 2023 20:46:20 +0000 (13:46 -0700)
committerFangrui Song <i@maskray.me>
Fri, 21 Apr 2023 20:46:20 +0000 (13:46 -0700)
lld/test/ELF/ppc64-plt-stub.s

index 2f9f4cb..76d12d4 100644 (file)
@@ -17,6 +17,7 @@
 ## DT_PLTGOT points to .plt
 # SEC: .plt NOBITS 00000000100303f0 0003f0 000018
 # SEC: 0x0000000000000003 (PLTGOT) 0x100303f0
+# SEC: 0x0000000070000000 (PPC64_GLINK) 0x100102e0
 
 ## .plt[0] holds the address of _dl_runtime_resolve.
 ## .plt[1] holds the link map.
 # CHECK-NEXT:      mtctr 12
 # CHECK-NEXT:      bctr
 
+# CHECK-LABEL: <.glink>:
+# CHECK-NEXT:  100102c4: mflr 0
+# CHECK-NEXT:            bcl 20, 31, 0x100102cc <.glink+0x8>
+# CHECK-NEXT:            mflr 11
+# CHECK-NEXT:            mtlr 0
+# CHECK-NEXT:            sub     12, 12, 11
+# CHECK-NEXT:            addi 0, 12, -52
+# CHECK-NEXT:            rldicl 0, 0, 62, 2
+# CHECK-NEXT:            ld 12, 44(11)
+# CHECK-NEXT:            add 11, 12, 11
+# CHECK-NEXT:            ld 12, 0(11)
+# CHECK-NEXT:            ld 11, 8(11)
+# CHECK-NEXT:            mtctr 12
+# CHECK-NEXT:            bctr
+# CHECK-NEXT:            <unknown>
+# CHECK-NEXT:            <unknown>
+## DT_PPC64_GLINK+0x20 = 0x10010300
+# CHECK-NEXT:  10010300: b 0x100102c4 <.glink>
+# CHECK-NOT:   {{.}}
 
         .text
         .abiversion 2