blob: b4da2e552e111c2320cd6e9bf68f1c29582936bc [file] [log] [blame]
Rafael Espindolacc6ebb82015-10-14 18:42:16 +00001// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
Rafael Espindola993f0272016-02-26 14:27:47 +00002// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc-weak.s -o %t2.o
Rafael Espindola9c8904f2015-11-18 06:11:01 +00003// RUN: ld.lld -shared %t2.o -o %t2.so
4// RUN: ld.lld %t.o %t2.so -o %t
Rafael Espindolacc6ebb82015-10-14 18:42:16 +00005// 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 Espindola993f0272016-02-26 14:27:47 +000022 .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 Espindolacc6ebb82015-10-14 18:42:16 +000028
29// CHECK: Relocations [
30// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
31// CHECK-NEXT: 0x{{.*}} R_X86_64_GLOB_DAT sym1 0x0
Rafael Espindolacc6ebb82015-10-14 18:42:16 +000032// CHECK-NEXT: }
George Rimar648a2c32015-10-20 08:54:27 +000033// CHECK-NEXT: Section ({{.*}}) .rela.plt {
34// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym2 0x0
Rafael Espindola993f0272016-02-26 14:27:47 +000035// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym3 0x0
George Rimar648a2c32015-10-20 08:54:27 +000036// CHECK-NEXT: }
Rafael Espindolae3fda8a2016-02-26 03:17:25 +000037// CHECK-NEXT: ]