[cfe-commits] r163898 - in /cfe/trunk: lib/Driver/ test/Driver/ test/Driver/Inputs/debian_6_mips_tree/ test/Driver/Inputs/debian_6_mips_tree/lib/ test/Driver/Inputs/debian_6_mips_tree/lib32/ test/Driver/Inputs/debian_6_mips_tree/lib64/ test/Driver/Inputs/debian_6_mips_tree/usr/ test/Driver/Inputs/debian_6_mips_tree/usr/lib/ test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/ test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/ test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/ test/D...
Simon Atanasyan
satanasyan at mips.com
Fri Sep 14 04:27:24 PDT 2012
Author: atanasyan
Date: Fri Sep 14 06:27:24 2012
New Revision: 163898
URL: http://llvm.org/viewvc/llvm-project?rev=163898&view=rev
Log:
Do not use "lib32" directory to create a library/object files
paths when target is MIPS 32-bit.
The patch reviewed by Chandler Carruth.
Added:
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib/.keep
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib32/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib32/.keep
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib64/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib64/.keep
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o
cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=163898&r1=163897&r2=163898&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Sep 14 06:27:24 2012
@@ -2037,6 +2037,28 @@
if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
}
+static bool isMipsArch(llvm::Triple::ArchType Arch) {
+ return Arch == llvm::Triple::mips ||
+ Arch == llvm::Triple::mipsel ||
+ Arch == llvm::Triple::mips64 ||
+ Arch == llvm::Triple::mips64el;
+}
+
+static StringRef getMultilibDir(const llvm::Triple &Triple,
+ const ArgList &Args) {
+ if (!isMipsArch(Triple.getArch()))
+ return Triple.isArch32Bit() ? "lib32" : "lib64";
+
+ // lib32 directory has a special meaning on MIPS targets.
+ // It contains N32 ABI binaries. Use this folder if produce
+ // code for N32 ABI only.
+ Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
+ if (A && (A->getValue(Args) == StringRef("n32")))
+ return "lib32";
+
+ return Triple.isArch32Bit() ? "lib" : "lib64";
+}
+
Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
: Generic_ELF(D, Triple, Args) {
llvm::Triple::ArchType Arch = Triple.getArch();
@@ -2060,11 +2082,6 @@
if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb)
ExtraOpts.push_back("-X");
- const bool IsMips = Arch == llvm::Triple::mips ||
- Arch == llvm::Triple::mipsel ||
- Arch == llvm::Triple::mips64 ||
- Arch == llvm::Triple::mips64el;
-
const bool IsAndroid = Triple.getEnvironment() == llvm::Triple::Android;
// Do not use 'gnu' hash style for Mips targets because .gnu.hash
@@ -2072,7 +2089,7 @@
// .gnu.hash needs symbols to be grouped by hash code whereas the MIPS
// ABI requires a mapping between the GOT and the symbol table.
// Android loader does not support .gnu.hash.
- if (!IsMips && !IsAndroid) {
+ if (!isMipsArch(Arch) && !IsAndroid) {
if (IsRedhat(Distro) || IsOpenSuse(Distro) ||
(IsUbuntu(Distro) && Distro >= UbuntuMaverick))
ExtraOpts.push_back("--hash-style=gnu");
@@ -2101,7 +2118,7 @@
// to the link paths.
path_list &Paths = getFilePaths();
- const std::string Multilib = Triple.isArch32Bit() ? "lib32" : "lib64";
+ const std::string Multilib = getMultilibDir(Triple, Args);
const std::string MultiarchTriple = getMultiarchTriple(Triple, SysRoot);
// Add the multilib suffixed paths where they are available.
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib/.keep?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib32/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib32/.keep?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib64/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/lib64/.keep?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o?rev=163898&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o?rev=163898&view=auto
==============================================================================
(empty)
Modified: cfe/trunk/test/Driver/linux-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=163898&r1=163897&r2=163898&view=diff
==============================================================================
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Fri Sep 14 06:27:24 2012
@@ -429,3 +429,36 @@
// CHECK-ANDROID-PIE: "-lgcc"
// CHECK-ANDROID-PIE-NOT: "gcc_s"
// CHECK-ANDROID-PIE: "{{.*}}/crtend_android.o"
+//
+// Check linker invocation on Debian 6 MIPS 32/64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPSEL %s
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib/crt1.o"
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib/crti.o"
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib/../lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/../lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mips64el-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL %s
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64/crt1.o"
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64/crti.o"
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib/../lib64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/../lib64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
More information about the cfe-commits
mailing list