@@ -379,6 +379,8 @@ mod desc {
379379 pub const parse_passes: & str = "a space-separated list of passes, or `all`" ;
380380 pub const parse_panic_strategy: & str = "either `unwind` or `abort`" ;
381381 pub const parse_on_broken_pipe: & str = "either `kill`, `error`, or `inherit`" ;
382+ pub const parse_patchable_function_entry: & str =
383+ "nop_count,entry_offset or nop_count (defaulting entry_offset=0)" ;
382384 pub const parse_opt_panic_strategy: & str = parse_panic_strategy;
383385 pub const parse_oom_strategy: & str = "either `panic` or `abort`" ;
384386 pub const parse_relro_level: & str = "one of: `full`, `partial`, or `off`" ;
@@ -710,6 +712,7 @@ mod parse {
710712 true
711713 }
712714
715+
713716 pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
714717 match v {
715718 // OnBrokenPipe::Default can't be explicitly specified
@@ -721,6 +724,30 @@ mod parse {
721724 true
722725 }
723726
727+ pub ( crate ) fn parse_patchable_function_entry (
728+ slot : & mut PatchableFunctionEntry ,
729+ v : Option < & str > ,
730+ ) -> bool {
731+ let mut nop_count = 0 ;
732+ let mut offset = 0 ;
733+
734+ if !parse_number ( & mut nop_count, v) {
735+ let parts = v. and_then ( |v| v. split_once ( ',' ) ) . unzip ( ) ;
736+ if !parse_number ( & mut nop_count, parts. 0 ) {
737+ return false ;
738+ }
739+ if !parse_number ( & mut offset, parts. 1 ) {
740+ return false ;
741+ }
742+ }
743+
744+ if let Some ( pfe) = PatchableFunctionEntry :: from_nop_count_and_offset ( nop_count, offset) {
745+ * slot = pfe;
746+ return true ;
747+ }
748+ false
749+ }
750+
724751 pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
725752 match v {
726753 Some ( "panic" ) => * slot = OomStrategy :: Panic ,
@@ -1844,6 +1871,8 @@ options! {
18441871 "panic strategy for panics in drops" ) ,
18451872 parse_only: bool = ( false , parse_bool, [ UNTRACKED ] ,
18461873 "parse only; do not compile, assemble, or link (default: no)" ) ,
1874+ patchable_function_entry: PatchableFunctionEntry = ( PatchableFunctionEntry :: default ( ) , parse_patchable_function_entry, [ TRACKED ] ,
1875+ "nop padding at function entry" ) ,
18471876 plt: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
18481877 "whether to use the PLT when calling into shared libraries;
18491878 only has effect for PIC code on systems with ELF binaries
0 commit comments