1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o 3// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc-weak.s -o %t2.o 4// RUN: ld.lld -shared %t2.o -o %t2.so 5// RUN: ld.lld %t.o %t2.so -o %t 6// RUN: llvm-readobj -r %t | FileCheck %s 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 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. 28 29// CHECK: Relocations [ 30// CHECK-NEXT: Section ({{.*}}) .rela.dyn { 31// CHECK-NEXT: 0x{{.*}} R_X86_64_GLOB_DAT sym1 0x0 32// CHECK-NEXT: } 33// CHECK-NEXT: Section ({{.*}}) .rela.plt { 34// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym2 0x0 35// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym3 0x0 36// CHECK-NEXT: } 37// CHECK-NEXT: ] 38