Go back to producing relocations for out of range symbols.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 5 Nov 2015 01:10:15 +0000 (01:10 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 5 Nov 2015 01:10:15 +0000 (01:10 +0000)
This brings back the behavior from before r252090 for out of range symbols.

Should bring some arm bots back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252119 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
test/MC/ARM/thumb-branches-err.s [deleted file]
test/MC/ARM/thumb-branches.s

index fd678fb132ee1b5fbdd96104964d60c79471fe4c..7a0a089b35f561999684aee48d72cea5d0a3aa76 100644 (file)
@@ -639,13 +639,11 @@ void ARMAsmBackend::processFixupValue(const MCAssembler &Asm,
 
     // If the symbol is external the linker will handle it.
     // FIXME: Should we handle it as an optimization?
 
     // If the symbol is external the linker will handle it.
     // FIXME: Should we handle it as an optimization?
-    if (Sym->isExternal()) {
+
+    // If the symbol is out of range, produce a relocation and hope the
+    // linker can handle it. GNU AS produces an error in this case.
+    if (Sym->isExternal() || Value >= 0x400004)
       IsResolved = false;
       IsResolved = false;
-    } else {
-      if (Value >= 0x400004)
-        Asm.getContext().reportFatalError(Fixup.getLoc(),
-                                          "out of range for branch");
-    }
   }
   // We must always generate a relocation for BL/BLX instructions if we have
   // a symbol to reference, as the linker relies on knowing the destination
   }
   // We must always generate a relocation for BL/BLX instructions if we have
   // a symbol to reference, as the linker relies on knowing the destination
diff --git a/test/MC/ARM/thumb-branches-err.s b/test/MC/ARM/thumb-branches-err.s
deleted file mode 100644 (file)
index 624ebee..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-@ RUN: not llvm-mc < %s -triple thumbv5-linux-gnueabi -filetype=obj -o %t 2>&1 | FileCheck %s
-
-        bl      end
-        .space 0x400000
-end:
-
-@ CHECK: out of range for branch
index 4870e82162398ff609d40c7e8a1750f470aa3cde..b4cdfa12a55689f59b614c8a51b581df561a76ac 100644 (file)
@@ -16,5 +16,10 @@ end2:
         .global end3
 end3:
 
         .global end3
 end3:
 
+        bl      end4
+        .space 0x400000
+end4:
+
 @ CHECK: 0x400003 R_ARM_THM_CALL end2 0x0
 @ CHECK: 0x800006 R_ARM_THM_CALL end3 0x0
 @ CHECK: 0x400003 R_ARM_THM_CALL end2 0x0
 @ CHECK: 0x800006 R_ARM_THM_CALL end3 0x0
+@ CHECK: 0xC0000A R_ARM_THM_CALL end4 0x0