# Check veneer generation for R_ARM_THM_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 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: 400074 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 00f000b8 # Call from main: # offset = 0x0 ^^ # call site offset PC(thm) ___Z1fv_from_thumb addr # 0x400080 + 0x0 + 0x4 = 0x400084 # # Code of the veneer: # STATIC: 400084 78470000 f9ffffea # offset = -0x1C ^^ # call site offset PC(arm) _Z1fv # 0x400088 + (-0x1C) + 0x8 = 0x400074 # # STATIC: SYMBOL TABLE: # STATIC: 00400084 l F .text {{[0-9a-f]+}} ___Z1fv_from_thumb # STATIC: 00400074 g F .text {{[0-9a-f]+}} _Z1fv # STATIC: 00400080 g F .text {{[0-9a-f]+}} main # 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: 400114 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 00f000b8 # Call from main: # offset = 0x0 ^^ # call site offset PC(thm) ___Z1fv_from_thumb addr # 0x400120 + 0x0 + 0x4 = 0x400124 # # Code of the veneer: # EXEC-DYN: 400124 78470000 f9ffffea # offset = -0x1C ^^ # call site offset PC(arm) _Z1fv # 0x400128 + (-0x1C) + 0x8 = 0x400114 # # EXEC-DYN: SYMBOL TABLE: # EXEC-DYN: 00400124 l F .text {{[0-9a-f]+}} ___Z1fv_from_thumb # EXEC-DYN: 00400114 g F .text {{[0-9a-f]+}} _Z1fv # EXEC-DYN: 00400120 g F .text {{[0-9a-f]+}} main # 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: 0030A0E30300A0E11EFF2FE1 - 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 # 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: FFF7FEBF - Name: .rel.text Type: SHT_REL Link: .symtab AddressAlign: 0x0000000000000004 Info: .text Relocations: - Offset: 0x0000000000000000 Symbol: _Z1fv Type: R_ARM_THM_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 Value: 0x0000000000000001 - Name: _Z1fv ...