@@ -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`" ;
@@ -723,6 +725,7 @@ mod parse {
723725 true
724726 }
725727
728+
726729 pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
727730 match v {
728731 // OnBrokenPipe::Default can't be explicitly specified
@@ -734,6 +737,30 @@ mod parse {
734737 true
735738 }
736739
740+ pub ( crate ) fn parse_patchable_function_entry (
741+ slot : & mut PatchableFunctionEntry ,
742+ v : Option < & str > ,
743+ ) -> bool {
744+ let mut nop_count = 0 ;
745+ let mut offset = 0 ;
746+
747+ if !parse_number ( & mut nop_count, v) {
748+ let parts = v. and_then ( |v| v. split_once ( ',' ) ) . unzip ( ) ;
749+ if !parse_number ( & mut nop_count, parts. 0 ) {
750+ return false ;
751+ }
752+ if !parse_number ( & mut offset, parts. 1 ) {
753+ return false ;
754+ }
755+ }
756+
757+ if let Some ( pfe) = PatchableFunctionEntry :: from_nop_count_and_offset ( nop_count, offset) {
758+ * slot = pfe;
759+ return true ;
760+ }
761+ false
762+ }
763+
737764 pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
738765 match v {
739766 Some ( "panic" ) => * slot = OomStrategy :: Panic ,
@@ -1859,6 +1886,8 @@ options! {
18591886 "panic strategy for panics in drops" ) ,
18601887 parse_only: bool = ( false , parse_bool, [ UNTRACKED ] ,
18611888 "parse only; do not compile, assemble, or link (default: no)" ) ,
1889+ patchable_function_entry: PatchableFunctionEntry = ( PatchableFunctionEntry :: default ( ) , parse_patchable_function_entry, [ TRACKED ] ,
1890+ "nop padding at function entry" ) ,
18621891 plt: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
18631892 "whether to use the PLT when calling into shared libraries;
18641893 only has effect for PIC code on systems with ELF binaries
0 commit comments