Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / x86-64-gotpc-relax-too-far.s
blob74aa6d8f65a0d8de879db4bc042868c9b3016202
1 # REQUIRES: x86
2 # RUN: split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
4 # RUN: ld.lld -T %t/lds1 %t/a.o -o %t/bin
5 # RUN: llvm-objdump --no-print-imm-hex -d %t/bin | FileCheck --check-prefix=DISASM %s
6 # RUN: llvm-readelf -S %t/bin | FileCheck --check-prefixes=GOT %s
7 # RUN: ld.lld -T %t/lds2 %t/a.o -o %t/bin2
8 # RUN: llvm-readelf -S %t/bin2 | FileCheck --check-prefixes=UNNECESSARY-GOT %s
10 # DISASM: <_foo>:
11 # DISASM-NEXT: movl 2097146(%rip), %eax
12 # DISASM: <_start>:
13 # DISASM-NEXT: movl 1048578(%rip), %eax
14 # DISASM-NEXT: movq 1048571(%rip), %rax
15 # DISASM-NEXT: leaq 2147483641(%rip), %rax
16 # DISASM-NEXT: leal 2147483635(%rip), %eax
18 # In our implementation, .got is retained even if all GOT-generating relocations are optimized.
19 # Make sure .got still exists with the right size.
20 # UNNECESSARY-GOT: .got PROGBITS 0000000000300000 101020 000000 00 WA 0 0 8
21 # GOT: .got PROGBITS 0000000000300000 102000 000010 00 WA 0 0 8
23 #--- a.s
24 .section .text.foo,"ax"
25 .globl _foo
26 .type _foo, @function
27 _foo:
28 movl __start_data@GOTPCREL(%rip), %eax # out of range
30 .section .text,"ax"
31 .globl _start
32 .type _start, @function
33 _start:
34 movl __stop_data@GOTPCREL(%rip), %eax # out of range
35 movq __stop_data@GOTPCREL(%rip), %rax # out of range
36 movq __stop_data@GOTPCREL(%rip), %rax # in range
37 movl __stop_data@GOTPCREL(%rip), %eax # in range
39 .section data,"aw",@progbits
40 .space 13
42 #--- lds1
43 SECTIONS {
44 .text.foo 0x100000 : { *(.text.foo) }
45 .text 0x200000 : { *(.text) }
46 .got 0x300000 : { *(.got) }
47 data 0x80200000 : { *(data) }
49 #--- lds2
50 SECTIONS {
51 .text.foo 0x100000 : { *(.text.foo) }
52 .text 0x200000 : { *(.text) }
53 .got 0x300000 : { *(.got) }
54 data 0x400000 : { *(data) }