2013-05-11 00:44:02 +08:00
|
|
|
# This test checks that IRELATIVE relocations are created for symbols that
|
|
|
|
# need relocation even for static links.
|
2013-04-05 02:59:24 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux -emit-yaml -r \
|
|
|
|
RUN: %p/Inputs/ifunc.x86-64 | FileCheck %s
|
2013-02-01 17:14:21 +08:00
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux -emit-yaml --noinhibit-exec \
|
|
|
|
RUN: %p/Inputs/ifunc.x86-64 %p/Inputs/ifunc.cpp.x86-64 \
|
2013-02-06 03:15:03 +08:00
|
|
|
RUN: | FileCheck %s --check-prefix=PLT
|
2013-01-24 06:08:46 +08:00
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux -o %t %p/Inputs/ifunc.x86-64 \
|
|
|
|
RUN: -e main -static %p/Inputs/ifunc.cpp.x86-64 \
|
2013-02-15 04:32:00 +08:00
|
|
|
RUN: && llvm-objdump -d -s %t| FileCheck %s --check-prefix=BIN
|
2013-05-17 13:10:30 +08:00
|
|
|
#REMOVE THE BELOW LINE WHEN llvm-readobj adds functionality to print
|
|
|
|
#Dynamic relocations
|
|
|
|
#llvm-readobj -r %t | FileCheck %s --check-prefix=RELATIVEADDEND
|
2013-04-05 02:59:24 +08:00
|
|
|
|
|
|
|
PLT: defined-atoms:
|
|
|
|
|
|
|
|
PLT: name: plt
|
2013-02-06 03:15:03 +08:00
|
|
|
PLT: scope: global
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: references:
|
|
|
|
PLT: kind: R_X86_64_PC32
|
|
|
|
PLT: target: [[PLTNAME:[-a-zA-Z0-9_]+]]
|
|
|
|
PLT: kind: layout-before
|
|
|
|
PLT: target: __hey_1
|
2013-05-11 00:44:02 +08:00
|
|
|
|
2013-01-30 00:38:03 +08:00
|
|
|
PLT: name: main
|
|
|
|
PLT: scope: global
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: references:
|
|
|
|
PLT: kind: R_X86_64_PC32
|
|
|
|
PLT: target: [[PLTNAME]]
|
2013-01-30 00:38:03 +08:00
|
|
|
|
|
|
|
// Make sure the target of main's relocation is a stub with a PC32 relocation.
|
|
|
|
// This relocation is to the got atom, but you can't really write that check in
|
|
|
|
// FileCheck.
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: name:
|
2013-01-30 00:38:03 +08:00
|
|
|
PLT: type: stub
|
|
|
|
PLT: references
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: kind: R_X86_64_PC32
|
|
|
|
|
2013-05-23 01:41:04 +08:00
|
|
|
// Make sure there's a got entry with a IRELATIVE relocation.
|
|
|
|
PLT: type: got
|
|
|
|
PLT: references:
|
|
|
|
PLT: kind: R_X86_64_IRELATIVE
|
|
|
|
PLT: target: hey
|
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
CHECK: name: hey
|
|
|
|
CHECK: scope: global
|
|
|
|
CHECK: type: resolver
|
|
|
|
|
2013-02-01 17:14:21 +08:00
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
// This is a horribly brittle test. We need a way to do arithmetic on captured
|
|
|
|
// variables.
|
2013-03-01 04:04:32 +08:00
|
|
|
BIN: {{[0-9a-f]+}}: ff 25 {{[0-9a-f]+}} {{[0-9a-f]+}} 00 00 jmpq *{{[0-9]+}}(%rip)
|
2013-02-01 17:14:21 +08:00
|
|
|
BIN: .got.plt:
|
2013-03-01 04:04:32 +08:00
|
|
|
BIN-NEXT: {{[0-9a-f]+}} 00000000 00000000
|