ARM Darwin default relocation model is PIC.
authorJim Grosbach <grosbach@apple.com>
Fri, 30 Sep 2011 17:41:35 +0000 (17:41 +0000)
committerJim Grosbach <grosbach@apple.com>
Fri, 30 Sep 2011 17:41:35 +0000 (17:41 +0000)
This matches clang, so default options in llc and friends are now closer to
clang's defaults.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140863 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
test/CodeGen/ARM/fast-isel.ll
test/CodeGen/ARM/hidden-vis-2.ll
test/CodeGen/ARM/hidden-vis-3.ll
test/CodeGen/ARM/tail-opts.ll
test/CodeGen/Thumb2/machine-licm.ll

index 5c582ca37faec72cebebb7444aa6ea5b06198826..a55c41075d40349918bc906175e4c9cd2a2b7a08 100644 (file)
@@ -139,8 +139,11 @@ static MCAsmInfo *createARMMCAsmInfo(const Target &T, StringRef TT) {
 static MCCodeGenInfo *createARMMCCodeGenInfo(StringRef TT, Reloc::Model RM,
                                              CodeModel::Model CM) {
   MCCodeGenInfo *X = new MCCodeGenInfo();
-  if (RM == Reloc::Default)
-    RM = Reloc::DynamicNoPIC;
+  if (RM == Reloc::Default) {
+    Triple TheTriple(TT);
+    // Default relocation model on Darwin is PIC, not DynamicNoPIC.
+    RM = TheTriple.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
+  }
   X->InitMCCodeGenInfo(RM, CM);
   return X;
 }
index eb0c5c86925d17e0820b7a27c90a5524928bd190..465e85f9a832f7ddfe6762b69c5c7ce19d8bdc40 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc < %s -O0 -fast-isel-abort -mtriple=armv7-apple-darwin | FileCheck %s --check-prefix=ARM
-; RUN: llc < %s -O0 -fast-isel-abort -mtriple=thumbv7-apple-darwin | FileCheck %s --check-prefix=THUMB
+; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-apple-darwin | FileCheck %s --check-prefix=ARM
+; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-darwin | FileCheck %s --check-prefix=THUMB
 
 ; Very basic fast-isel functionality.
 define i32 @add(i32 %a, i32 %b) nounwind {
index 90f5308d5ff01b3de227fcf6ddb412d3bd194f50..8bb2c6e0c91576335d0779e68b3e4813546f1235 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s
+; RUN: llc < %s -relocation-model=dynamic-no-pic -mtriple=arm-apple-darwin | FileCheck %s
 
 @x = weak hidden global i32 0          ; <i32*> [#uses=1]
 
index fc8b2febc320dbc3e391e107c483d6633abc7b1e..3bc3312e9c4ec58fb12665eb65760e9b82be3454 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=arm-apple-darwin9   | FileCheck %s
+; RUN: llc < %s -relocation-model=dynamic-no-pic -mtriple=arm-apple-darwin9   | FileCheck %s
 
 @x = external hidden global i32                ; <i32*> [#uses=1]
 @y = extern_weak hidden global i32     ; <i32*> [#uses=1]
index 5b3dce386bb7569a78ebede524d9d467989d11bd..3dc77e2a8086c5ececba6ae36dad9f92f0ae916a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=arm-apple-darwin -mcpu=cortex-a8 -asm-verbose=false | FileCheck %s
+; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=dynamic-no-pic -mcpu=cortex-a8 -asm-verbose=false | FileCheck %s
 
 declare void @bar(i32)
 declare void @car(i32)
index b199d699811402da006364df62a9950c864105d3..46937fc84b051c45079e592fb17a46f3eb69a238 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-fp-elim                       | FileCheck %s
+; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -relocation-model=dynamic-no-pic -disable-fp-elim | FileCheck %s
 ; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -relocation-model=pic -disable-fp-elim | FileCheck %s --check-prefix=PIC
 ; rdar://7353541
 ; rdar://7354376