xref: /llvm-project/llvm/test/tools/llvm-objdump/ELF/AArch64/plt.test (revision 157ac423e004961341f26c1567087b8b53770a3d)
1# RUN: llvm-objdump -d %p/Inputs/cfi.elf-aarch64 | FileCheck %s
2
3# CHECK: Disassembly of section .plt:
4# CHECK: <__cfi_slowpath@plt>:
5# CHECK-NEXT: adrp      x16, {{.*}}
6# CHECK: bl {{.*}} <__cfi_slowpath@plt>
7
8# RUN: yaml2obj %s -o %t.aarch64
9# RUN: llvm-objdump -d --mattr=+bti %t.aarch64 | FileCheck --check-prefix=CHECK-BTI %s
10# RUN: yaml2obj -DENDIAN=MSB %s -o %t.aarch64_be
11# RUN: llvm-objdump -d --mattr=+bti %t.aarch64_be | FileCheck --check-prefix=CHECK-BTI %s
12# CHECK-BTI: bl {{.*}} <f1@plt>
13# CHECK-BTI: bl {{.*}} <f2@plt>
14# CHECK-BTI: Disassembly of section .plt:
15# CHECK-BTI: <f1@plt>:
16# CHECK-BTI-NEXT: bti   c
17# CHECK-BTI-NEXT: adrp  x16, {{.*}}
18# CHECK-BTI: <f2@plt>:
19# CHECK-BTI-NEXT: bti   c
20# CHECK-BTI-NEXT: adrp  x16, {{.*}}
21
22# RUN: yaml2obj -D SYM=0 %s -o %tindex
23# RUN: llvm-objdump -d %tindex 2>&1 | FileCheck %s --check-prefix=INVALID_INDEX -DFILE=%tindex
24
25# INVALID_INDEX: warning: '[[FILE]]': PLT entry at 0x210030 references an invalid symbol{{$}}
26# INVALID_INDEX: Disassembly of section .text:
27
28# RUN: yaml2obj -D ST_NAME=0x1234 %s -o %tst_name
29# RUN: llvm-objdump -d %tst_name 2>&1 | FileCheck %s --check-prefix=INVALID_ST_NAME -DFILE=%tst_name
30
31# INVALID_ST_NAME:      warning: '[[FILE]]': st_name (0x1234) is past the end of the string table of size 0x7
32# INVALID_ST_NAME-NEXT: warning: '[[FILE]]': PLT entry at 0x210030 references an invalid symbol{{$}}
33# INVALID_ST_NAME:      Disassembly of section .text:
34
35--- !ELF
36FileHeader:
37  Class:   ELFCLASS64
38  Data:    ELFDATA2[[ENDIAN=LSB]]
39  Type:    ET_EXEC
40  Machine: EM_AARCH64
41Sections:
42  - Name:    .rela.plt
43    Type:    SHT_RELA
44    Flags:   [ SHF_ALLOC ]
45    EntSize: 0x0000000000000018
46    Info:    .got.plt
47    Relocations:
48      - Offset: 0x0000000000230018
49        Symbol: [[SYM=f1]]
50        Type:   R_AARCH64_JUMP_SLOT
51      - Offset: 0x0000000000230020
52        Symbol: f2
53        Type:   R_AARCH64_JUMP_SLOT
54  - Name:    .text
55    Type:    SHT_PROGBITS
56    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
57    Address: 0x0000000000210000
58    Content: 0C00009411000094C0035FD6
59  - Name:    .plt
60    Type:    SHT_PROGBITS
61    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
62    Address: 0x0000000000210010
63    Content: 5F2403D5F07BBFA910010090110A40F91042009120021FD61F2003D51F2003D55F2403D510010090110E40F9106200919F2103D520021FD65F2403D510010090111240F9108200919F2103D520021FD6
64  - Name:    .got.plt
65    Type:    SHT_PROGBITS
66## The content is in little-endian, but it does not affect aarch64_be PLT decoding.
67    Content: '000000000000000000000000000000000000000000000000100021000000000010002100000000001000210000000000'
68Symbols:
69  - Name:    f1
70    StName:  [[ST_NAME=<none>]]
71    Type:    STT_FUNC
72    Binding: STB_GLOBAL
73  - Name:    f2
74    Type:    STT_FUNC
75    Binding: STB_GLOBAL
76...
77