@@ -378,7 +378,12 @@ mod desc {
378
378
pub const parse_time_passes_format: & str = "`text` (default) or `json`" ;
379
379
pub const parse_passes: & str = "a space-separated list of passes, or `all`" ;
380
380
pub const parse_panic_strategy: & str = "either `unwind` or `abort`" ;
381
+ <<<<<<< HEAD
381
382
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)
382
387
pub const parse_opt_panic_strategy: & str = parse_panic_strategy;
383
388
pub const parse_oom_strategy: & str = "either `panic` or `abort`" ;
384
389
pub const parse_relro_level: & str = "one of: `full`, `partial`, or `off`" ;
@@ -709,6 +714,7 @@ mod parse {
709
714
true
710
715
}
711
716
717
+
712
718
pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
713
719
match v {
714
720
// OnBrokenPipe::Default can't be explicitly specified
@@ -720,6 +726,30 @@ mod parse {
720
726
true
721
727
}
722
728
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
+
723
753
pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
724
754
match v {
725
755
Some ( "panic" ) => * slot = OomStrategy :: Panic ,
@@ -1859,6 +1889,8 @@ options! {
1859
1889
"panic strategy for panics in drops" ) ,
1860
1890
parse_only: bool = ( false , parse_bool, [ UNTRACKED ] ,
1861
1891
"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" ) ,
1862
1894
plt: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1863
1895
"whether to use the PLT when calling into shared libraries;
1864
1896
only has effect for PIC code on systems with ELF binaries
0 commit comments