aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-04-25 23:38:13 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-04-25 23:38:13 +0000
commit552fa44473eb3412325706db9b6a8877819d542e (patch)
tree36334f5caff49a09546a820921b7f6d56bc8572f
parentb534d242728ebd2c62544b5e7e5f2bed04f35440 (diff)
downloadllvm-llvmorg-3.4.1.zip
llvm-llvmorg-3.4.1.tar.gz
llvm-llvmorg-3.4.1.tar.bz2
Merging r198940 (second try):llvmorg-3.4.1-rc2llvmorg-3.4.1
------------------------------------------------------------------------ r198940 | kristof.beyls | 2014-01-10 08:44:34 -0500 (Fri, 10 Jan 2014) | 2 lines Enable -fuse-init-array for all AArch64 ELF targets by default, not just linux. ------------------------------------------------------------------------ llvm-svn: 207288
-rw-r--r--clang/lib/Driver/ToolChains.cpp28
-rw-r--r--clang/lib/Driver/ToolChains.h4
-rw-r--r--clang/test/Driver/constructors.c9
3 files changed, 26 insertions, 15 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index e5528f0..4688335 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -1622,6 +1622,21 @@ bool Generic_GCC::isPICDefaultForced() const {
return false;
}
+void Generic_GCC::addClangTargetOptions(const ArgList &DriverArgs,
+ ArgStringList &CC1Args) const {
+ const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion();
+ bool UseInitArrayDefault =
+ getTriple().getArch() == llvm::Triple::aarch64 ||
+ (getTriple().getOS() == llvm::Triple::Linux && (
+ !V.isOlderThan(4, 7, 0) ||
+ getTriple().getEnvironment() == llvm::Triple::Android));
+
+ if (DriverArgs.hasFlag(options::OPT_fuse_init_array,
+ options::OPT_fno_use_init_array,
+ UseInitArrayDefault))
+ CC1Args.push_back("-fuse-init-array");
+}
+
/// Hexagon Toolchain
std::string Hexagon_TC::GetGnuDir(const std::string &InstalledDir) {
@@ -2536,19 +2551,6 @@ Tool *Linux::buildAssembler() const {
return new tools::gnutools::Assemble(*this);
}
-void Linux::addClangTargetOptions(const ArgList &DriverArgs,
- ArgStringList &CC1Args) const {
- const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion();
- bool UseInitArrayDefault =
- !V.isOlderThan(4, 7, 0) ||
- getTriple().getArch() == llvm::Triple::aarch64 ||
- getTriple().getEnvironment() == llvm::Triple::Android;
- if (DriverArgs.hasFlag(options::OPT_fuse_init_array,
- options::OPT_fno_use_init_array,
- UseInitArrayDefault))
- CC1Args.push_back("-fuse-init-array");
-}
-
std::string Linux::computeSysRoot() const {
if (!getDriver().SysRoot.empty())
return getDriver().SysRoot;
diff --git a/clang/lib/Driver/ToolChains.h b/clang/lib/Driver/ToolChains.h
index 50d3700..c758fbb 100644
--- a/clang/lib/Driver/ToolChains.h
+++ b/clang/lib/Driver/ToolChains.h
@@ -164,6 +164,8 @@ public:
virtual bool isPICDefault() const;
virtual bool isPIEDefault() const;
virtual bool isPICDefaultForced() const;
+ virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const;
protected:
virtual Tool *getTool(Action::ActionClass AC) const;
@@ -579,8 +581,6 @@ public:
virtual void
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
- virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
- llvm::opt::ArgStringList &CC1Args) const;
virtual void
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
diff --git a/clang/test/Driver/constructors.c b/clang/test/Driver/constructors.c
index 9ea91d9..680705f 100644
--- a/clang/test/Driver/constructors.c
+++ b/clang/test/Driver/constructors.c
@@ -46,3 +46,12 @@
// RUN: -target i386-unknown-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target aarch64-none-linux-gnu \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target aarch64-none-none-eabi \
+// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s