Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b4e75bd

Browse files
committedJun 28, 2024
Auto merge of rust-lang#127067 - matthiaskrgr:rollup-85ecygb, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#124741 (patchable-function-entry: Add unstable compiler flag and attribute) - rust-lang#126470 (make cargo submodule optional) - rust-lang#126701 (ignore `llvm::Lld` if lld is not enabled) - rust-lang#126956 (core: avoid `extern type`s in formatting infrastructure) - rust-lang#126970 (Simplify `str::clone_into`) - rust-lang#127058 (Tighten `fn_decl_span` for async blocks) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9c3bc80 + f305466 commit b4e75bd

File tree

78 files changed

+753
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+753
-315
lines changed
 

‎compiler/rustc_interface/src/tests.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use rustc_session::config::{
88
ErrorOutputType, ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold,
99
Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail,
1010
LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey,
11-
PacRet, Passes, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath,
12-
SymbolManglingVersion, WasiExecModel,
11+
PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip,
12+
SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
1313
};
1414
use rustc_session::lint::Level;
1515
use rustc_session::search_paths::SearchPath;
@@ -813,6 +813,11 @@ fn test_unstable_options_tracking_hash() {
813813
tracked!(packed_bundled_libs, true);
814814
tracked!(panic_abort_tests, true);
815815
tracked!(panic_in_drop, PanicStrategy::Abort);
816+
tracked!(
817+
patchable_function_entry,
818+
PatchableFunctionEntry::from_total_and_prefix_nops(10, 5)
819+
.expect("total must be greater than or equal to prefix")
820+
);
816821
tracked!(plt, Some(true));
817822
tracked!(polonius, Polonius::Legacy);
818823
tracked!(precise_enum_drop_elaboration, false);

‎compiler/rustc_middle/src/middle/codegen_fn_attrs.rs

+27
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,32 @@ pub struct CodegenFnAttrs {
4545
/// The `#[repr(align(...))]` attribute. Indicates the value of which the function should be
4646
/// aligned to.
4747
pub alignment: Option<Align>,
48+
/// The `#[patchable_function_entry(...)]` attribute. Indicates how many nops should be around
49+
/// the function entry.
50+
pub patchable_function_entry: Option<PatchableFunctionEntry>,
51+
}
52+
53+
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
54+
pub struct PatchableFunctionEntry {
55+
/// Nops to prepend to the function
56+
prefix: u8,
57+
/// Nops after entry, but before body
58+
entry: u8,
59+
}
60+
61+
impl PatchableFunctionEntry {
62+
pub fn from_config(config: rustc_session::config::PatchableFunctionEntry) -> Self {
63+
Self { prefix: config.prefix(), entry: config.entry() }
64+
}
65+
pub fn from_prefix_and_entry(prefix: u8, entry: u8) -> Self {
66+
Self { prefix, entry }
67+
}
68+
pub fn prefix(&self) -> u8 {
69+
self.prefix
70+
}
71+
pub fn entry(&self) -> u8 {
72+
self.entry
73+
}
4874
}
4975

5076
#[derive(Clone, Copy, PartialEq, Eq, TyEncodable, TyDecodable, HashStable)]
@@ -121,6 +147,7 @@ impl CodegenFnAttrs {
121147
no_sanitize: SanitizerSet::empty(),
122148
instruction_set: None,
123149
alignment: None,
150+
patchable_function_entry: None,
124151
}
125152
}
126153

There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.