@@ -379,6 +379,8 @@ mod desc {
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
381
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)" ;
382
384
pub const parse_opt_panic_strategy: & str = parse_panic_strategy;
383
385
pub const parse_oom_strategy: & str = "either `panic` or `abort`" ;
384
386
pub const parse_relro_level: & str = "one of: `full`, `partial`, or `off`" ;
@@ -709,6 +711,7 @@ mod parse {
709
711
true
710
712
}
711
713
714
+
712
715
pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
713
716
match v {
714
717
// OnBrokenPipe::Default can't be explicitly specified
@@ -720,6 +723,30 @@ mod parse {
720
723
true
721
724
}
722
725
726
+ pub ( crate ) fn parse_patchable_function_entry (
727
+ slot : & mut PatchableFunctionEntry ,
728
+ v : Option < & str > ,
729
+ ) -> bool {
730
+ let mut nop_count = 0 ;
731
+ let mut offset = 0 ;
732
+
733
+ if !parse_number ( & mut nop_count, v) {
734
+ let parts = v. and_then ( |v| v. split_once ( ',' ) ) . unzip ( ) ;
735
+ if !parse_number ( & mut nop_count, parts. 0 ) {
736
+ return false ;
737
+ }
738
+ if !parse_number ( & mut offset, parts. 1 ) {
739
+ return false ;
740
+ }
741
+ }
742
+
743
+ if let Some ( pfe) = PatchableFunctionEntry :: from_nop_count_and_offset ( nop_count, offset) {
744
+ * slot = pfe;
745
+ return true ;
746
+ }
747
+ false
748
+ }
749
+
723
750
pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
724
751
match v {
725
752
Some ( "panic" ) => * slot = OomStrategy :: Panic ,
@@ -1859,6 +1886,8 @@ options! {
1859
1886
"panic strategy for panics in drops" ) ,
1860
1887
parse_only: bool = ( false , parse_bool, [ UNTRACKED ] ,
1861
1888
"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" ) ,
1862
1891
plt: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1863
1892
"whether to use the PLT when calling into shared libraries;
1864
1893
only has effect for PIC code on systems with ELF binaries
0 commit comments