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-09-23 12:24:15 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux --output-filetype=yaml -r \
|
2013-04-05 02:59:24 +08:00
|
|
|
RUN: %p/Inputs/ifunc.x86-64 | FileCheck %s
|
2013-02-01 17:14:21 +08:00
|
|
|
|
2013-09-23 12:24:15 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux --output-filetype=yaml --noinhibit-exec \
|
2013-04-05 02:59:24 +08:00
|
|
|
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 \
|
2013-06-05 09:38:12 +08:00
|
|
|
RUN: -e main -static %p/Inputs/ifunc.cpp.x86-64
|
|
|
|
RUN: llvm-objdump -d -s %t| FileCheck %s --check-prefix=BIN
|
|
|
|
RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELATIVEADDEND
|
2013-04-05 02:59:24 +08:00
|
|
|
|
2013-09-28 05:30:04 +08:00
|
|
|
# Test that STT_GNU_IFUNC symbols have type Code in SharedLibraryAtom.
|
|
|
|
RUN: lld -flavor gnu -target x86_64-linux --output-filetype=yaml \
|
|
|
|
RUN: --noinhibit-exec %p/Inputs/ifunc.cpp.x86-64 -L%p/Inputs -lifunc.x86-64 \
|
|
|
|
RUN: | FileCheck %s --check-prefix=SHARED
|
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: defined-atoms:
|
|
|
|
|
2013-09-12 23:43:09 +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-10-11 09:50:04 +08:00
|
|
|
PLT: name: plt
|
2013-02-06 03:15:03 +08:00
|
|
|
PLT: scope: global
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: references:
|
2013-10-11 09:50:04 +08:00
|
|
|
PLT: kind: R_X86_64_PC32
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: target: [[PLTNAME:[-a-zA-Z0-9_]+]]
|
2013-10-11 09:50:04 +08:00
|
|
|
PLT: kind: layout-before
|
|
|
|
PLT: target: __hey_1
|
2013-05-11 00:44:02 +08:00
|
|
|
|
2013-10-11 09:50:04 +08:00
|
|
|
PLT: name: main
|
2013-01-30 00:38:03 +08:00
|
|
|
PLT: scope: global
|
2013-04-05 02:59:24 +08:00
|
|
|
PLT: references:
|
2013-10-11 09:50:04 +08:00
|
|
|
PLT: kind: R_X86_64_PC32
|
2013-04-05 02:59:24 +08:00
|
|
|
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
|
|
|
|
|
|
|
|
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
|
2013-06-05 09:38:12 +08:00
|
|
|
|
|
|
|
RELATIVEADDEND: Relocations [
|
|
|
|
RELATIVEADDEND-NEXT: Section (1) .rela.plt {
|
2013-10-30 08:02:04 +08:00
|
|
|
RELATIVEADDEND-NEXT: 0x401000 R_X86_64_IRELATIVE - 0x400120
|
2013-06-05 09:38:12 +08:00
|
|
|
RELATIVEADDEND-NEXT: }
|
|
|
|
RELATIVEADDEND-NEXT: ]
|
2013-09-28 05:30:04 +08:00
|
|
|
|
|
|
|
SHARED: shared-library-atoms
|
|
|
|
SHARED: name: hey
|
|
|
|
SHARED-NOT: data
|