@@ -43,6 +43,9 @@ pub struct Args {
43
43
#[ argp( option, short = 'u' ) ]
44
44
/// Unit name within project
45
45
unit : Option < String > ,
46
+ #[ argp( switch, short = 'x' ) ]
47
+ /// Relax relocation diffs
48
+ relax_reloc_diffs : bool ,
46
49
#[ argp( positional) ]
47
50
/// Function symbol to diff
48
51
symbol : String ,
@@ -144,6 +147,7 @@ pub fn run(args: Args) -> Result<()> {
144
147
. context ( "Failed to parse time format" ) ?;
145
148
let mut state = Box :: new ( FunctionDiffUi {
146
149
redraw : true ,
150
+ relax_reloc_diffs : args. relax_reloc_diffs ,
147
151
click_xy : None ,
148
152
left_highlight : HighlightKind :: None ,
149
153
right_highlight : HighlightKind :: None ,
@@ -216,6 +220,7 @@ fn find_function(obj: &ObjInfo, name: &str) -> Option<ObjSymbol> {
216
220
#[ allow( dead_code) ]
217
221
struct FunctionDiffUi {
218
222
redraw : bool ,
223
+ relax_reloc_diffs : bool ,
219
224
click_xy : Option < ( u16 , u16 ) > ,
220
225
left_highlight : HighlightKind ,
221
226
right_highlight : HighlightKind ,
@@ -472,6 +477,12 @@ impl FunctionDiffUi {
472
477
self . scroll_x = self . scroll_x . saturating_sub ( 1 ) ;
473
478
self . redraw = true ;
474
479
}
480
+ // Toggle relax relocation diffs
481
+ KeyCode :: Char ( 'x' ) => {
482
+ self . relax_reloc_diffs = !self . relax_reloc_diffs ;
483
+ self . redraw = true ;
484
+ return FunctionDiffResult :: Reload ;
485
+ }
475
486
_ => { }
476
487
}
477
488
}
@@ -630,7 +641,7 @@ impl FunctionDiffUi {
630
641
. as_deref ( )
631
642
. map ( |p| obj:: elf:: read ( p) . with_context ( || format ! ( "Loading {}" , p. display( ) ) ) )
632
643
. transpose ( ) ?;
633
- let config = diff:: DiffObjConfig :: default ( ) ;
644
+ let config = diff:: DiffObjConfig { relax_reloc_diffs : self . relax_reloc_diffs } ;
634
645
diff:: diff_objs ( & config, target. as_mut ( ) , base. as_mut ( ) ) ?;
635
646
636
647
let left_sym = target. as_ref ( ) . and_then ( |o| find_function ( o, & self . symbol_name ) ) ;
0 commit comments