-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Support -Cforce-frame-pointers=non-leaf
#124733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c0b5cf
b3a1975
79416c4
f301d08
7d160ae
598e265
c72a6ad
761ba5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION}; | ||
use rustc_span::source_map::FilePathMapping; | ||
use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm}; | ||
use rustc_target::spec::{LinkSelfContainedComponents, LinkerFeatures}; | ||
use rustc_target::spec::{FramePointer, LinkSelfContainedComponents, LinkerFeatures}; | ||
use rustc_target::spec::{SplitDebuginfo, Target, TargetTriple}; | ||
use std::collections::btree_map::{ | ||
Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter, | ||
|
@@ -2524,6 +2524,15 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M | |
} | ||
} | ||
|
||
if !nightly_options::is_unstable_enabled(matches) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Annoyingly, there seem to be multiple different ways of checking for
In this context, we should be able to just check (I assume you probably just copied this from the code immediately below. 🤷) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did check the unstable_options.unstable_options thing, but it says you shouldn't touch it directly, so I avoided poking it directly. idk lol? I think there should be a different way of specifying "these values are unstable" that uses a pattern or pattern-guard of some kind. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize there's only a few cases of this so it seems like a waste, but I think a profusion of flags is partly the fault of it not being easy to add such patterns that determine stability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t want to derail this PR too much, but if I get a chance I’ll open a separate issue or thread to discuss improvements to unstable values of stable flags, because the status quo has been annoying me too. |
||
&& cg.force_frame_pointers == FramePointer::NonLeaf | ||
{ | ||
early_dcx.early_fatal( | ||
"`-Cforce-frame-pointers=non-leaf` or `always` also requires `-Zunstable-options` \ | ||
and a nightly compiler", | ||
) | ||
} | ||
|
||
// For testing purposes, until we have more feedback about these options: ensure `-Z | ||
// unstable-options` is required when using the unstable `-C link-self-contained` and `-C | ||
// linker-flavor` options. | ||
|
@@ -2966,10 +2975,8 @@ pub(crate) mod dep_tracking { | |
use rustc_span::edition::Edition; | ||
use rustc_span::RealFileName; | ||
use rustc_target::spec::{ | ||
CodeModel, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel, WasmCAbi, | ||
}; | ||
use rustc_target::spec::{ | ||
RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TargetTriple, TlsModel, | ||
CodeModel, FramePointer, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel, | ||
RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TargetTriple, TlsModel, WasmCAbi, | ||
}; | ||
use std::collections::BTreeMap; | ||
use std::hash::{DefaultHasher, Hash}; | ||
|
@@ -3023,6 +3030,7 @@ pub(crate) mod dep_tracking { | |
lint::Level, | ||
WasiExecModel, | ||
u32, | ||
FramePointer, | ||
RelocModel, | ||
CodeModel, | ||
TlsModel, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
//@ compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0 | ||
//@ revisions: Always NonLeaf | ||
//@ [Always] compile-flags: -Cforce-frame-pointers=yes | ||
//@ [NonLeaf] compile-flags: -Cforce-frame-pointers=non-leaf | ||
//@ compile-flags: -Zunstable-options | ||
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 | ||
//@ [NonLeaf] ignore-illumos | ||
//@ [NonLeaf] ignore-openbsd | ||
//@ [NonLeaf] ignore-x86 | ||
//@ [NonLeaf] ignore-x86_64-apple-darwin | ||
//@ [NonLeaf] ignore-windows-gnu | ||
//@ [NonLeaf] ignore-thumb | ||
// result is platform-dependent based on platform's frame pointer settings | ||
|
||
#![crate_type = "lib"] | ||
|
||
// CHECK: attributes #{{.*}} "frame-pointer"="all" | ||
// Always: attributes #{{.*}} "frame-pointer"="all" | ||
// NonLeaf: attributes #{{.*}} "frame-pointer"="non-leaf" | ||
pub fn foo() {} |
Uh oh!
There was an error while loading. Please reload this page.