[llvm] [ARMAsmBackend] Add checks for relocation addends in assembler (PR #109969)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 23:00:52 PDT 2024


================
@@ -0,0 +1,28 @@
+// RUN: not llvm-mc -triple armv7-apple-darwin -filetype=obj %s 2>&1 | FileCheck %s
+
+_foo:
+    // Check that the relocation size is valid.
+
+    // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range
+    bl  _foo+0xfffffff00
----------------
davemgreen wrote:

The final instruction will take the value as a signed number and add/subtract it from a 32bit address (the current PC), so in that regard there is no wrapping at 26bits. I believe (mostly trusting what GCC is doing) that the valid range is between -0x1fffff8 and +0x2000004.

https://github.com/llvm/llvm-project/pull/109969


More information about the llvm-commits mailing list