llvm-project/lld/test/elf/x86-64-dynamic.test

82 lines
2.9 KiB
Plaintext

# Checks that linking an object file with a shared object creates the necessary
# PLT/GOT Entries
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \
RUN: %p/Inputs/shared.so-x86-64 --output-filetype=yaml -o %t1 --noinhibit-exec
RUN: FileCheck %s < %t1
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
// Don't check the GOT and PLT names as they are only present in assert builds.
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
CHECK: - name: main
CHECK: scope: global
CHECK: references:
CHECK: - kind: R_X86_64_PC32
CHECK: offset: 18
CHECK: target: [[PLTNAME:[-a-zA-Z0-9_]+]]
CHECK: addend: -4
CHECK: - kind: R_X86_64_GOTPCREL
CHECK: offset: 25
CHECK: target: [[GOTNAME:[-a-zA-Z0-9_]+]]
CHECK: addend: -4
- 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
- name: [[PLTNAME]]
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
CHECK:shared-library-atoms:
CHECK: - name: foo
CHECK: load-name: shared.so-x86-64
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