Skip to content

Commit

Permalink
renamded to hotpatch
Browse files Browse the repository at this point in the history
  • Loading branch information
nebulark committed May 10, 2024
1 parent e7d7c62 commit a2cf62c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
}

// patchable-function is only implemented on x86 on LLVM
if cx.sess().opts.unstable_opts.ms_hotpatch && cx.sess().target.is_x86() {
if cx.sess().opts.unstable_opts.hotpatch && cx.sess().target.is_x86() {
to_add.push(llvm::CreateAttrStringValue(
cx.llcx,
"patchable-function",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub fn target_machine_factory(

// this annotes in the debug file that code is hotpatchable. In addtion without it -functionpadmin will be ignored.
// See: https://github.com/llvm/llvm-project/blob/d703b922961e0d02a5effdd4bfbb23ad50a3cc9f/lld/COFF/Writer.cpp#L1298
let use_hotpatch = sess.opts.unstable_opts.ms_hotpatch && sess.target.is_x86();
let use_hotpatch = sess.opts.unstable_opts.hotpatch && sess.target.is_x86();

let path_mapping = sess.source_map().path_mapping().clone();

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(fuel, Some(("abc".to_string(), 99)));
tracked!(function_return, FunctionReturn::ThunkExtern);
tracked!(function_sections, Some(false));
tracked!(hotpatch, true);
tracked!(human_readable_cgu_names, true);
tracked!(incremental_ignore_spans, true);
tracked!(inline_in_all_cgus, Some(true));
Expand All @@ -798,7 +799,6 @@ fn test_unstable_options_tracking_hash() {
tracked!(mir_keep_place_mention, true);
tracked!(mir_opt_level, Some(4));
tracked!(move_size_limit, Some(4096));
tracked!(ms_hotpatch, true);
tracked!(mutable_noalias, false);
tracked!(
next_solver,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,10 @@ options! {
"explicitly enable the `cfg(target_thread_local)` directive"),
hir_stats: bool = (false, parse_bool, [UNTRACKED],
"print some statistics about AST and HIR (default: no)"),
hotpatch: bool = (false, parse_bool, [TRACKED],
"ensures hotpatching is always possible by ensuring that the first instruction of \
each function is at least two bytes, and no jump within the function goes to the first instruction. \
Should be combined with link-arg passing -functionpadmin to the linker. Currently only supported for x86 (default: false)"),
human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],
"generate human-readable, predictable names for codegen units (default: no)"),
identify_regions: bool = (false, parse_bool, [UNTRACKED],
Expand Down Expand Up @@ -1813,10 +1817,6 @@ options! {
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED],
"the size at which the `large_assignments` lint starts to be emitted"),
ms_hotpatch: bool = (false, parse_bool, [TRACKED],
"ensures hotpatching is always possible by ensuring that the first instruction of \
each function is at least two bytes, and no jump within the function goes to the first instruction. \
Should be combined with link-arg passing -functionpadmin to the linker. Currently only supported for x86 (default: false)"),
mutable_noalias: bool = (true, parse_bool, [TRACKED],
"emit noalias metadata for mutable references (default: yes)"),
next_solver: Option<NextSolverConfig> = (None, parse_next_solver_config, [TRACKED],
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/ms-hotpatch.rs → tests/codegen/hotpatch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ revisions: x32 x64
//@[x32] only-x86
//@[x64] only-x86_64
//@ compile-flags: -Z ms-hotpatch
//@ compile-flags: -Z hotpatch

#![crate_type = "lib"]

Expand Down

0 comments on commit a2cf62c

Please sign in to comment.