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
11 # DISASM-NEXT: movl 2097146(%rip), %eax
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
24 .section .text.foo,"ax"
28 movl __start_data@GOTPCREL
(%rip
), %eax
# out of range
32 .type _start, @function
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
44 .text.foo 0x100000 : { *(.text.foo) }
45 .text 0x200000 : { *(.text) }
46 .got 0x300000 : { *(.got) }
47 data
0x80200000 : { *(data
) }
51 .text.foo 0x100000 : { *(.text.foo) }
52 .text 0x200000 : { *(.text) }
53 .got 0x300000 : { *(.got) }
54 data
0x400000 : { *(data
) }