[llvm-branch-commits] [cfe-branch] r227398 - Merging r227393:
Hans Wennborg
hans at hanshq.net
Wed Jan 28 15:52:21 PST 2015
Author: hans
Date: Wed Jan 28 17:52:21 2015
New Revision: 227398
URL: http://llvm.org/viewvc/llvm-project?rev=227398&view=rev
Log:
Merging r227393:
------------------------------------------------------------------------
r227393 | joerg | 2015-01-28 15:30:39 -0800 (Wed, 28 Jan 2015) | 5 lines
For the --be8 flag, check explicitly for pre-v7 / pre-v6m cores.
Those used the old Big Endian support on ARM and don't need flags.
Refactor the logic in a separate common function, which also looks at
-march. Add corresponding logic for the Linux toolchain.
------------------------------------------------------------------------
Modified:
cfe/branches/release_36/ (props changed)
cfe/branches/release_36/lib/Driver/Tools.cpp
cfe/branches/release_36/lib/Driver/Tools.h
cfe/branches/release_36/test/Driver/linux-ld.c
cfe/branches/release_36/test/Driver/netbsd.c
Propchange: cfe/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 28 17:52:21 2015
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:226008,226049,226136,226282,226624,226707,226754,226863,226877,227062,227088,227220,227251,227278,227295,227368
+/cfe/trunk:226008,226049,226136,226282,226624,226707,226754,226863,226877,227062,227088,227220,227251,227278,227295,227368,227393
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_36/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Driver/Tools.cpp?rev=227398&r1=227397&r2=227398&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Driver/Tools.cpp (original)
+++ cfe/branches/release_36/lib/Driver/Tools.cpp Wed Jan 28 17:52:21 2015
@@ -5423,6 +5423,20 @@ const char *arm::getLLVMArchSuffixForARM
.Default("");
}
+void arm::appendEBLinkFlags(const ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple) {
+ if (Args.hasArg(options::OPT_r))
+ return;
+
+ StringRef Suffix = getLLVMArchSuffixForARM(getARMCPUForMArch(Args, Triple));
+ const char *LinkFlag = llvm::StringSwitch<const char *>(Suffix)
+ .Cases("v4", "v4t", "v5", "v5e", nullptr)
+ .Cases("v6", "v6t2", nullptr)
+ .Default("--be8");
+
+ if (LinkFlag)
+ CmdArgs.push_back(LinkFlag);
+}
+
bool mips::hasMipsAbiArg(const ArgList &Args, const char *Value) {
Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
return A && (A->getValue() == StringRef(Value));
@@ -6886,8 +6900,7 @@ void netbsd::Link::ConstructJob(Compilat
break;
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
- if (!Args.hasArg(options::OPT_r))
- CmdArgs.push_back("--be8");
+ arm::appendEBLinkFlags(Args, CmdArgs, getToolChain().getTriple());
CmdArgs.push_back("-m");
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::EABI:
@@ -7438,6 +7451,10 @@ void gnutools::Link::ConstructJob(Compil
if (Args.hasArg(options::OPT_s))
CmdArgs.push_back("-s");
+ if (ToolChain.getArch() == llvm::Triple::armeb ||
+ ToolChain.getArch() == llvm::Triple::thumbeb)
+ arm::appendEBLinkFlags(Args, CmdArgs, getToolChain().getTriple());
+
for (const auto &Opt : ToolChain.ExtraOpts)
CmdArgs.push_back(Opt.c_str());
Modified: cfe/branches/release_36/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Driver/Tools.h?rev=227398&r1=227397&r2=227398&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Driver/Tools.h (original)
+++ cfe/branches/release_36/lib/Driver/Tools.h Wed Jan 28 17:52:21 2015
@@ -228,6 +228,8 @@ namespace arm {
const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
const llvm::Triple &Triple);
const char* getLLVMArchSuffixForARM(StringRef CPU);
+
+ void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple);
}
namespace mips {
Modified: cfe/branches/release_36/test/Driver/linux-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/Driver/linux-ld.c?rev=227398&r1=227397&r2=227398&view=diff
==============================================================================
--- cfe/branches/release_36/test/Driver/linux-ld.c (original)
+++ cfe/branches/release_36/test/Driver/linux-ld.c Wed Jan 28 17:52:21 2015
@@ -1397,3 +1397,21 @@
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
// RUN: | FileCheck --check-prefix=CHECK-u %s
// CHECK-u: "-u" "asdf"
+
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=armeb-unknown-linux \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-ARMEB %s
+// CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-ARMEB-NOT: "--be8"
+// CHECK-ARMEB: "-m" "armebelf_linux_eabi"
+
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=armebv7-unknown-linux \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s
+// CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-ARMV7EB: "--be8"
+// CHECK-ARMV7EB: "-m" "armebelf_linux_eabi"
Modified: cfe/branches/release_36/test/Driver/netbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/Driver/netbsd.c?rev=227398&r1=227397&r2=227398&view=diff
==============================================================================
--- cfe/branches/release_36/test/Driver/netbsd.c (original)
+++ cfe/branches/release_36/test/Driver/netbsd.c Wed Jan 28 17:52:21 2015
@@ -19,6 +19,12 @@
// RUN: %clang -no-canonical-prefixes -target armeb--netbsd-eabi \
// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=ARMEB %s
+// RUN: %clang -no-canonical-prefixes -target armeb--netbsd-eabi -march=armv7 \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=ARMV7EB %s
+// RUN: %clang -no-canonical-prefixes -target armv7eb--netbsd-eabi \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=ARMV7EB %s
// RUN: %clang -r -no-canonical-prefixes -target armeb--netbsd-eabi \
// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=ARMEB-R %s
@@ -135,11 +141,14 @@
// ARMEB: clang{{.*}}" "-cc1" "-triple" "armebv5e--netbsd-eabi"
// ARMEB: as{{.*}}" "-mcpu=arm926ej-s" "-o"
// ARMEB: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
-// ARMEB: "--be8" "-m" "armelfb_nbsd_eabi"
+// ARMEB-NOT: "--be8"
+// ARMEB: "-m" "armelfb_nbsd_eabi"
// ARMEB: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
// ARMEB: "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o"
// ARMEB: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
// ARMEB: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+// ARMV7EB: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
+// ARMV7EB: "--be8" "-m" "armelfb_nbsd_eabi"
// ARMEB-R: ld{{.*}}"
// ARMEB-R-NOT: "--be8"
More information about the llvm-branch-commits
mailing list