aboutsummaryrefslogtreecommitdiff
path: root/test/old-elf/ARM/rel-thm-mov.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/ARM/rel-thm-mov.test')
-rw-r--r--test/old-elf/ARM/rel-thm-mov.test70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/old-elf/ARM/rel-thm-mov.test b/test/old-elf/ARM/rel-thm-mov.test
new file mode 100644
index 000000000000..5e2e134ce781
--- /dev/null
+++ b/test/old-elf/ARM/rel-thm-mov.test
@@ -0,0 +1,70 @@
+# 1. Check handling of R_ARM_THM_MOVW_ABS_NC and R_THM_ARM_MOVT_ABS relocation pair.
+# 2. Check that instructions are not cropped for symbols that address Thumb code.
+# RUN: yaml2obj -format=elf %s > %t-o.o
+# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \
+# RUN: --noinhibit-exec %t-o.o -o %t
+# RUN: llvm-objdump -s -t %t | FileCheck %s
+# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=INSN-CROP %s
+
+# CHECK: Contents of section .text:
+# CHECK: 400074 {{[0-9a-f]+}} 41f20003 c0f24003 0a221a60
+# addrL = 0x1000 ^^
+# addrH = 0x40 ^^
+# addrH addrL _ZL5data1 addr
+# (0x40 << 16) + 0x1000 = 0x401000
+# CHECK: SYMBOL TABLE:
+# CHECK: 00401000 l .bss 00000004 _ZL5data1
+# CHECK: 00400074 g F .text {{[0-9a-f]+}} main
+#
+# INSN-CROP: Contents of section .text:
+# INSN-CROP: 400074 80b400af
+
+---
+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: 80B400AF40F20003C0F200030A221A6000231846BD465DF8047B7047
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000004
+ Symbol: _ZL5data1
+ Type: R_ARM_THM_MOVW_ABS_NC
+ Addend: 0
+ - Offset: 0x0000000000000008
+ Symbol: _ZL5data1
+ Type: R_ARM_THM_MOVT_ABS
+ 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: 0x0000000000000004
+ Size: 4
+Symbols:
+ Local:
+ - Name: _ZL5data1
+ Type: STT_OBJECT
+ Section: .bss
+ Size: 0x0000000000000004
+ Global:
+ - Name: main
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x0000000000000001
+...