forked from OSchip/llvm-project
COFF ARM: Error out if 24 bit thumb branches are out of range
In the ELF linker, the same situation already errors out with "relocation R_ARM_THM_CALL out of range". Patch by Martin Storsjö! llvm-svn: 277838
This commit is contained in:
parent
73ff4d08dc
commit
eea45bc478
|
@ -99,6 +99,8 @@ static void applyBranch20T(uint8_t *Off, int32_t V) {
|
|||
}
|
||||
|
||||
static void applyBranch24T(uint8_t *Off, int32_t V) {
|
||||
if (!isInt<25>(V))
|
||||
fatal("relocation out of range");
|
||||
uint32_t S = V < 0 ? 1 : 0;
|
||||
uint32_t J1 = ((~V >> 23) & 1) ^ S;
|
||||
uint32_t J2 = ((~V >> 22) & 1) ^ S;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
.global too_far1
|
||||
too_far1 = 0x1401004
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-windows-gnu %s -o %t
|
||||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-windows-gnu %S/Inputs/far-arm-thumb-abs.s -o %tfar
|
||||
// RUN: not lld-link -entry:_start -subsystem:console %t %tfar -out:%t2 2>&1 | FileCheck %s
|
||||
// REQUIRES: arm
|
||||
.syntax unified
|
||||
.globl _start
|
||||
_start:
|
||||
bl too_far1
|
||||
|
||||
// CHECK: relocation out of range
|
Loading…
Reference in New Issue