@@ -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`" ;
@@ -710,6 +712,7 @@ mod parse {
710
712
true
711
713
}
712
714
715
+
713
716
pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
714
717
match v {
715
718
// OnBrokenPipe::Default can't be explicitly specified
@@ -721,6 +724,30 @@ mod parse {
721
724
true
722
725
}
723
726
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
+
724
751
pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
725
752
match v {
726
753
Some ( "panic" ) => * slot = OomStrategy :: Panic ,
@@ -1844,6 +1871,8 @@ options! {
1844
1871
"panic strategy for panics in drops" ) ,
1845
1872
parse_only: bool = ( false , parse_bool, [ UNTRACKED ] ,
1846
1873
"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" ) ,
1847
1876
plt: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1848
1877
"whether to use the PLT when calling into shared libraries;
1849
1878
only has effect for PIC code on systems with ELF binaries
0 commit comments