Author: Sarah Purohit Date: 2021-08-12T21:46:30-07:00 New Revision: ee620b1743bc524ce4b84d8113cb5b43ddcf3b59
URL: https://github.com/llvm/llvm-project/commit/ee620b1743bc524ce4b84d8113cb5b43ddcf3b59 DIFF: https://github.com/llvm/llvm-project/commit/ee620b1743bc524ce4b84d8113cb5b43ddcf3b59.diff LOG: [clang][Arm] Fix the default floating point ABI for 'armv7-pc-win32-macho' It is incorrect to select the hardware floating point ABI on Mach-O platforms using the Windows triple if the ABI is "apcs-gnu". rdar://81810554 Differential Revision: https://reviews.llvm.org/D107939 Added: clang/test/Driver/windows-macho.c Modified: clang/lib/Driver/ToolChains/Arch/ARM.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp index 4ab547fabe43..a6cf378f81f3 100644 --- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp +++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp @@ -314,6 +314,10 @@ arm::FloatABI arm::getDefaultFloatABI(const llvm::Triple &Triple) { // FIXME: this is invalid for WindowsCE case llvm::Triple::Win32: + // It is incorrect to select hard float ABI on MachO platforms if the ABI is + // "apcs-gnu". + if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple)) + return FloatABI::Soft; return FloatABI::Hard; case llvm::Triple::NetBSD: diff --git a/clang/test/Driver/windows-macho.c b/clang/test/Driver/windows-macho.c new file mode 100644 index 000000000000..9e0a966937fa --- /dev/null +++ b/clang/test/Driver/windows-macho.c @@ -0,0 +1,11 @@ +// RUN: %clang -target armv7-pc-win32-macho -msoft-float -### -c %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-SOFTFLOAT +// CHECK-SOFTFLOAT-NOT: error: unsupported option '-msoft-float' for target 'thumbv7-pc-windows-macho' + +// RUN: %clang -target armv7-pc-win32-macho -mhard-float -### -c %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-HARDFLOAT +// CHECK-HARDFLOAT: error: unsupported option '-mhard-float' for target 'thumbv7-pc-windows-macho' + +// RUN: %clang -target armv7-pc-win32-macho -### -c %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-DEFAULT-SOFTFLOAT-ABI +// CHECK-DEFAULT-SOFTFLOAT-ABI: "-mfloat-abi" "soft" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits