summaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorMatheus Almeida <matheus.almeida@imgtec.com>2013-12-17 17:10:00 +0000
committerMatheus Almeida <matheus.almeida@imgtec.com>2013-12-17 17:10:00 +0000
commit24c63679d7e82da13157d538cee27fbca66d645e (patch)
tree5263119777fe29b112eec17fc88c8f601bc85606 /test/MC
parent7c29644cced4666e12d6fb333e4eabd82ce85bd8 (diff)
downloadllvm-24c63679d7e82da13157d538cee27fbca66d645e.tar.gz
llvm-24c63679d7e82da13157d538cee27fbca66d645e.tar.bz2
llvm-24c63679d7e82da13157d538cee27fbca66d645e.tar.xz
[mips] Fix off by one issue when applying a fixup.
The branch offset for a R_MIPS_PC16 relocation is indeed a 16-bit signed immediate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197506 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/Mips/micromips-pc16-fixup.s10
-rw-r--r--test/MC/Mips/mips-pc16-fixup.s10
2 files changed, 20 insertions, 0 deletions
diff --git a/test/MC/Mips/micromips-pc16-fixup.s b/test/MC/Mips/micromips-pc16-fixup.s
new file mode 100644
index 0000000000..146a1550b4
--- /dev/null
+++ b/test/MC/Mips/micromips-pc16-fixup.s
@@ -0,0 +1,10 @@
+# RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -arch=mips -mattr=+micromips 2>&1 -filetype=obj | FileCheck %s
+#
+# CHECK-NOT: LLVM ERROR: out of range PC16 fixup
+
+.text
+ b foo
+ .space 65536 - 8, 1 # -8 = size of b instr plus size of automatically inserted nop
+foo:
+ add $0,$0,$0
+
diff --git a/test/MC/Mips/mips-pc16-fixup.s b/test/MC/Mips/mips-pc16-fixup.s
new file mode 100644
index 0000000000..5443532d61
--- /dev/null
+++ b/test/MC/Mips/mips-pc16-fixup.s
@@ -0,0 +1,10 @@
+# RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -arch=mips 2>&1 -filetype=obj | FileCheck %s
+#
+# CHECK-NOT: LLVM ERROR: out of range PC16 fixup
+
+.text
+ b foo
+ .space 131072 - 8, 1 # -8 = size of b instr plus size of automatically inserted nop
+foo:
+ add $0,$0,$0
+