2 ## Test R_390_GOTENT optimization.
4 # RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o
5 # RUN: ld.lld %t.o -o %t1 --no-apply-dynamic-relocs
6 # RUN: llvm-readelf -S -r -x .got.plt %t1 | FileCheck --check-prefixes=CHECK,NOAPPLY %s
7 # RUN: ld.lld %t.o -o %t1 --apply-dynamic-relocs
8 # RUN: llvm-readelf -S -r -x .got.plt %t1 | FileCheck --check-prefixes=CHECK,APPLY %s
9 # RUN: ld.lld %t.o -o %t1
10 # RUN: llvm-objdump --no-print-imm-hex -d %t1 | FileCheck --check-prefix=DISASM %s
12 ## --no-relax disables GOT optimization.
13 # RUN: ld.lld --no-relax %t.o -o %t2
14 # RUN: llvm-objdump --no-print-imm-hex -d %t2 | FileCheck --check-prefix=NORELAX %s
16 ## In our implementation, .got is retained even if all GOT-generating relocations are optimized.
17 # CHECK: Name Type Address Off Size ES Flg Lk Inf Al
18 # CHECK: .iplt PROGBITS 0000000001001240 000240 000020 00 AX 0 0 16
19 # CHECK-NEXT: .got PROGBITS 0000000001002260 000260 000018 00 WA 0 0 8
20 # CHECK-NEXT: .relro_padding NOBITS 0000000001002278 000278 000d88 00 WA 0 0 1
21 # CHECK-NEXT: .got.plt PROGBITS 0000000001003278 000278 000008 00 WA 0 0 8
23 ## There is one R_S390_IRELATIVE relocation.
24 # CHECK-LABEL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
25 # CHECK: 0000000001003278 000000000000003d R_390_IRELATIVE 10011e8
27 # CHECK-LABEL: Hex dump of section '.got.plt':
28 # NOAPPLY-NEXT: 0x01003278 00000000 00000000
29 # APPLY-NEXT: 0x01003278 00000000 010011e8
31 # DISASM: Disassembly of section .text:
32 # DISASM: 00000000010011e0 <foo>:
34 # DISASM: 00000000010011e4 <hid>:
36 # DISASM: 00000000010011e8 <ifunc>:
37 # DISASM-NEXT: br %r14
38 # DISASM: 00000000010011ea <_start>:
39 # DISASM-NEXT: larl %r1, 0x10011e0
40 # DISASM-NEXT: larl %r1, 0x10011e0
41 # DISASM-NEXT: larl %r1, 0x10011e4
42 # DISASM-NEXT: larl %r1, 0x10011e4
43 # DISASM-NEXT: lgrl %r1, 0x1003278
44 # DISASM-NEXT: lgrl %r1, 0x1003278
45 # DISASM-NEXT: larl %r1, 0x10011e0
46 # DISASM-NEXT: larl %r1, 0x10011e0
47 # DISASM-NEXT: larl %r1, 0x10011e4
48 # DISASM-NEXT: larl %r1, 0x10011e4
49 # DISASM-NEXT: lgrl %r1, 0x1003278
50 # DISASM-NEXT: lgrl %r1, 0x1003278
52 # NORELAX-LABEL: <_start>:
53 # NORELAX-COUNT-12: lgrl
71 .type ifunc STT_GNU_IFUNC
73 .type ifunc, @function
78 .type _start, @function