hanchenye-llvm-project/lld/test/elf/ARM/rel-arm-jump24-veneer-b.test

123 lines
3.9 KiB
Plaintext

# Check veneer generation for R_ARM_JUMP24 relocation (B instruction call).
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o
# RUN: lld -flavor gnu -target arm -m armelf_linux_eabi -Bstatic \
# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t
# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=STATIC %s
# STATIC: Contents of section .text:
# STATIC: 400074 010000ea
# Call from main:
# offset = 0x4 ^^
# call site offset PC(arm) ___Z1fv_from_arm addr
# 0x400074 + 0x4 + 0x8 = 0x400080
#
# Code of the veneer:
# STATIC: {{[0-9a-f]+}} {{[0-9a-f]+}} 04f01fe5
# STATIC: 400084 79004000
# ^^ call addr = 0x400079
# call addr _Z1fv addr Thumb mode
# 0x400079 = 0x400078 | 0x1
#
# STATIC: SYMBOL TABLE:
# STATIC: 00400080 l F .text {{[0-9a-f]+}} ___Z1fv_from_arm
# STATIC: 00400074 g F .text {{[0-9a-f]+}} main
# STATIC: 00400078 g F .text {{[0-9a-f]+}} _Z1fv
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o
# RUN: lld -flavor gnu -target arm -m armelf_linux_eabi \
# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t
# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=EXEC-DYN %s
# EXEC-DYN: Contents of section .text:
# EXEC-DYN: 400114 010000ea
# Call from main:
# offset = 0x4 ^^
# call site offset PC(arm) ___Z1fv_from_arm addr
# 0x400114 + 0x4 + 0x8 = 0x400120
#
# Code of the veneer:
# EXEC-DYN: {{[0-9a-f]+}} {{[0-9a-f]+}} 04f01fe5
# EXEC-DYN: 400124 19014000
# call addr = 0x400119 ^^
# call addr _Z1fv addr Thumb mode
# 0x400119 = 0x400118 | 0x1
#
# EXEC-DYN: SYMBOL TABLE:
# EXEC-DYN: 00400120 l F .text {{[0-9a-f]+}} ___Z1fv_from_arm
# EXEC-DYN: 00400114 g F .text {{[0-9a-f]+}} main
# EXEC-DYN: 00400118 g F .text {{[0-9a-f]+}} _Z1fv
# arm.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_ARM
Flags: [ EF_ARM_EABI_VER5 ]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000004
Content: FEFFFFEA
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000000
Symbol: _Z1fv
Type: R_ARM_JUMP24
Addend: 0
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: main
Type: STT_FUNC
Section: .text
- Name: _Z1fv
# thm.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_ARM
Flags: [ EF_ARM_EABI_VER5 ]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000004
Content: 4FF0000318467047
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: _Z1fv
Type: STT_FUNC
Section: .text
Value: 0x0000000000000001
...