diff --git a/lld/test/ELF/arm-bl-v4t.s b/lld/test/ELF/arm-bl-v4t.s --- a/lld/test/ELF/arm-bl-v4t.s +++ b/lld/test/ELF/arm-bl-v4t.s @@ -154,11 +154,11 @@ // FAR-EB-PIE-NEXT: 100002c: 04 ff ff d9 .word 0x04ffffd9 // NEAR-LABEL: <_start>: -// NEAR-NEXT: 1000000: bl 0x100000c @ imm = #4 +// NEAR-NEXT: 1000000: bl 0x1000010 @ imm = #8 // NEAR-NEXT: bx lr // NEAR-EMPTY: // NEAR-LABEL: : -// NEAR-NEXT: 1000008: bl 0x1000012 @ imm = #6 +// NEAR-NEXT: 1000008: bl 0x1000014 @ imm = #8 // NEAR-NEXT: bx lr .section .high, "ax", %progbits @@ -187,10 +187,10 @@ // FAR-PIE-NEXT: 6000004: bx lr // NEAR-LABEL: : -// NEAR-LABEL: 100000e: bx lr +// NEAR-LABEL: 1000010: bx lr // NEAR-EMPTY: // NEAR-NEXT: : -// NEAR-NEXT: 1000012: bx lr +// NEAR-NEXT: 1000014: bx lr #--- far.lds diff --git a/lld/test/ELF/arm-bl-v6-inrange.s b/lld/test/ELF/arm-bl-v6-inrange.s --- a/lld/test/ELF/arm-bl-v6-inrange.s +++ b/lld/test/ELF/arm-bl-v6-inrange.s @@ -38,8 +38,8 @@ // CHECK-NEXT: 500004: f3ff effe blx 0x900004 // CHECK-NEXT: 500008: 4770 bx lr - .arm .section .callee_high, "ax", %progbits + .arm .globl armfunc .type armfunc, %function armfunc: diff --git a/lld/test/ELF/arm-fix-cortex-a8-nopatch.s b/lld/test/ELF/arm-fix-cortex-a8-nopatch.s --- a/lld/test/ELF/arm-fix-cortex-a8-nopatch.s +++ b/lld/test/ELF/arm-fix-cortex-a8-nopatch.s @@ -89,8 +89,8 @@ source5: beq.w target5 -// CALLSITE5: 00025ffe : -// CALLSITE5-NEXT: 25ffe: beq.w 0x25ffa +// CALLSITE5: 00026000 : +// CALLSITE5-NEXT: 26000: beq.w 0x25ffa /// Edge case where two word sequence starts at offset 0xffc, check that /// we don't match. In this case the branch will be completely in the 2nd @@ -104,8 +104,8 @@ target6: bl target6 -// CALLSITE6: 00027000 : -// CALLSITE6-NEXT: 27000: bl 0x27000 +// CALLSITE6: 00027002 : +// CALLSITE6-NEXT: 27002: bl 0x27002 /// Edge case where two word sequence starts at offset 0xffe, check that /// we don't match. In this case the branch will be completely in the 2nd @@ -119,5 +119,5 @@ target7: bl target7 -// CALLSITE7: 00028002 : -// CALLSITE7: 28002: bl 0x28002 +// CALLSITE7: 00028004 : +// CALLSITE7: 28004: bl 0x28004 diff --git a/lld/test/ELF/arm-fix-cortex-a8-recognize.s b/lld/test/ELF/arm-fix-cortex-a8-recognize.s --- a/lld/test/ELF/arm-fix-cortex-a8-recognize.s +++ b/lld/test/ELF/arm-fix-cortex-a8-recognize.s @@ -19,7 +19,7 @@ // CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 25FFE in unpatched output. // CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 26FFE in unpatched output. // CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 27FFE in unpatched output. -// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 28FFE in unpatched output. +// ignore-CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 28FFE in unpatched output. /// We do not detect errors when doing a relocatable link as we don't know what /// the final addresses are. @@ -163,8 +163,8 @@ // CALLSITE7-NEXT: 27ffe: bne.w 0x2901c <__CortexA8657417_27FFE> .section .text.6, "ax", %progbits - .space 4082 .arm + .space 4080 .global target8 .type target8, %function target8: diff --git a/lld/test/ELF/arm-thunk-multipass.s b/lld/test/ELF/arm-thunk-multipass.s --- a/lld/test/ELF/arm-thunk-multipass.s +++ b/lld/test/ELF/arm-thunk-multipass.s @@ -4,7 +4,7 @@ // The output file is large, most of it zeroes. We dissassemble only the // parts we need to speed up the test and avoid a large output file // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x100002 --stop-address=0x10000a | FileCheck --check-prefix=CHECK1 %s -// RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x1000008 --stop-address=0x1000026 | FileCheck --check-prefix=CHECK2 %s +// RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x1000004 --stop-address=0x1000026 | FileCheck --check-prefix=CHECK2 %s // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x1100014 --stop-address=0x1100022 | FileCheck --check-prefix=CHECK3 %s // In this test case a branch that is in range and does not need its range // extended can be pushed out of range by another Thunk, necessitating another @@ -59,8 +59,9 @@ .type arm_target, %function arm_target: bx lr +// CHECK2: 01000004 : // CHECK2: <__Thumbv7ABSLongThunk_arm_target>: -// CHECK2-NEXT: 1000008: f240 0c02 movw r12, #2 +// CHECK2-NEXT: 1000008: f240 0c04 movw r12, #4 // CHECK2-NEXT: 100000c: f2c0 1c00 movt r12, #256 // CHECK2-NEXT: 1000010: 4760 bx r12 // CHECK2: <__Thumbv7ABSLongThunk_target>: diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -11458,6 +11458,7 @@ if (isThumb()) SwitchMode(); getParser().getStreamer().emitAssemblerFlag(MCAF_Code32); + getParser().getStreamer().emitCodeAlignment(Align(4), &getSTI(), 0); return false; } diff --git a/llvm/test/MC/ARM/directive-arch-mode-switch.s b/llvm/test/MC/ARM/directive-arch-mode-switch.s --- a/llvm/test/MC/ARM/directive-arch-mode-switch.s +++ b/llvm/test/MC/ARM/directive-arch-mode-switch.s @@ -35,6 +35,7 @@ @ Switch to ARM mode .arm @ CHECK: .code 32 +@ CHECK: .p2align 2 @ In ARM mode, switch to a CPU which has ARM and Thumb, no warning or .code directive (stay in ARM mode) .cpu cortex-a8 diff --git a/llvm/test/MC/ARM/misaligned-blx.s b/llvm/test/MC/ARM/misaligned-blx.s --- a/llvm/test/MC/ARM/misaligned-blx.s +++ b/llvm/test/MC/ARM/misaligned-blx.s @@ -8,6 +8,7 @@ @ A misaligned ARM destination. .arm + .byte 0x0 .globl _misaligned _misaligned: bx lr diff --git a/llvm/test/MC/ARM/thumb-function-address.s b/llvm/test/MC/ARM/thumb-function-address.s --- a/llvm/test/MC/ARM/thumb-function-address.s +++ b/llvm/test/MC/ARM/thumb-function-address.s @@ -39,4 +39,4 @@ @ CHECK-NEXT: 00000003 0 FUNC LOCAL DEFAULT 2 foo_resolver @ CHECK-NEXT: 00000003 0 IFUNC LOCAL DEFAULT 2 foo @ CHECK-NEXT: 00000004 0 FUNC LOCAL DEFAULT 2 label -@ CHECK-NEXT: 00000006 0 NOTYPE LOCAL DEFAULT 2 $a.1 +@ CHECK-NEXT: 00000008 0 NOTYPE LOCAL DEFAULT 2 $a.1 diff --git a/llvm/test/MC/ARM/thumb-types.s b/llvm/test/MC/ARM/thumb-types.s --- a/llvm/test/MC/ARM/thumb-types.s +++ b/llvm/test/MC/ARM/thumb-types.s @@ -6,15 +6,15 @@ @ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0 @ CHECK-NEXT: 3: 00000002 0 OBJECT LOCAL DEFAULT 2 implicit_data @ CHECK-NEXT: 4: 00000002 0 NOTYPE LOCAL DEFAULT 2 $d.1 -@ CHECK-NEXT: 5: 00000006 0 FUNC LOCAL DEFAULT 2 arm_function -@ CHECK-NEXT: 6: 00000006 0 NOTYPE LOCAL DEFAULT 2 $a.2 -@ CHECK-NEXT: 7: 0000000a 0 NOTYPE LOCAL DEFAULT 2 untyped_text_label -@ CHECK-NEXT: 8: 0000000a 0 NOTYPE LOCAL DEFAULT 2 $t.3 -@ CHECK-NEXT: 9: 0000000d 0 FUNC LOCAL DEFAULT 2 explicit_function -@ CHECK-NEXT: 10: 0000000e 0 NOTYPE LOCAL DEFAULT 2 $d.4 +@ CHECK-NEXT: 5: 00000008 0 FUNC LOCAL DEFAULT 2 arm_function +@ CHECK-NEXT: 6: 00000008 0 NOTYPE LOCAL DEFAULT 2 $a.2 +@ CHECK-NEXT: 7: 0000000c 0 NOTYPE LOCAL DEFAULT 2 untyped_text_label +@ CHECK-NEXT: 8: 0000000c 0 NOTYPE LOCAL DEFAULT 2 $t.3 +@ CHECK-NEXT: 9: 0000000f 0 FUNC LOCAL DEFAULT 2 explicit_function +@ CHECK-NEXT: 10: 00000010 0 NOTYPE LOCAL DEFAULT 2 $d.4 @ CHECK-NEXT: 11: 00000000 4 TLS LOCAL DEFAULT 5 tls -@ CHECK-NEXT: 12: 00000013 0 IFUNC LOCAL DEFAULT 2 indirect_function -@ CHECK-NEXT: 13: 00000012 0 NOTYPE LOCAL DEFAULT 2 $t.5 +@ CHECK-NEXT: 12: 00000015 0 IFUNC LOCAL DEFAULT 2 indirect_function +@ CHECK-NEXT: 13: 00000014 0 NOTYPE LOCAL DEFAULT 2 $t.5 @ CHECK-NEXT: 14: 00000000 0 NOTYPE LOCAL DEFAULT 4 untyped_data_label @ CHECK-NEXT: 15: 00000000 0 NOTYPE LOCAL DEFAULT 4 $t.6 @ CHECK-NEXT: 16: 00000002 0 OBJECT LOCAL DEFAULT 4 explicit_data