Skip to content

Commit

Permalink
[Driver] Don't use frame pointer on Fuchsia when optimizations are en…
Browse files Browse the repository at this point in the history
…abled

This matches the standard behavior on other platforms.

Differential Revision: https://reviews.llvm.org/D129512
  • Loading branch information
petrhosek committed Jul 11, 2022
1 parent d27984a commit 0ed8d82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Expand Up @@ -567,7 +567,7 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args,
break;
}

if (Triple.isOSNetBSD()) {
if (Triple.isOSFuchsia() || Triple.isOSNetBSD()) {
return !areOptimizationsEnabled(Args);
}

Expand Down
12 changes: 12 additions & 0 deletions clang/test/Driver/fuchsia.c
Expand Up @@ -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'
Expand Down

0 comments on commit 0ed8d82

Please sign in to comment.