@@ -378,7 +378,12 @@ mod desc {
378378 pub const parse_time_passes_format: & str = "`text` (default) or `json`" ;
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`" ;
381+ <<<<<<< HEAD
381382 pub const parse_on_broken_pipe: & str = "either `kill`, `error`, or `inherit`" ;
383+ =======
384+ pub const parse_patchable_function_entry: & str =
385+ "nop_count,entry_offset or nop_count (defaulting entry_offset=0)" ;
386+ >>>>>>> 7814 dd86eb5 ( Support for -Z patchable-function-entry)
382387 pub const parse_opt_panic_strategy: & str = parse_panic_strategy;
383388 pub const parse_oom_strategy: & str = "either `panic` or `abort`" ;
384389 pub const parse_relro_level: & str = "one of: `full`, `partial`, or `off`" ;
@@ -709,6 +714,7 @@ mod parse {
709714 true
710715 }
711716
717+
712718 pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
713719 match v {
714720 // OnBrokenPipe::Default can't be explicitly specified
@@ -720,6 +726,30 @@ mod parse {
720726 true
721727 }
722728
729+ pub ( crate ) fn parse_patchable_function_entry (
730+ slot : & mut PatchableFunctionEntry ,
731+ v : Option < & str > ,
732+ ) -> bool {
733+ let mut nop_count = 0 ;
734+ let mut offset = 0 ;
735+
736+ if !parse_number ( & mut nop_count, v) {
737+ let parts = v. and_then ( |v| v. split_once ( ',' ) ) . unzip ( ) ;
738+ if !parse_number ( & mut nop_count, parts. 0 ) {
739+ return false ;
740+ }
741+ if !parse_number ( & mut offset, parts. 1 ) {
742+ return false ;
743+ }
744+ }
745+
746+ if let Some ( pfe) = PatchableFunctionEntry :: from_nop_count_and_offset ( nop_count, offset) {
747+ * slot = pfe;
748+ return true ;
749+ }
750+ false
751+ }
752+
723753 pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
724754 match v {
725755 Some ( "panic" ) => * slot = OomStrategy :: Panic ,
@@ -1859,6 +1889,8 @@ options! {
18591889 "panic strategy for panics in drops" ) ,
18601890 parse_only: bool = ( false , parse_bool, [ UNTRACKED ] ,
18611891 "parse only; do not compile, assemble, or link (default: no)" ) ,
1892+ patchable_function_entry: PatchableFunctionEntry = ( PatchableFunctionEntry :: default ( ) , parse_patchable_function_entry, [ TRACKED ] ,
1893+ "nop padding at function entry" ) ,
18621894 plt: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
18631895 "whether to use the PLT when calling into shared libraries;
18641896 only has effect for PIC code on systems with ELF binaries
0 commit comments