blob: 3c5c8ba8c49b0ebecc94da148527d261ef3e48d0 [file] [log] [blame]
George Rimar5c33b912016-05-25 14:31:371# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-unknown-linux %s -o %t.o
3# RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-pc-linux %S/Inputs/gotpc-relax-und-dso.s -o %tdso.o
4# RUN: ld.lld -shared %tdso.o -o %t.so
George Rimard46753e2017-10-06 09:37:445# RUN: ld.lld --hash-style=sysv -shared %t.o %t.so -o %tout
George Rimar5c33b912016-05-25 14:31:376# RUN: llvm-readobj -r -s %tout | FileCheck --check-prefix=RELOC %s
7# RUN: llvm-objdump -d %tout | FileCheck --check-prefix=DISASM %s
8
9# RELOC: Relocations [
10# RELOC-NEXT: Section ({{.*}}) .rela.dyn {
Rafael Espindola3b1ecb52016-05-28 15:38:1311# RELOC-NEXT: R_X86_64_GLOB_DAT dsofoo 0x0
12# RELOC-NEXT: R_X86_64_GLOB_DAT foo 0x0
13# RELOC-NEXT: R_X86_64_GLOB_DAT und 0x0
George Rimar5c33b912016-05-25 14:31:3714# RELOC-NEXT: }
15# RELOC-NEXT: ]
16
17# 0x101e + 7 - 36 = 0x1001
18# 0x1025 + 7 - 43 = 0x1001
19# DISASM: Disassembly of section .text:
20# DISASM-NEXT: foo:
Rafael Espindola3b1ecb52016-05-28 15:38:1321# DISASM-NEXT: nop
George Rimar5c33b912016-05-25 14:31:3722# DISASM: hid:
Rafael Espindola3b1ecb52016-05-28 15:38:1323# DISASM-NEXT: nop
George Rimar5c33b912016-05-25 14:31:3724# DISASM: _start:
Rafael Espindola3b1ecb52016-05-28 15:38:1325# DISASM-NEXT: movq 4247(%rip), %rax
26# DISASM-NEXT: movq 4240(%rip), %rax
27# DISASM-NEXT: movq 4241(%rip), %rax
28# DISASM-NEXT: movq 4234(%rip), %rax
29# DISASM-NEXT: leaq -36(%rip), %rax
30# DISASM-NEXT: leaq -43(%rip), %rax
31# DISASM-NEXT: movq 4221(%rip), %rax
32# DISASM-NEXT: movq 4214(%rip), %rax
33# DISASM-NEXT: movq 4191(%rip), %rax
34# DISASM-NEXT: movq 4184(%rip), %rax
35# DISASM-NEXT: movq 4185(%rip), %rax
36# DISASM-NEXT: movq 4178(%rip), %rax
37# DISASM-NEXT: leaq -92(%rip), %rax
38# DISASM-NEXT: leaq -99(%rip), %rax
39# DISASM-NEXT: movq 4165(%rip), %rax
40# DISASM-NEXT: movq 4158(%rip), %rax
George Rimar5c33b912016-05-25 14:31:3741
42.text
43.globl foo
44.type foo, @function
45foo:
46 nop
47
48.globl hid
49.hidden hid
50.type hid, @function
51hid:
52 nop
53
54.globl _start
55.type _start, @function
56_start:
57 movq und@GOTPCREL(%rip), %rax
58 movq und@GOTPCREL(%rip), %rax
59 movq dsofoo@GOTPCREL(%rip), %rax
60 movq dsofoo@GOTPCREL(%rip), %rax
61 movq hid@GOTPCREL(%rip), %rax
62 movq hid@GOTPCREL(%rip), %rax
63 movq foo@GOTPCREL(%rip), %rax
64 movq foo@GOTPCREL(%rip), %rax
Rafael Espindola3b1ecb52016-05-28 15:38:1365 movq und@GOTPCREL(%rip), %rax
66 movq und@GOTPCREL(%rip), %rax
67 movq dsofoo@GOTPCREL(%rip), %rax
68 movq dsofoo@GOTPCREL(%rip), %rax
69 movq hid@GOTPCREL(%rip), %rax
70 movq hid@GOTPCREL(%rip), %rax
71 movq foo@GOTPCREL(%rip), %rax
72 movq foo@GOTPCREL(%rip), %rax