From a2cf62c682b561302869af3488c51b2bdd2a3cf1 Mon Sep 17 00:00:00 2001 From: Florian Schmiderer Date: Fri, 10 May 2024 17:30:08 +0200 Subject: [PATCH] renamded to hotpatch --- compiler/rustc_codegen_llvm/src/attributes.rs | 2 +- compiler/rustc_codegen_llvm/src/back/write.rs | 2 +- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_session/src/options.rs | 8 ++++---- tests/codegen/{ms-hotpatch.rs => hotpatch.rs} | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename tests/codegen/{ms-hotpatch.rs => hotpatch.rs} (87%) diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 6ffbb7459e5ed..fb6004167fc1d 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -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", diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 0511e5161e66c..4b1b87a825bd3 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -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(); diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 01028f39513a2..a7ed33210a089 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -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)); @@ -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, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index b976382b66614..a4d72086f4c1e 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -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], @@ -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 = (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 = (None, parse_next_solver_config, [TRACKED], diff --git a/tests/codegen/ms-hotpatch.rs b/tests/codegen/hotpatch.rs similarity index 87% rename from tests/codegen/ms-hotpatch.rs rename to tests/codegen/hotpatch.rs index 121611239570a..91d6ac8759d67 100644 --- a/tests/codegen/ms-hotpatch.rs +++ b/tests/codegen/hotpatch.rs @@ -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"]