forked from OSchip/llvm-project
[COFF] Error out if 20 bit thumb branches are out of range
This is similar to what was added in SVN r277838 for 24 bit branch instructions. Differential Revision: https://reviews.llvm.org/D41163 llvm-svn: 320677
This commit is contained in:
parent
9603b8e3f5
commit
94d72b89d6
|
@ -129,6 +129,8 @@ void applyMOV32T(uint8_t *Off, uint32_t V) {
|
|||
}
|
||||
|
||||
static void applyBranch20T(uint8_t *Off, int32_t V) {
|
||||
if (!isInt<21>(V))
|
||||
fatal("relocation out of range");
|
||||
uint32_t S = V < 0 ? 1 : 0;
|
||||
uint32_t J1 = (V >> 19) & 1;
|
||||
uint32_t J2 = (V >> 18) & 1;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
.global too_far20
|
||||
too_far20 = 0x501004
|
|
@ -0,0 +1,10 @@
|
|||
// REQUIRES: arm
|
||||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-windows-gnu %s -o %t.obj
|
||||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-windows-gnu %S/Inputs/far-arm-thumb-abs20.s -o %t.far.obj
|
||||
// RUN: not lld-link -entry:_start -subsystem:console %t.obj %t.far.obj -out:%t.exe 2>&1 | FileCheck %s
|
||||
.syntax unified
|
||||
.globl _start
|
||||
_start:
|
||||
bne too_far20
|
||||
|
||||
// CHECK: relocation out of range
|
Loading…
Reference in New Issue