Index: lib/Driver/ToolChains/Gnu.cpp =================================================================== --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -2412,11 +2412,13 @@ return true; case llvm::Triple::mips64: case llvm::Triple::mips64el: - // Enabled for Debian and Android mips64/mipsel, as they can precisely - // identify the ABI in use (Debian) or only use N64 for MIPS64 (Android). - // Other targets are unable to distinguish N32 from N64. + // Enabled for Debian, Android, FreeBSD and OpenBSD mips64/mipsel, as they + // can precisely identify the ABI in use (Debian) or only use N64 for MIPS64 + // (Android). Other targets are unable to distinguish N32 from N64. if (getTriple().getEnvironment() == llvm::Triple::GNUABI64 || - getTriple().isAndroid()) + getTriple().isAndroid() || + getTriple().isOSFreeBSD() || + getTriple().isOSOpenBSD()) return true; return false; default: Index: test/Driver/freebsd.c =================================================================== --- test/Driver/freebsd.c +++ test/Driver/freebsd.c @@ -183,3 +183,10 @@ // RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s // CHECK-MIPS64-CPU: "-target-cpu" "mips3" + +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" Index: test/Driver/openbsd.c =================================================================== --- test/Driver/openbsd.c +++ test/Driver/openbsd.c @@ -74,6 +74,13 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" + // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s