George Rimar | 5c33b91 | 2016-05-25 14:31:37 | [diff] [blame] | 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 -o %t.so |
George Rimar | d46753e | 2017-10-06 09:37:44 | [diff] [blame] | 5 | # RUN: ld.lld --hash-style=sysv -shared %t.o %t.so -o %tout |
George Rimar | 5c33b91 | 2016-05-25 14:31:37 | [diff] [blame] | 6 | # 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 Espindola | 3b1ecb5 | 2016-05-28 15:38:13 | [diff] [blame] | 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 |
George Rimar | 5c33b91 | 2016-05-25 14:31:37 | [diff] [blame] | 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-NEXT: foo: |
Rafael Espindola | 3b1ecb5 | 2016-05-28 15:38:13 | [diff] [blame] | 21 | # DISASM-NEXT: nop |
George Rimar | 5c33b91 | 2016-05-25 14:31:37 | [diff] [blame] | 22 | # DISASM: hid: |
Rafael Espindola | 3b1ecb5 | 2016-05-28 15:38:13 | [diff] [blame] | 23 | # DISASM-NEXT: nop |
George Rimar | 5c33b91 | 2016-05-25 14:31:37 | [diff] [blame] | 24 | # DISASM: _start: |
Rafael Espindola | 3b1ecb5 | 2016-05-28 15:38:13 | [diff] [blame] | 25 | # 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 Rimar | 5c33b91 | 2016-05-25 14:31:37 | [diff] [blame] | 41 | |
| 42 | .text |
| 43 | .globl foo |
| 44 | .type foo, @function |
| 45 | foo: |
| 46 | nop |
| 47 | |
| 48 | .globl hid |
| 49 | .hidden hid |
| 50 | .type hid, @function |
| 51 | hid: |
| 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 Espindola | 3b1ecb5 | 2016-05-28 15:38:13 | [diff] [blame] | 65 | 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 |