From 4e0dbee62bf9cffcd98703f4f30cdb4985475918 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Fri, 30 Sep 2011 17:41:35 +0000 Subject: [PATCH] ARM Darwin default relocation model is PIC. This matches clang, so default options in llc and friends are now closer to clang's defaults. llvm-svn: 140863 --- llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 7 +++++-- llvm/test/CodeGen/ARM/fast-isel.ll | 4 ++-- llvm/test/CodeGen/ARM/hidden-vis-2.ll | 2 +- llvm/test/CodeGen/ARM/hidden-vis-3.ll | 2 +- llvm/test/CodeGen/ARM/tail-opts.ll | 2 +- llvm/test/CodeGen/Thumb2/machine-licm.ll | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp index 5c582ca37fae..a55c41075d40 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp @@ -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; } diff --git a/llvm/test/CodeGen/ARM/fast-isel.ll b/llvm/test/CodeGen/ARM/fast-isel.ll index eb0c5c86925d..465e85f9a832 100644 --- a/llvm/test/CodeGen/ARM/fast-isel.ll +++ b/llvm/test/CodeGen/ARM/fast-isel.ll @@ -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 { diff --git a/llvm/test/CodeGen/ARM/hidden-vis-2.ll b/llvm/test/CodeGen/ARM/hidden-vis-2.ll index 90f5308d5ff0..8bb2c6e0c915 100644 --- a/llvm/test/CodeGen/ARM/hidden-vis-2.ll +++ b/llvm/test/CodeGen/ARM/hidden-vis-2.ll @@ -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 ; [#uses=1] diff --git a/llvm/test/CodeGen/ARM/hidden-vis-3.ll b/llvm/test/CodeGen/ARM/hidden-vis-3.ll index fc8b2febc320..3bc3312e9c4e 100644 --- a/llvm/test/CodeGen/ARM/hidden-vis-3.ll +++ b/llvm/test/CodeGen/ARM/hidden-vis-3.ll @@ -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 ; [#uses=1] @y = extern_weak hidden global i32 ; [#uses=1] diff --git a/llvm/test/CodeGen/ARM/tail-opts.ll b/llvm/test/CodeGen/ARM/tail-opts.ll index 5b3dce386bb7..3dc77e2a8086 100644 --- a/llvm/test/CodeGen/ARM/tail-opts.ll +++ b/llvm/test/CodeGen/ARM/tail-opts.ll @@ -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) diff --git a/llvm/test/CodeGen/Thumb2/machine-licm.ll b/llvm/test/CodeGen/Thumb2/machine-licm.ll index b199d6998114..46937fc84b05 100644 --- a/llvm/test/CodeGen/Thumb2/machine-licm.ll +++ b/llvm/test/CodeGen/Thumb2/machine-licm.ll @@ -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