summaryrefslogtreecommitdiff
path: root/test/old-elf/ARM/mapping-code-model.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/ARM/mapping-code-model.test')
-rw-r--r--test/old-elf/ARM/mapping-code-model.test160
1 files changed, 160 insertions, 0 deletions
diff --git a/test/old-elf/ARM/mapping-code-model.test b/test/old-elf/ARM/mapping-code-model.test
new file mode 100644
index 0000000000000..affa10b464f82
--- /dev/null
+++ b/test/old-elf/ARM/mapping-code-model.test
@@ -0,0 +1,160 @@
+# Check that mapping symbols are treated as ARM or Thumb code properly.
+#
+# 1. ARM <=> Thumb generates both veneers.
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t-a-arm.o
+# RUN: yaml2obj -format=elf -docnum 3 %s > %t-t-thm.o
+# RUN: lld -flavor old-gnu -target arm-linux-gnu --defsym=main=f_a \
+# RUN: -Bstatic --noinhibit-exec %t-a-arm.o %t-t-thm.o -o %t
+# RUN: llvm-objdump -t %t | FileCheck -check-prefix=INTER %s
+
+# INTER: SYMBOL TABLE:
+# INTER: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_t_from_arm
+# INTER: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_a_from_thumb
+
+# 2. Thumb <=> Thumb doesn't generate veneers.
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t-a-thm.o
+# RUN: yaml2obj -format=elf -docnum 3 %s > %t-t-thm.o
+# RUN: lld -flavor old-gnu -target arm-linux-gnu --defsym=main=f_t \
+# RUN: -Bstatic --noinhibit-exec %t-t-thm.o %t-a-thm.o -o %t
+# RUN: llvm-objdump -t %t | FileCheck -check-prefix=THUMB %s
+
+# THUMB: SYMBOL TABLE:
+# THUMB-NOT: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_t_from_thumb
+# THUMB-NOT: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_a_from_thumb
+
+# f-a-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: 00482DE904B08DE2FEFFFFEBFEFFFFEA0030A0E10300A0E10088BDE8
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000008
+ Symbol: f_t
+ Type: R_ARM_CALL
+ - Offset: 0x000000000000000C
+ Symbol: f_t
+ Type: R_ARM_JUMP24
+ - 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:
+ Local:
+ - Name: '$a'
+ Section: .text
+ Size: 0x0000000000000002
+ - Name: '$a.f_a'
+ Section: .text
+ Value: 0x0000000000000002
+ Global:
+ - Name: f_a
+ Type: STT_FUNC
+ Section: .text
+ - Name: f_t
+
+# f-a-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: 80B400AF00231846BD465DF8047B7047
+ - 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:
+ Local:
+ - Name: '$t'
+ Section: .text
+ Size: 0x0000000000000002
+ - Name: '$t.f_a'
+ Section: .text
+ Value: 0x0000000000000002
+ Global:
+ - Name: f_a
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x0000000000000001
+
+# f-t-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: 80B500AFFFF7FEFFFFF7FEBF0346184680BD00BF
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000004
+ Symbol: f_a
+ Type: R_ARM_THM_CALL
+ - Offset: 0x0000000000000008
+ Symbol: f_a
+ Type: R_ARM_THM_JUMP24
+ - 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:
+ Local:
+ - Name: '$t'
+ Section: .text
+ Size: 0x0000000000000002
+ - Name: '$t.f_t'
+ Section: .text
+ Value: 0x0000000000000002
+ Global:
+ - Name: f_t
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x0000000000000001
+ - Name: f_a
+...