2015-10-15 02:42:16 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
2016-02-26 22:27:47 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc-weak.s -o %t2.o
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld -shared %t2.o -o %t2.so
|
|
|
|
// RUN: ld.lld %t.o %t2.so -o %t
|
2015-10-15 02:42:16 +08:00
|
|
|
// RUN: llvm-readobj -r %t | FileCheck %s
|
|
|
|
// REQUIRES: x86
|
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
.type sym1,@function
|
|
|
|
.weak sym1
|
|
|
|
.long sym1@gotpcrel
|
|
|
|
|
|
|
|
.type sym2,@function
|
|
|
|
.weak sym2
|
|
|
|
.long sym2@plt
|
|
|
|
|
|
|
|
.type sym3,@function
|
|
|
|
.weak sym3
|
|
|
|
.quad sym3
|
|
|
|
|
2016-02-26 22:27:47 +08:00
|
|
|
.type sym4,@function
|
|
|
|
.weak sym4
|
|
|
|
.quad sym4
|
|
|
|
|
|
|
|
// Test that we produce dynamic relocation for every weak undefined symbol
|
|
|
|
// we found.
|
2015-10-15 02:42:16 +08:00
|
|
|
|
|
|
|
// CHECK: Relocations [
|
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
|
|
|
// CHECK-NEXT: 0x{{.*}} R_X86_64_GLOB_DAT sym1 0x0
|
|
|
|
// CHECK-NEXT: }
|
2015-10-20 16:54:27 +08:00
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
|
|
|
|
// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym2 0x0
|
2016-02-26 22:27:47 +08:00
|
|
|
// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym3 0x0
|
2015-10-20 16:54:27 +08:00
|
|
|
// CHECK-NEXT: }
|
2016-02-26 11:17:25 +08:00
|
|
|
// CHECK-NEXT: ]
|