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

72 lines
2.6 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 -emit-yaml -o %t1 --noinhibit-exec
RUN: FileCheck %s < %t1
// Don't check the GOT and PLT names as they are only present in assert builds.
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_PC32
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: name: [[GOTNAME]]
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:shared-library-atoms:
CHECK: - name: foo
CHECK: load-name: shared.so-x86-64