llvm-project/lld/test/old-elf/ARM/rel-arm-target1.test

115 lines
3.7 KiB
Plaintext

# Check handling of R_ARM_TARGET1 relocation.
#
# 1. R_ARM_TARGET1 is equal to R_ARM_ABS32
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-abs32.o
# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \
# RUN: --noinhibit-exec --target1-abs %t-abs32.o -o %t-abs32
# RUN: llvm-objdump -s -t %t-abs32 | FileCheck -check-prefix=CHECK-ABS32 %s
#
# CHECK-ABS32: Contents of section .data:
# CHECK-ABS32-NEXT: 401000 84004000
# CHECK-ABS32: SYMBOL TABLE:
# CHECK-ABS32: 00400074 g F .text {{[0-9a-f]+}} main
# CHECK-ABS32: 00401000 g .data 00000004 data
#
# 2. R_ARM_TARGET1 is equal to R_ARM_REL32
# Check handling of R_ARM_REL32 relocation.
# RUN: yaml2obj -format=elf %s -docnum 2 > %t-rel32.o
# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \
# RUN: --noinhibit-exec --target1-rel %t-rel32.o -o %t-rel32
# RUN: llvm-objdump -s -t %t-rel32 | FileCheck -check-prefix=CHECK-REL32 %s
#
# CHECK-REL32: Contents of section .text:
# CHECK-REL32-NEXT: 400074 {{[0-9a-f]+}} 880fff00
# CHECK-REL32: SYMBOL TABLE:
# CHECK-REL32: 00400074 g F .text {{[0-9a-f]+}} main
# CHECK-REL32: 00401000 g .bss {{[0-9a-f]+}} _myref
# abs32.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: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: '10000000'
- Name: .rel.data
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .data
Relocations:
- Offset: 0x0000000000000000
Symbol: main
Type: R_ARM_TARGET1
Addend: 0
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: main
Type: STT_FUNC
Section: .text
Size: 0x000000000000001C
- Name: data
Type: STT_OBJECT
Section: .data
Size: 0x0000000000000004
# rel32.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: 80B400AF0000FF0000231846BD465DF8047B7047
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000004
Symbol: _myref
Type: R_ARM_TARGET1
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Symbols:
Global:
- Name: _myref
Type: STT_OBJECT
Section: .bss
Size: 0x0000000000000004
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x0000000000000001
Size: 0x0000000000000014
...