summaryrefslogtreecommitdiff
path: root/test/elf/ARM/rel-arm-jump24-veneer-b.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/ARM/rel-arm-jump24-veneer-b.test')
-rw-r--r--test/elf/ARM/rel-arm-jump24-veneer-b.test101
1 files changed, 101 insertions, 0 deletions
diff --git a/test/elf/ARM/rel-arm-jump24-veneer-b.test b/test/elf/ARM/rel-arm-jump24-veneer-b.test
new file mode 100644
index 0000000000000..4caeac083b8db
--- /dev/null
+++ b/test/elf/ARM/rel-arm-jump24-veneer-b.test
@@ -0,0 +1,101 @@
+# Check veneer generation for R_ARM_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 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=B-VENEER %s
+# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=B-ADDR %s
+
+# B-VENEER: Contents of section .text:
+# B-VENEER: 400074 010000ea
+# Call from main:
+# offset = 0x4 ^^
+# call site offset PC(arm) ___Z1fv_from_arm addr
+# 0x400074 + 0x4 + 0x8 = 0x400080
+#
+# Code of the veneer:
+# B-VENEER: {{[0-9a-f]+}} {{[0-9a-f]+}} 04f01fe5
+# B-VENEER: 400084 79004000
+# call addr = 0x400079 ^^
+# call addr _Z1fv addr Thumb mode
+# 0x400079 = 0x400078 | 0x1
+#
+# B-ADDR: SYMBOL TABLE:
+# B-ADDR: 00400080 l F .text {{[0-9a-f]+}} ___Z1fv_from_arm
+# B-ADDR: 00400074 g F .text {{[0-9a-f]+}} main
+# B-ADDR: 00400078 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: FEFFFFEA
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000000
+ 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
+ Content: ''
+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
+ Content: ''
+Symbols:
+ Global:
+ - Name: _Z1fv
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x0000000000000001
+...