summaryrefslogtreecommitdiff
path: root/test/old-elf/ARM/rel-arm-thm-interwork.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/ARM/rel-arm-thm-interwork.test')
-rw-r--r--test/old-elf/ARM/rel-arm-thm-interwork.test121
1 files changed, 121 insertions, 0 deletions
diff --git a/test/old-elf/ARM/rel-arm-thm-interwork.test b/test/old-elf/ARM/rel-arm-thm-interwork.test
new file mode 100644
index 000000000000..3e0e30a614ee
--- /dev/null
+++ b/test/old-elf/ARM/rel-arm-thm-interwork.test
@@ -0,0 +1,121 @@
+# Check ARM <=> Thumb interwork.
+# 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
+
+# Check R_ARM_CALL veneer to call Thumb code
+# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=ARM-CALL %s
+
+# ARM-CALL: Contents of section .text:
+# ARM-CALL: 400074 00482de9 04b08de2 000000fa 0088bde8
+# offset = 0x0 ^^
+# call site offset PC(arm) _Z2f2v addr
+# 0x40007C + 0x0 + 0x8 = 0x400084
+# ARM-CALL: SYMBOL TABLE:
+# ARM-CALL: 00400074 g F .text {{[0-9a-f]+}} _Z1fv
+# ARM-CALL: 00400084 g F .text {{[0-9a-f]+}} _Z2f2v
+# ARM-CALL: 00400090 g F .text {{[0-9a-f]+}} main
+
+# Check R_ARM_THM_CALL veneer to call ARM code
+# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=THM-CALL %s
+
+# THM-CALL: Contents of section .text:
+# THM-CALL: 400094 00bffff7 eeef0023 184680bd
+# offset = -0x24 ^^
+# call site aligned = Align(0x400096, 4) = 0x400094
+# call site aligned offset PC(thm) _Z1fv addr
+# 0x400094 + (-0x24) + 0x4 = 0x400074
+# THM-CALL: SYMBOL TABLE:
+# THM-CALL: 00400074 g F .text {{[0-9a-f]+}} _Z1fv
+# THM-CALL: 00400084 g F .text {{[0-9a-f]+}} _Z2f2v
+# THM-CALL: 00400090 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: 00482DE904B08DE2FEFFFFEB0088BDE8
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000008
+ Symbol: _Z2f2v
+ Type: R_ARM_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
+ Size: 0x0000000000000010
+ - Name: _Z2f2v
+
+# 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: 80B400AFBD465DF8047B704780B500AF00BFFFF7FEFF0023184680BD
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000012
+ 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: _Z2f2v
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x0000000000000001
+ Size: 0x000000000000000C
+ - Name: main
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x000000000000000D
+ Size: 0x0000000000000010
+ - Name: _Z1fv
+...