1# 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 -soname=t.so -o %t.so
5# RUN: ld.lld --hash-style=sysv -shared %t.o %t.so -o %t
6# RUN: llvm-readobj -r -S %t | FileCheck --check-prefix=RELOC %s
7# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
8
9# RELOC:      Relocations [
10# RELOC-NEXT:   Section ({{.*}}) .rela.dyn {
11# 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
14# RELOC-NEXT:   }
15# RELOC-NEXT: ]
16
17# 0x101e + 7 - 36 = 0x1001
18# 0x1025 + 7 - 43 = 0x1001
19# DISASM:      Disassembly of section .text:
20# DISASM-EMPTY:
21# DISASM-NEXT: <foo>:
22# DISASM-NEXT:     nop
23# DISASM:      <hid>:
24# DISASM-NEXT:     nop
25# DISASM:      <_start>:
26# DISASM-NEXT:    movq    4367(%rip), %rax
27# DISASM-NEXT:    movq    4360(%rip), %rax
28# DISASM-NEXT:    movq    4361(%rip), %rax
29# DISASM-NEXT:    movq    4354(%rip), %rax
30# DISASM-NEXT:    leaq    -36(%rip), %rax
31# DISASM-NEXT:    leaq    -43(%rip), %rax
32# DISASM-NEXT:    movq    4341(%rip), %rax
33# DISASM-NEXT:    movq    4334(%rip), %rax
34# DISASM-NEXT:    movq    4311(%rip), %rax
35# DISASM-NEXT:    movq    4304(%rip), %rax
36# DISASM-NEXT:    movq    4305(%rip), %rax
37# DISASM-NEXT:    movq    4298(%rip), %rax
38# DISASM-NEXT:    leaq    -92(%rip), %rax
39# DISASM-NEXT:    leaq    -99(%rip), %rax
40# DISASM-NEXT:    movq    4285(%rip), %rax
41# DISASM-NEXT:    movq    4278(%rip), %rax
42
43.text
44.globl foo
45.type foo, @function
46foo:
47 nop
48
49.globl hid
50.hidden hid
51.type hid, @function
52hid:
53 nop
54
55.globl _start
56.type _start, @function
57_start:
58 movq und@GOTPCREL(%rip), %rax
59 movq und@GOTPCREL(%rip), %rax
60 movq dsofoo@GOTPCREL(%rip), %rax
61 movq dsofoo@GOTPCREL(%rip), %rax
62 movq hid@GOTPCREL(%rip), %rax
63 movq hid@GOTPCREL(%rip), %rax
64 movq foo@GOTPCREL(%rip), %rax
65 movq foo@GOTPCREL(%rip), %rax
66 movq und@GOTPCREL(%rip), %rax
67 movq und@GOTPCREL(%rip), %rax
68 movq dsofoo@GOTPCREL(%rip), %rax
69 movq dsofoo@GOTPCREL(%rip), %rax
70 movq hid@GOTPCREL(%rip), %rax
71 movq hid@GOTPCREL(%rip), %rax
72 movq foo@GOTPCREL(%rip), %rax
73 movq foo@GOTPCREL(%rip), %rax
74