[clang] 0ed8d82 - [Driver] Don't use frame pointer on Fuchsia when optimizations are enabled
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 11 14:45:49 PDT 2022
Author: Petr Hosek
Date: 2022-07-11T21:45:42Z
New Revision: 0ed8d8209584daa5ff30aae51b5396d05d7aa997
URL: https://github.com/llvm/llvm-project/commit/0ed8d8209584daa5ff30aae51b5396d05d7aa997
DIFF: https://github.com/llvm/llvm-project/commit/0ed8d8209584daa5ff30aae51b5396d05d7aa997.diff
LOG: [Driver] Don't use frame pointer on Fuchsia when optimizations are enabled
This matches the standard behavior on other platforms.
Differential Revision: https://reviews.llvm.org/D129512
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/fuchsia.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index ee445775e7b72..aae416f19fbd5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -567,7 +567,7 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args,
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
index 99c43f4cecabd..4a76db38612dd 100644
--- 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'
More information about the cfe-commits
mailing list