llvm-project/lld/test/elf/ARM/rel-base-prel.test

62 lines
1.9 KiB
Plaintext

# Check handling of R_ARM_BASE_PREL relocation.
# It only works for _GLOBAL_OFFSET_TABLE_ symbol, and returns error
# for other cases.
# RUN: yaml2obj -format=elf %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 .data:
# CHECK-NEXT: 401004 fcffffff
# offset = -0x4 ^^
# addr site offset _GOT_
# 0x401004 + (-0x4) = 0x401000
# CHECK: SYMBOL TABLE:
# CHECK: 00401000 g *ABS* {{[0-9a-f]+}} _GLOBAL_OFFSET_TABLE_
---
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: 80B400AF00231846BD465DF8047B7047
- Name: .got
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: '00000000'
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: '00000000'
- Name: .rel.data
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .data
Relocations:
- Offset: 0x0000000000000000
Symbol: _GLOBAL_OFFSET_TABLE_
Type: R_ARM_BASE_PREL
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x0000000000000001
- Name: _GLOBAL_OFFSET_TABLE_
...