diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 9091c3896705..93e6db82935d 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/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/clang/test/Driver/mips-fsf.cpp b/clang/test/Driver/mips-fsf.cpp index 07b95c8fe9de..e39b24e4ab2c 100644 --- a/clang/test/Driver/mips-fsf.cpp +++ b/clang/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"