aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-07-13 19:15:47 +0000
committerJack Carter <jcarter@mips.com>2012-07-13 19:15:47 +0000
commitfd506efec628819f7e6fad8016a9dbb5d8612b8b (patch)
tree9b2aaec8905d2b9f6d088caf051273c5d7494863 /test/MC
parent657c7cb558bcf28dd71456d61100ef19ad5fc08f (diff)
downloadexternal_llvm-fd506efec628819f7e6fad8016a9dbb5d8612b8b.zip
external_llvm-fd506efec628819f7e6fad8016a9dbb5d8612b8b.tar.gz
external_llvm-fd506efec628819f7e6fad8016a9dbb5d8612b8b.tar.bz2
The Mips specific relocation R_MIPS_GOT_DISP
is used in cases where global symbols are directly represented in the GOT and we use an offset into the global offset table. This patch adds direct object support for R_MIPS_GOT_DISP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/Mips/r-mips-got-disp.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/MC/Mips/r-mips-got-disp.ll b/test/MC/Mips/r-mips-got-disp.ll
new file mode 100644
index 0000000..73396ac
--- /dev/null
+++ b/test/MC/Mips/r-mips-got-disp.ll
@@ -0,0 +1,18 @@
+; RUN: llc -march=mips64el -filetype=obj -mcpu=mips64r2 < %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+; Check that the R_MIPS_GOT_DISP relocations were created.
+
+; CHECK: ('r_type', 0x13)
+
+@shl = global i64 1, align 8
+@.str = private unnamed_addr constant [8 x i8] c"0x%llx\0A\00", align 1
+
+define i32 @main() nounwind {
+entry:
+ %0 = load i64* @shl, align 8
+ %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i64 %0) nounwind
+ ret i32 0
+}
+
+declare i32 @printf(i8* nocapture, ...) nounwind
+