OSDN Git Service

Fix default reloc model on ARM.
authorRafael Espindola <rafael.espindola@gmail.com>
Sat, 28 May 2016 10:41:15 +0000 (10:41 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sat, 28 May 2016 10:41:15 +0000 (10:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271111 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMTargetMachine.cpp
test/CodeGen/ARM/default-reloc.ll [new file with mode: 0644]

index d3276f7..b2b6f3a 100644 (file)
@@ -175,8 +175,8 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
 static Reloc::Model getEffectiveRelocModel(const Triple &TT,
                                            Optional<Reloc::Model> RM) {
   if (!RM.hasValue())
-    // Default relocation model on Darwin is PIC, not DynamicNoPIC.
-    return TT.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
+    // Default relocation model on Darwin is PIC.
+    return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
 
   // DynamicNoPIC is only used on darwin.
   if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
diff --git a/test/CodeGen/ARM/default-reloc.ll b/test/CodeGen/ARM/default-reloc.ll
new file mode 100644 (file)
index 0000000..0b80b73
--- /dev/null
@@ -0,0 +1,5 @@
+; RUN: llc -mtriple=armv7-linux-gnu -O0 < %s
+@a = external global i32
+define i32* @get() {
+  ret i32* @a
+}