summaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-11-21 23:38:59 +0000
committerJack Carter <jcarter@mips.com>2012-11-21 23:38:59 +0000
commit198ad916d736047f8a439f19dee25cee917df8a9 (patch)
tree7a5851d2e159af0669630c415b536fd92b3010e1 /test/MC
parent17ced4521f67255271df17e8d6e3e61de426371c (diff)
downloadllvm-198ad916d736047f8a439f19dee25cee917df8a9.tar.gz
llvm-198ad916d736047f8a439f19dee25cee917df8a9.tar.bz2
llvm-198ad916d736047f8a439f19dee25cee917df8a9.tar.xz
Mips direct object xgot support
This patch provides support for the MIPS relocations: *) R_MIPS_GOT_HI16 *) R_MIPS_GOT_LO16 *) R_MIPS_CALL_HI16 *) R_MIPS_CALL_LO16 These are used for large GOT instruction sequences. Contributer: Jack Carter git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/Mips/xgot.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/MC/Mips/xgot.ll b/test/MC/Mips/xgot.ll
new file mode 100644
index 0000000000..bfe9b9ad66
--- /dev/null
+++ b/test/MC/Mips/xgot.ll
@@ -0,0 +1,42 @@
+; RUN: llc -filetype=obj -mtriple mipsel-unknown-linux -mxgot %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+@.str = private unnamed_addr constant [16 x i8] c"ext_1=%d, i=%d\0A\00", align 1
+@ext_1 = external global i32
+
+define void @fill() nounwind {
+entry:
+
+; Check that the appropriate relocations were created.
+; For the xgot case we want to see R_MIPS_[GOT|CALL]_[HI|LO]16.
+
+; R_MIPS_HI16
+; CHECK: ('r_type', 0x05)
+
+; R_MIPS_LO16
+; CHECK: ('r_type', 0x06)
+
+; R_MIPS_GOT_HI16
+; CHECK: ('r_type', 0x16)
+
+; R_MIPS_GOT_LO16
+; CHECK: ('r_type', 0x17)
+
+; R_MIPS_GOT
+; CHECK: ('r_type', 0x09)
+
+; R_MIPS_LO16
+; CHECK: ('r_type', 0x06)
+
+; R_MIPS_CALL_HI16
+; CHECK: ('r_type', 0x1e)
+
+; R_MIPS_CALL_LO16
+; CHECK: ('r_type', 0x1f)
+
+ %0 = load i32* @ext_1, align 4
+ %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([16 x i8]* @.str, i32 0, i32 0), i32 %0) nounwind
+ ret void
+}
+
+declare i32 @printf(i8* nocapture, ...) nounwind
+