(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:obj) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [7] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Pipeline children: [(C {(file)} {(${ Id.VSub_Name obj)}) (C {(grep)} {(-q)} {(ELF)})] negated: F ) (command.Subshell command_list: (command.CommandList children: [ (command.Sentence child: (command.Simple words: [{(echo)} {(DQ (${ Id.VSub_Name obj) (' is not and ELF file.'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'1>&' span_id:37) fd: 1 arg_word: {(2)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:40) ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:42) arg_word: {(0)} ) ] ) ) ] ) (command.Simple words: [{(objdump)} {(-hj)} {(__ex_table)} {(${ Id.VSub_Name obj)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:61) fd: 2 arg_word: {(/dev/null)} ) (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:65) fd: -1 arg_word: {(/dev/null)} ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-ne)} {(0)} {(Id.Lit_RBracket ']')}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:81) arg_word: {(0)} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:white_list) op: assign_op.Equal rhs: {(.text) (Id.Lit_Comma ',') (.fixup)} spids: [86] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:suspicious_relocs) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:93) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(objdump)} {(-rj)} {(__ex_table)} {(${ Id.VSub_Name obj)}) (C {(tail)} {(-n)} {(Id.Lit_Other '+') (6)}) (C {(grep)} {(-v)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:120) command_list: (command.CommandList children: [ (C {(eval)} {(echo)} {(-e) (Id.Lit_LBrace '{') (${ Id.VSub_Name white_list) (Id.Lit_RBrace '}') } ) ] ) ) } ) (C {(awk)} {(SQ (Token id:Id.Lit_Chars val:'{print $3}' span_id:138))}) ] negated: F ) ] ) ) } spids: [92] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ (${ Id.VSub_Name suspicious_relocs))} {(Id.Lit_RBracket ']')} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:160) arg_word: {(0)} ) ] ) (command.ShFunction name: find_section_offset_from_symbol body: (command.BraceGroup children: [ (C {(eval)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:202) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(objdump)} {(-t)} {(${ Id.VSub_Name obj)}) (C {(grep)} {(${ Id.VSub_Number 1)}) (C {(sed)} { (SQ (Token id: Id.Lit_Chars val: 's/\\([0-9a-f]\\+\\) .\\{7\\} \\([^ \\t]\\+\\).*/section="\\2"; section_offset="0x\\1" /' span_id: 224 ) ) } ) ] negated: F ) ] ) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:section_offset) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:235) command_list: (command.CommandList children: [ (C {(printf)} {(DQ ('0x%016x'))} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w: {(${ Id.VSub_Name section_offset)} ) right: (arith_expr.ArithWord w:{($ Id.VSub_Number '$2')}) ) ) } ) ] ) ) } spids: [234] ) ] ) ] ) ) (command.ShFunction name: find_symbol_and_offset_from_reloc body: (command.BraceGroup children: [ (C {(eval)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:275) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$reloc')}) (C {(sed)} { (SQ (Token id: Id.Lit_Chars val: 's/\\([^+]\\+\\)+\\?\\(0x[0-9a-f]\\+\\)\\?/symbol="\\1"; symbol_offset="\\2"/' span_id: 285 ) ) } ) ] negated: F ) ] ) ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ (${ Id.VSub_Name symbol_offset))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:312) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:symbol_offset) op: assign_op.Equal rhs: {(0x0)} spids: [317] ) ] ) ] spids: [299 314] ) ] ) ] ) ) (command.ShFunction name: find_alt_replacement_target body: (command.BraceGroup children: [ (C {(eval)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:345) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(objdump)} {(-rj)} {(.altinstructions)} {(${ Id.VSub_Name obj)}) (C {(grep)} {(-B1)} {(DQ (${ Id.VSub_Name section) ('+') (${ Id.VSub_Name section_offset))} ) (C {(head)} {(-n1)}) (C {(awk)} {(SQ (Token id:Id.Lit_Chars val:'{print $3}' span_id:383))}) (C {(sed)} { (SQ (Token id: Id.Lit_Chars val: 's/\\([^+]\\+\\)+\\(0x[0-9a-f]\\+\\)/alt_target_section="\\1"; alt_target_offset="\\2"/' span_id: 392 ) ) } ) ] negated: F ) ] ) ) } ) ] ) ) (command.ShFunction name: handle_alt_replacement_reloc body: (command.BraceGroup children: [ (C {(find_alt_replacement_target)} {(${ Id.VSub_Name section)} {(${ Id.VSub_Name section_offset)} ) (C {(echo)} {(DQ ('Error: found a reference to .altinstr_replacement in __ex_table:'))}) (command.Pipeline children: [ (C {(addr2line)} {(-fip)} {(-j)} {(${ Id.VSub_Name alt_target_section)} {(-e)} {(${ Id.VSub_Name obj)} {(${ Id.VSub_Name alt_target_offset)} ) (C {(awk)} {(SQ (Token id:Id.Lit_Chars val:'{print "\\t" $0}' span_id:456))}) ] negated: F ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:error) op: assign_op.Equal rhs: {(true)} spids: [461] ) ] ) ] ) ) (command.ShFunction name: is_executable_section body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {(objdump)} {(-hwj)} {(${ Id.VSub_Name section)} {(${ Id.VSub_Name obj)}) (C {(grep)} {(-q)} {(CODE)}) ] negated: F ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:497) arg_word: {($ Id.VSub_QMark '$?')} ) ] ) ) (command.ShFunction name: handle_suspicious_generic_reloc body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(is_executable_section)} {(${ Id.VSub_Name section)}) terminator: (Token id:Id.Op_Semi val:';' span_id:520) ) ] action: [ (C {(echo)} { (DQ ('Warning: found a reference to section ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:545) ) (${ Id.VSub_Name section) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:549) ) (' in __ex_table:') ) } ) (command.Pipeline children: [ (C {(addr2line)} {(-fip)} {(-j)} {(${ Id.VSub_Name section)} {(-e)} {(${ Id.VSub_Name obj)} {(${ Id.VSub_Name section_offset)} ) (C {(awk)} {(SQ (Token id:Id.Lit_Chars val:'{print "\\t" $0}' span_id:579))}) ] negated: F ) ] spids: [513 522] ) ] else_action: [ (C {(echo)} { (DQ ('Error: found a reference to non-executable section ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:602) ) (${ Id.VSub_Name section) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:606) ) (' in __ex_table at offset ') (${ Id.VSub_Name section_offset) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:error) op: assign_op.Equal rhs: {(true)} spids: [614] ) ] ) ] ) ] ) ) (command.ShFunction name: handle_suspicious_reloc body: (command.BraceGroup children: [ (command.Case to_match: {(DQ (${ Id.VSub_Name section))} arms: [ (case_arm pat_list: [{(DQ (.altinstr_replacement))}] action: [ (C {(handle_alt_replacement_reloc)} {(${ Id.VSub_Name section)} {(${ Id.VSub_Name section_offset)} ) ] spids: [643 646 660 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(handle_suspicious_generic_reloc)} {(${ Id.VSub_Name section)} {(${ Id.VSub_Name section_offset)} ) ] spids: [663 664 678 -1] ) ] ) ] ) ) (command.ShFunction name: diagnose body: (command.BraceGroup children: [ (command.ForEach iter_name: reloc iter_words: [{(${ Id.VSub_Name suspicious_relocs)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(find_symbol_and_offset_from_reloc)} {(${ Id.VSub_Name reloc)}) (C {(find_section_offset_from_symbol)} {(${ Id.VSub_Name symbol)} {(${ Id.VSub_Name symbol_offset)} ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-z)} { (DQ (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 773 ) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$section')}) (C {(grep)} {(-v)} { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 785 ) command_list: (command.CommandList children: [ (C {(eval)} {(echo)} {(-e) (Id.Lit_LBrace '{') (${ Id.VSub_Name white_list) (Id.Lit_RBrace '}') } ) ] ) ) } ) ] negated: F ) ] ) ) ) } {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:801) ) ] action: [ (command.Sentence child: (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:806) ) terminator: (Token id:Id.Op_Semi val:';' span_id:807) ) ] spids: [766 803] ) ] ) (C {(handle_suspicious_reloc)}) ] ) ) ] ) ) (command.ShFunction name: check_debug_info body: (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(objdump)} {(-hj)} {(.debug_info)} {(${ Id.VSub_Name obj)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:849) fd: 2 arg_word: {(/dev/null)} ) (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:853) fd: -1 arg_word: {(/dev/null)} ) ] ) (C {(echo)} {(-e)} { (DQ (${ Id.VSub_Name obj) (' does not contain debug information, the addr2line output will be limited.') (Id.Lit_Other '\\') (n) ) } {(DQ ('Recompile ') (${ Id.VSub_Name obj) (' with CONFIG_DEBUG_INFO to get a more useful output.'))} ) ] ) ] ) ) (C {(check_debug_info)}) (C {(diagnose)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ (${ Id.VSub_Name error))} {(Id.Lit_RBracket ']')}) terminator: (Token id:Id.Op_Semi val:';' span_id:903) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:908) arg_word: {(1)} ) ] spids: [892 905] ) ] ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:915) arg_word:{(0)}) ] )