diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -567,7 +567,7 @@ break; } - if (Triple.isOSNetBSD()) { + if (Triple.isOSFuchsia() || Triple.isOSNetBSD()) { return !areOptimizationsEnabled(Args); } diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c --- a/clang/test/Driver/fuchsia.c +++ b/clang/test/Driver/fuchsia.c @@ -55,6 +55,18 @@ // CHECK-NOT: crtend.o // CHECK-NOT: crtn.o +// RUN: %clang -### %s --target=x86_64-unknown-fuchsia 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-FP-ALL +// RUN: %clang -### %s --target=aarch64-unknown-fuchsia 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-FP-NONLEAF +// RUN: %clang -### %s --target=x86_64-unknown-fuchsia -O3 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-FP-NONE +// RUN: %clang -### %s --target=aarch64-unknown-fuchsia -O3 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-FP-NONE +// CHECK-FP-ALL: "-mframe-pointer=all" +// CHECK-FP-NONLEAF: "-mframe-pointer=non-leaf" +// CHECK-FP-NONE: "-mframe-pointer=none" + // RUN: %clang -### %s --target=x86_64-unknown-fuchsia -rtlib=libgcc -fuse-ld=lld 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-RTLIB // CHECK-RTLIB: error: invalid runtime library name in argument '-rtlib=libgcc'