Support for -Z patchable-function-entry
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
This commit is contained in:
committed by
Florian Schmiderer
parent
d929a42a66
commit
ac7595fdb1
@@ -2963,7 +2963,7 @@ pub(crate) mod dep_tracking {
|
||||
CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FunctionReturn,
|
||||
InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
|
||||
LtoCli, NextSolverConfig, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes,
|
||||
Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm,
|
||||
PatchableFunctionEntry, Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm,
|
||||
SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
|
||||
};
|
||||
use crate::lint;
|
||||
@@ -3071,6 +3071,7 @@ pub(crate) mod dep_tracking {
|
||||
OomStrategy,
|
||||
LanguageIdentifier,
|
||||
NextSolverConfig,
|
||||
PatchableFunctionEntry,
|
||||
Polonius,
|
||||
InliningThreshold,
|
||||
FunctionReturn,
|
||||
@@ -3248,6 +3249,32 @@ impl DumpMonoStatsFormat {
|
||||
}
|
||||
}
|
||||
|
||||
/// `-Z patchable-function-entry` representation - how many nops to put before and after function
|
||||
/// entry.
|
||||
#[derive(Clone, Copy, PartialEq, Hash, Debug, Default)]
|
||||
pub struct PatchableFunctionEntry {
|
||||
/// Nops before the entry
|
||||
prefix: u8,
|
||||
/// Nops after the entry
|
||||
entry: u8,
|
||||
}
|
||||
|
||||
impl PatchableFunctionEntry {
|
||||
pub fn from_nop_count_and_offset(nop_count: u8, offset: u8) -> Option<PatchableFunctionEntry> {
|
||||
if nop_count < offset {
|
||||
None
|
||||
} else {
|
||||
Some(Self { prefix: offset, entry: nop_count - offset })
|
||||
}
|
||||
}
|
||||
pub fn prefix(&self) -> u8 {
|
||||
self.prefix
|
||||
}
|
||||
pub fn entry(&self) -> u8 {
|
||||
self.entry
|
||||
}
|
||||
}
|
||||
|
||||
/// `-Zpolonius` values, enabling the borrow checker polonius analysis, and which version: legacy,
|
||||
/// or future prototype.
|
||||
#[derive(Clone, Copy, PartialEq, Hash, Debug, Default)]
|
||||
|
||||
Reference in New Issue
Block a user