2 # RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o
3 # RUN: ld.lld -z norelro -shared %t.o -soname=t.so -o %t.so
4 ## Note: Without norelro the distance between .got and .got.plt causes
5 ## R_390_GOTPLT12 relocations to always overflow.
7 # RUN: llvm-readelf -S -x .data %t.so | FileCheck %s
8 # RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=DISASM
10 # CHECK: Section Headers:
11 # CHECK: .got PROGBITS 0000000000002458
12 # CHECK: .got.plt PROGBITS 0000000000002480
14 ## Note: _GLOBAL_OFFSET_TABLE is at .got
15 ## GOT (foo) is at .got + 24 == 0x2470
16 ## GOT (bar) is at .got + 32 == 0x2478
17 ## GOTPLT (foo) is at .got.plt + 0 == .got + 40 == 0x2480
18 ## GOTPLT (bar) is at .got.plt + 8 == .got + 48 == 0x2488
20 # DISASM: larl %r12, 0x2458
21 # DISASM-NEXT: larl %r1, 0x2470
22 # DISASM-NEXT: larl %r1, 0x2478
23 # DISASM-NEXT: larl %r1, 0x2480
24 # DISASM-NEXT: larl %r1, 0x2488
26 # DISASM-NEXT: l %r1, 24(%r12)
27 # DISASM-NEXT: l %r1, 32(%r12)
28 # DISASM-NEXT: l %r1, 40(%r12)
29 # DISASM-NEXT: l %r1, 48(%r12)
30 # DISASM-NEXT: lg %r1, 24(%r12)
31 # DISASM-NEXT: lg %r1, 32(%r12)
32 # DISASM-NEXT: lg %r1, 40(%r12)
33 # DISASM-NEXT: lg %r1, 48(%r12)
35 # CHECK: Hex dump of section '.data':
36 # CHECK-NEXT: 00180020 00280030 00000018 00000020
37 # CHECK-NEXT: 00000028 00000030 00000000 00000018
38 # CHECK-NEXT: 00000000 00000020 00000000 00000028
39 # CHECK-NEXT: 00000000 00000030
42 larl
%r12, _GLOBAL_OFFSET_TABLE_
43 .reloc .+2, R_390_GOTENT, foo+2
45 .reloc .+2, R_390_GOTENT, bar+2
47 .reloc .+2, R_390_GOTPLTENT, foo+2
49 .reloc .+2, R_390_GOTPLTENT, bar+2
51 .reloc .+2, R_390_GOT12, foo
53 .reloc .+2, R_390_GOT12, bar
55 .reloc .+2, R_390_GOTPLT12, foo
57 .reloc .+2, R_390_GOTPLT12, bar
59 .reloc .+2, R_390_GOT20, foo
61 .reloc .+2, R_390_GOT20, bar
63 .reloc .+2, R_390_GOTPLT20, foo
65 .reloc .+2, R_390_GOTPLT20, bar
69 .reloc ., R_390_GOT16, foo
71 .reloc ., R_390_GOT16, bar
73 .reloc ., R_390_GOTPLT16, foo
75 .reloc ., R_390_GOTPLT16, bar
77 .reloc ., R_390_GOT32, foo
79 .reloc ., R_390_GOT32, bar
81 .reloc ., R_390_GOTPLT32, foo
83 .reloc ., R_390_GOTPLT32, bar
85 .reloc ., R_390_GOT64, foo
87 .reloc ., R_390_GOT64, bar
89 .reloc ., R_390_GOTPLT64, foo
91 .reloc ., R_390_GOTPLT64, bar