Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -745,6 +745,11 @@ } else if (Triple.isOSWindows()) { // FIXME: this is invalid for WindowsCE ABIName = "aapcs"; + } else if (Triple.getOS() == llvm::Triple::NetBSD) { + if (Triple.getEnvironment() == llvm::Triple::EABI) + ABIName = "aapcs"; + else + ABIName = "apcs-gnu"; } else { // Select the default based on the platform. switch(Triple.getEnvironment()) { Index: test/Driver/arm-abi.c =================================================================== --- test/Driver/arm-abi.c +++ test/Driver/arm-abi.c @@ -20,6 +20,12 @@ // RUN: %clang -target arm--windows-gnueabi %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-AAPCS %s +// NetBSD defaults to apcs-gnu, but can also use aapcs +// RUN: %clang -target arm--netbsd- %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-APCS-GNU %s +// RUN: %clang -target arm--netbsd-eabi %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-AAPCS %s + // Otherwise, ABI is celected based on environment // RUN: %clang -target arm---android %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s