2013-05-11 00:44:02 +08:00
|
|
|
# Checks that linking an object file with a shared object creates the necessary
|
|
|
|
# PLT/GOT Entries
|
2013-04-05 02:59:24 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \
|
2013-09-23 12:24:15 +08:00
|
|
|
RUN: %p/Inputs/shared.so-x86-64 --output-filetype=yaml -o %t1 --noinhibit-exec
|
2013-03-02 03:33:42 +08:00
|
|
|
RUN: FileCheck %s < %t1
|
2013-03-01 04:04:32 +08:00
|
|
|
|
2013-10-25 05:00:25 +08:00
|
|
|
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/use-shared-32s.x86-64 \
|
|
|
|
RUN: %p/Inputs/shared.so-x86-64 --output-filetype=yaml --noinhibit-exec \
|
|
|
|
RUN: | FileCheck %s --check-prefix=32S
|
|
|
|
|
2013-03-01 04:04:32 +08:00
|
|
|
// Don't check the GOT and PLT names as they are only present in assert builds.
|
2013-09-12 23:43:09 +08:00
|
|
|
CHECK: type: got
|
|
|
|
CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
CHECK: section-choice: custom-required
|
|
|
|
CHECK: section-name: .got.dyn
|
|
|
|
CHECK: permissions: rw-
|
|
|
|
CHECK: references:
|
|
|
|
CHECK: - kind: R_X86_64_GLOB_DAT
|
|
|
|
CHECK: offset: 0
|
|
|
|
CHECK: target: i
|
2013-03-01 04:04:32 +08:00
|
|
|
|
|
|
|
CHECK: - name: main
|
|
|
|
CHECK: scope: global
|
|
|
|
CHECK: references:
|
|
|
|
CHECK: - kind: R_X86_64_PC32
|
2013-03-01 09:09:46 +08:00
|
|
|
CHECK: offset: 18
|
2013-05-11 00:44:02 +08:00
|
|
|
CHECK: target: [[PLTNAME:[-a-zA-Z0-9_]+]]
|
2013-03-01 04:04:32 +08:00
|
|
|
CHECK: addend: -4
|
2013-10-25 06:46:48 +08:00
|
|
|
CHECK: - kind: R_X86_64_GOTPCREL
|
2013-03-01 09:09:46 +08:00
|
|
|
CHECK: offset: 25
|
2013-05-11 00:44:02 +08:00
|
|
|
CHECK: target: [[GOTNAME:[-a-zA-Z0-9_]+]]
|
2013-03-01 09:09:46 +08:00
|
|
|
CHECK: addend: -4
|
2013-03-01 04:04:32 +08:00
|
|
|
|
|
|
|
- name: .PLT0
|
|
|
|
CHECK: type: stub
|
|
|
|
CHECK: content: [ FF, 35, 00, 00, 00, 00, FF, 25, 00, 00, 00, 00,
|
|
|
|
CHECK: 90, 90, 90, 90 ]
|
|
|
|
CHECK: alignment: 2^4
|
|
|
|
CHECK: section-choice: custom-required
|
|
|
|
CHECK: section-name: .plt
|
|
|
|
CHECK: references:
|
|
|
|
CHECK: - kind: R_X86_64_PC32
|
|
|
|
CHECK: offset: 2
|
|
|
|
target: __got0
|
|
|
|
CHECK: addend: -4
|
|
|
|
CHECK: - kind: R_X86_64_PC32
|
|
|
|
CHECK: offset: 8
|
|
|
|
target: __got1
|
|
|
|
CHECK: addend: -4
|
2013-04-05 02:59:24 +08:00
|
|
|
- name: [[PLTNAME]]
|
2013-03-01 04:04:32 +08:00
|
|
|
CHECK: type: stub
|
|
|
|
CHECK: content: [ FF, 25, 00, 00, 00, 00, 68, 00, 00, 00, 00, E9,
|
|
|
|
CHECK: 00, 00, 00, 00 ]
|
|
|
|
CHECK: alignment: 2^4
|
|
|
|
CHECK: section-choice: custom-required
|
|
|
|
CHECK: section-name: .plt
|
|
|
|
CHECK: references:
|
|
|
|
CHECK: - kind: R_X86_64_PC32
|
|
|
|
CHECK: offset: 2
|
|
|
|
target: __got_foo
|
|
|
|
CHECK: addend: -4
|
|
|
|
CHECK: - kind: LLD_R_X86_64_GOTRELINDEX
|
|
|
|
CHECK: offset: 7
|
|
|
|
target: __got_foo
|
|
|
|
CHECK: - kind: R_X86_64_PC32
|
|
|
|
CHECK: offset: 12
|
|
|
|
target: .PLT0
|
|
|
|
CHECK: addend: -4
|
2013-05-23 01:41:04 +08:00
|
|
|
|
2013-03-01 04:04:32 +08:00
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
|
2013-03-01 04:04:32 +08:00
|
|
|
CHECK:shared-library-atoms:
|
|
|
|
CHECK: - name: foo
|
|
|
|
CHECK: load-name: shared.so-x86-64
|
2013-10-25 05:00:25 +08:00
|
|
|
|
|
|
|
32S: name: main
|
|
|
|
32S: kind: R_X86_64_PC32
|
|
|
|
32S: target: func
|
|
|
|
32S: kind: R_X86_64_32S
|
|
|
|
32S: kind: R_X86_64_PC32
|
|
|
|
32S: type: stub
|