Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] Introduce range extension thunks for ARM
This change adds initial support for range extension thunks. All thunks must be created within the first pass so some corner cases are not supported. A follow up patch will add support for multiple passes. With this change the existing tests arm-branch-error.s and arm-thumb-branch-error.s now no longer fail with an out of range branch. These have been renamed and tests added for the range extension thunk. Differential Revision: https://reviews.llvm.org/D34691 llvm-svn: 316752
- Loading branch information
Showing
22 changed files
with
1,112 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t | ||
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/far-arm-abs.s -o %tfar | ||
// RUN: ld.lld %t %tfar -o %t2 2>&1 | ||
// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s | ||
// REQUIRES: arm | ||
.syntax unified | ||
.section .text, "ax",%progbits | ||
.globl _start | ||
.balign 0x10000 | ||
.type _start,%function | ||
_start: | ||
// address of too_far symbols are just out of range of ARM branch with | ||
// 26-bit immediate field and an addend of -8 | ||
bl too_far1 | ||
b too_far2 | ||
beq too_far3 | ||
|
||
// CHECK: Disassembly of section .text: | ||
// CHECK-NEXT: _start: | ||
// CHECK-NEXT: 20000: 01 00 00 eb bl #4 <__ARMv7ABSLongThunk_too_far1> | ||
// CHECK-NEXT: 20004: 03 00 00 ea b #12 <__ARMv7ABSLongThunk_too_far2> | ||
// CHECK-NEXT: 20008: 05 00 00 0a beq #20 <__ARMv7ABSLongThunk_too_far3> | ||
// CHECK: __ARMv7ABSLongThunk_too_far1: | ||
// CHECK-NEXT: 2000c: 08 c0 00 e3 movw r12, #8 | ||
// CHECK-NEXT: 20010: 02 c2 40 e3 movt r12, #514 | ||
// CHECK-NEXT: 20014: 1c ff 2f e1 bx r12 | ||
// CHECK: __ARMv7ABSLongThunk_too_far2: | ||
// CHECK-NEXT: 20018: 0c c0 00 e3 movw r12, #12 | ||
// CHECK-NEXT: 2001c: 02 c2 40 e3 movt r12, #514 | ||
// CHECK-NEXT: 20020: 1c ff 2f e1 bx r12 | ||
// CHECK: __ARMv7ABSLongThunk_too_far3: | ||
// CHECK-NEXT: 20024: 10 c0 00 e3 movw r12, #16 | ||
// CHECK-NEXT: 20028: 02 c2 40 e3 movt r12, #514 | ||
// CHECK-NEXT: 2002c: 1c ff 2f e1 bx r12 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t | ||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %S/Inputs/far-arm-thumb-abs.s -o %tfar | ||
// RUN: ld.lld %t %tfar -o %t2 2>&1 | ||
// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | ||
// REQUIRES: arm | ||
.syntax unified | ||
.thumb | ||
.section .text, "ax",%progbits | ||
.globl _start | ||
.balign 0x10000 | ||
.type _start,%function | ||
_start: | ||
// address of too_far symbols are just out of range of ARM branch with | ||
// 26-bit immediate field and an addend of -8 | ||
bl too_far1 | ||
b too_far2 | ||
beq.w too_far3 | ||
|
||
// CHECK: Disassembly of section .text: | ||
// CHECK-NEXT: _start: | ||
// CHECK-NEXT: 20000: 00 f0 04 f8 bl #8 | ||
// CHECK-NEXT: 20004: 00 f0 07 b8 b.w #14 <__Thumbv7ABSLongThunk_too_far2> | ||
// CHECK-NEXT: 20008: 00 f0 0a 80 beq.w #20 <__Thumbv7ABSLongThunk_too_far3> | ||
// CHECK: __Thumbv7ABSLongThunk_too_far1: | ||
// CHECK-NEXT: 2000c: 40 f2 05 0c movw r12, #5 | ||
// CHECK-NEXT: 20010: c0 f2 02 1c movt r12, #258 | ||
// CHECK-NEXT: 20014: 60 47 bx r12 | ||
// CHECK: __Thumbv7ABSLongThunk_too_far2: | ||
// CHECK-NEXT: 20016: 40 f2 09 0c movw r12, #9 | ||
// CHECK-NEXT: 2001a: c0 f2 02 1c movt r12, #258 | ||
// CHECK-NEXT: 2001e: 60 47 bx r12 | ||
// CHECK: __Thumbv7ABSLongThunk_too_far3: | ||
// CHECK-NEXT: 20020: 40 f2 0d 0c movw r12, #13 | ||
// CHECK-NEXT: 20024: c0 f2 12 0c movt r12, #18 | ||
// CHECK-NEXT: 20028: 60 47 bx r12 | ||
// CHECK-NEXT: 2002a: 00 00 movs r0, r0 |
Oops, something went wrong.