From 0b5d95916ac63dfc7634ef5047d1f67787dadd54 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Thu, 26 Feb 2015 04:45:57 +0000 Subject: [PATCH] [Mips] Handle -mips32r[3|5] / -mips64r[3|5] options while selecting lib/headers paths There is no supported toolchain which provides headers / libs / object files specific to the mips32r[3|5] and mips64r[3|5] ISA. So select "r2" specific folders when they are available. http://reviews.llvm.org/D7879 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230611 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 7 ++- test/Driver/mips-fsf.cpp | 110 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 9091c38967..93e6db8293 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1783,10 +1783,13 @@ static bool findMIPSMultilibs(const llvm::Triple &TargetTriple, StringRef Path, addMultilibFlag(isMips64(TargetArch), "m64", Flags); addMultilibFlag(isMips16(Args), "mips16", Flags); addMultilibFlag(CPUName == "mips32", "march=mips32", Flags); - addMultilibFlag(CPUName == "mips32r2", "march=mips32r2", Flags); + addMultilibFlag(CPUName == "mips32r2" || CPUName == "mips32r3" || + CPUName == "mips32r5", + "march=mips32r2", Flags); addMultilibFlag(CPUName == "mips32r6", "march=mips32r6", Flags); addMultilibFlag(CPUName == "mips64", "march=mips64", Flags); - addMultilibFlag(CPUName == "mips64r2" || CPUName == "octeon", + addMultilibFlag(CPUName == "mips64r2" || CPUName == "mips64r3" || + CPUName == "mips64r5" || CPUName == "octeon", "march=mips64r2", Flags); addMultilibFlag(isMicroMips(Args), "mmicromips", Flags); addMultilibFlag(tools::mips::isUCLibc(Args), "muclibc", Flags); diff --git a/test/Driver/mips-fsf.cpp b/test/Driver/mips-fsf.cpp index 07b95c8fe9..e39b24e4ab 100644 --- a/test/Driver/mips-fsf.cpp +++ b/test/Driver/mips-fsf.cpp @@ -2699,3 +2699,113 @@ // CHECK-EL-NAN64-64R2-64-DEF: "-L[[TC]]/../../../../sysroot/mips64r2/64/el/nan2008/usr/lib" // CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/mips64r2/64/el/nan2008{{/|\\\\}}crtend.o" // CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/el/nan2008/usr/lib{{/|\\\\}}crtn.o" +// +// Check that mips32r3 and mips32r5 are equal to mips32r2 +// +// = Big-endian, mips32r3, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips-linux-gnu -mips32r3 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R3 %s +// CHECK-BE-HF-32R3: "-internal-isystem" +// CHECK-BE-HF-32R3: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-32R3: "-internal-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu" +// CHECK-BE-HF-32R3: "-internal-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-32R3: "-internal-externc-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/include" +// CHECK-BE-HF-32R3: "-internal-externc-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-32R3: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-32R3: "--sysroot=[[TC]]/../../../../sysroot" +// CHECK-BE-HF-32R3: "-dynamic-linker" "/lib/ld.so.1" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-32R3: "[[TC]]{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-32R3: "-L[[TC]]" +// CHECK-BE-HF-32R3: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/../lib" +// CHECK-BE-HF-32R3: "-L[[TC]]/../../../../sysroot/usr/lib/../lib" +// CHECK-BE-HF-32R3: "[[TC]]{{/|\\\\}}crtend.o" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crtn.o" +// +// = Big-endian, mips32r5, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips-linux-gnu -mips32r5 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R5 %s +// CHECK-BE-HF-32R5: "-internal-isystem" +// CHECK-BE-HF-32R5: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-32R5: "-internal-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu" +// CHECK-BE-HF-32R5: "-internal-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-32R5: "-internal-externc-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/include" +// CHECK-BE-HF-32R5: "-internal-externc-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-32R5: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-32R5: "--sysroot=[[TC]]/../../../../sysroot" +// CHECK-BE-HF-32R5: "-dynamic-linker" "/lib/ld.so.1" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-32R5: "[[TC]]{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-32R5: "-L[[TC]]" +// CHECK-BE-HF-32R5: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/../lib" +// CHECK-BE-HF-32R5: "-L[[TC]]/../../../../sysroot/usr/lib/../lib" +// CHECK-BE-HF-32R5: "[[TC]]{{/|\\\\}}crtend.o" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crtn.o" +// +// = Big-endian, mips64r3, ABI 64, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips64-linux-gnu -mips64r3 -mabi=64 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-64R3-64 %s +// CHECK-BE-HF-64R3-64: "-internal-isystem" +// CHECK-BE-HF-64R3-64: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-64R3-64: "-internal-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-internal-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-64R3-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/include" +// CHECK-BE-HF-64R3-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-64R3-64: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-64R3-64: "--sysroot=[[TC]]/../../../../sysroot/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-dynamic-linker" "/lib64/ld.so.1" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-64R3-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-64R3-64: "-L[[TC]]/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-L[[TC]]/../../../../sysroot/mips64r2/64/usr/lib" +// CHECK-BE-HF-64R3-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtend.o" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crtn.o" +// +// = Big-endian, mips64r5, ABI 64, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips64-linux-gnu -mips64r5 -mabi=64 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-64R5-64 %s +// CHECK-BE-HF-64R5-64: "-internal-isystem" +// CHECK-BE-HF-64R5-64: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-64R5-64: "-internal-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-internal-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-64R5-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/include" +// CHECK-BE-HF-64R5-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-64R5-64: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-64R5-64: "--sysroot=[[TC]]/../../../../sysroot/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-dynamic-linker" "/lib64/ld.so.1" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-64R5-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-64R5-64: "-L[[TC]]/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-L[[TC]]/../../../../sysroot/mips64r2/64/usr/lib" +// CHECK-BE-HF-64R5-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtend.o" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crtn.o" -- 2.40.0