hanchenye-llvm-project/lld/test/elf/ARM/rel-thm-call.test

115 lines
3.6 KiB
Plaintext
Raw Normal View History

# Check handling of R_ARM_THM_CALL relocation.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o.o
# RUN: lld -flavor gnu -target arm -m armelf_linux_eabi -Bstatic \
# RUN: --noinhibit-exec %t-o.o -o %t
# RUN: llvm-objdump -s -t %t | FileCheck %s
# CHECK: Contents of section .text:
# CHECK: 400084 fff7f6ff 00231846 80bd00bf
# ^^ offset = -0x14
# call site offset PC(thm) _Z1fv addr
# 0x400084 + (-0x14) + 0x4 = 0x400074
# CHECK: SYMBOL TABLE:
# CHECK: 00400074 g F .text {{[0-9a-f]+}} _Z1fv
# CHECK: 00400080 g F .text {{[0-9a-f]+}} main
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: not lld -flavor gnu -target arm -m armelf_linux_eabi -Bstatic \
# RUN: --noinhibit-exec %t-o.o -o %t 2> %t-error
# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error
# OVERFLOW: Relocation out of range {{.*}} (R_ARM_THM_CALL)
# good.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: 80B400AFBD465DF8047B704780B500AFFFF7FEFF0023184680BD00BF
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000010
Symbol: _Z1fv
Type: R_ARM_THM_CALL
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: _Z1fv
Type: STT_FUNC
Section: .text
Value: 0x0000000000000001
Size: 0x000000000000000C
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x000000000000000D
Size: 0x000000000000000E
# overflow.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: 80B400AFBD465DF8047B704780B500AF00F400D00023184680BD00BF
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000010
Symbol: _Z1fv
Type: R_ARM_THM_CALL
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: _Z1fv
Type: STT_FUNC
Section: .text
Value: 0x0000000000000001
Size: 0x000000000000000C
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x000000000000000D
Size: 0x000000000000000E
...