[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:26 PDT 2024
================
@@ -0,0 +1,55 @@
+// RUN: not llvm-mc -triple armv7-apple-darwin -filetype=obj %s 2>&1 | FileCheck %s
+
+// Check that the relocation size is valid.
+// Check outside of range of the largest accepted positive number
+_foo1:
+ // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range
+ b _foo1+33554432
+
+// Check Same as above, for smallest negative value
+_foo2:
+ // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range
+ b _foo2-33554436
+
+// Edge case - subtracting positive number
+_foo3:
+ // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range
+ b _foo3-0x2000010
+
+// Edge case - adding negative number
+_foo4:
+ // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range
+ b _foo4+0x2000008
+
+_foo5:
+ // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range
+ bl _foo5+33554432
----------------
davemgreen wrote:
Are these repeated? It might be worth having a test for +0x2000004 and -0x1fffff8 if they should be in-range to test the other side of the edge-case.
https://github.com/llvm/llvm-project/pull/109969
More information about the llvm-commits
mailing list