| Rafael Espindola | cc6ebb8 | 2015-10-14 18:42:16 +0000 | [diff] [blame] | 1 | // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o |
| Rafael Espindola | 993f027 | 2016-02-26 14:27:47 +0000 | [diff] [blame] | 2 | // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc-weak.s -o %t2.o |
| Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 +0000 | [diff] [blame] | 3 | // RUN: ld.lld -shared %t2.o -o %t2.so |
| 4 | // RUN: ld.lld %t.o %t2.so -o %t |
| Rafael Espindola | cc6ebb8 | 2015-10-14 18:42:16 +0000 | [diff] [blame] | 5 | // RUN: llvm-readobj -r %t | FileCheck %s |
| 6 | // REQUIRES: x86 |
| 7 | |
| 8 | .globl _start |
| 9 | _start: |
| 10 | .type sym1,@function |
| 11 | .weak sym1 |
| 12 | .long sym1@gotpcrel |
| 13 | |
| 14 | .type sym2,@function |
| 15 | .weak sym2 |
| 16 | .long sym2@plt |
| 17 | |
| 18 | .type sym3,@function |
| 19 | .weak sym3 |
| 20 | .quad sym3 |
| 21 | |
| Rafael Espindola | 993f027 | 2016-02-26 14:27:47 +0000 | [diff] [blame] | 22 | .type sym4,@function |
| 23 | .weak sym4 |
| 24 | .quad sym4 |
| 25 | |
| 26 | // Test that we produce dynamic relocation for every weak undefined symbol |
| 27 | // we found. |
| Rafael Espindola | cc6ebb8 | 2015-10-14 18:42:16 +0000 | [diff] [blame] | 28 | |
| 29 | // CHECK: Relocations [ |
| 30 | // CHECK-NEXT: Section ({{.*}}) .rela.dyn { |
| 31 | // CHECK-NEXT: 0x{{.*}} R_X86_64_GLOB_DAT sym1 0x0 |
| Rafael Espindola | cc6ebb8 | 2015-10-14 18:42:16 +0000 | [diff] [blame] | 32 | // CHECK-NEXT: } |
| George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 33 | // CHECK-NEXT: Section ({{.*}}) .rela.plt { |
| 34 | // CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym2 0x0 |
| Rafael Espindola | 993f027 | 2016-02-26 14:27:47 +0000 | [diff] [blame] | 35 | // CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym3 0x0 |
| George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 36 | // CHECK-NEXT: } |
| Rafael Espindola | e3fda8a | 2016-02-26 03:17:25 +0000 | [diff] [blame] | 37 | // CHECK-NEXT: ] |