Add unstable -Z direct-access-external-data cmdline flag for rustc

The new flag has been described in the Major Change Proposal at
https://github.com/rust-lang/compiler-team/issues/707
This commit is contained in:
WANG Rui 2023-12-14 22:07:53 +08:00
parent 94807670a6
commit 06a41687b1
8 changed files with 74 additions and 10 deletions

View file

@ -1553,6 +1553,8 @@ options! {
dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
"in dep-info output, omit targets for tracking dependencies of the dep-info files \
themselves (default: no)"),
direct_access_external_data: Option<bool> = (None, parse_opt_bool, [TRACKED],
"Direct or use GOT indirect to reference external data symbols"),
dual_proc_macros: bool = (false, parse_bool, [TRACKED],
"load proc macros for both target and host, but only link to the target (default: no)"),
dump_dep_graph: bool = (false, parse_bool, [UNTRACKED],

View file

@ -793,6 +793,13 @@ impl Session {
self.opts.unstable_opts.tls_model.unwrap_or(self.target.tls_model)
}
pub fn direct_access_external_data(&self) -> Option<bool> {
self.opts
.unstable_opts
.direct_access_external_data
.or(self.target.direct_access_external_data)
}
pub fn split_debuginfo(&self) -> SplitDebuginfo {
self.opts.cg.split_debuginfo.unwrap_or(self.target.split_debuginfo)
}