llvm-project/lld/test/old-elf/ARM/rel-arm-jump24-veneer-bl.test

121 lines
4.0 KiB
Plaintext

# Check veneer generation for R_ARM_JUMP24 relocation (BL<c> 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 old-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: 400084 0400000b
# Call from main:
# offset = 0x10 ^^
# call site offset PC(arm) ___Z1fv_from_arm addr
# 0x400084 + 0x10 + 0x8 = 0x40009c
#
# Code of the veneer:
# STATIC: 400094 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 95004000
# call addr = 0x400095 ^^
# call addr _Z1fv addr Thumb mode
# 0x400095 = 0x400094 | 0x1
#
# STATIC: SYMBOL TABLE:
# STATIC: 0040009c l F .text {{[0-9a-f]+}} ___Z1fv_from_arm
# STATIC: 00400074 g F .text {{[0-9a-f]+}} main
# STATIC: 00400094 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 old-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: 400124 0400000b
# Call from main:
# offset = 0x10 ^^
# call site offset PC(arm) ___Z1fv_from_arm addr
# 0x400124 + 0x10 + 0x8 = 0x40013c
#
# Code of the veneer:
# EXEC-DYN: 400134 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 35014000
# call addr = 0x400135 ^^
# call addr _Z1fv addr Thumb mode
# 0x400135 = 0x400134 | 0x1
#
# EXEC-DYN: SYMBOL TABLE:
# EXEC-DYN: 0040013c l F .text {{[0-9a-f]+}} ___Z1fv_from_arm
# EXEC-DYN: 00400114 g F .text {{[0-9a-f]+}} main
# EXEC-DYN: 00400134 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: 00482DE904B08DE20030A0E3000053E3FEFFFF0B0030A0E30300A0E10088BDE8
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000010
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
...