@@ -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`" ;
@@ -723,6 +725,7 @@ mod parse {
723
725
true
724
726
}
725
727
728
+
726
729
pub ( crate ) fn parse_on_broken_pipe ( slot : & mut OnBrokenPipe , v : Option < & str > ) -> bool {
727
730
match v {
728
731
// OnBrokenPipe::Default can't be explicitly specified
@@ -734,6 +737,30 @@ mod parse {
734
737
true
735
738
}
736
739
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
+
737
764
pub ( crate ) fn parse_oom_strategy ( slot : & mut OomStrategy , v : Option < & str > ) -> bool {
738
765
match v {
739
766
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