(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:obj) op:Equal rhs:{($ VSub_Number '$1')})] ) (command.AndOr ops: [Op_DPipe] children: [ (command.Pipeline children: [(C {(file)} {(${ VSub_Name obj)}) (C {(grep)} {(-q)} {(ELF)})] negated: F ) (command.Subshell command_list: (command.CommandList children: [ (command.Sentence child: (command.SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name obj) (' is not and ELF file.'))}] redirects: [(redir.Redir op:<Redir_GreatAnd '1>&'> fd:1 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] ) ) ] ) (command.SimpleCommand words: [{(objdump)} {(-hj)} {(__ex_table)} {(${ VSub_Name obj)}] redirects: [ (redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)}) (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-ne)} {(0)} {(Lit_Other ']')}) (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:white_list) op: Equal rhs: {(.text) (Lit_Comma ',') (.fixup)} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:suspicious_relocs) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(objdump)} {(-rj)} {(__ex_table)} {(${ VSub_Name obj)}) (C {(tail)} {(-n)} {(Lit_Other '+') (6)}) (C {(grep)} {(-v)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(eval)} {(echo)} {(-e) (Lit_LBrace '{') (${ VSub_Name white_list) (Lit_RBrace '}') } ) ] ) left_token: <Left_CommandSub '$('> ) } ) (C {(awk)} {(SQ <'{print $3}'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name suspicious_relocs))} {(Lit_Other ']')}) (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] ) (command.FuncDef name: find_section_offset_from_symbol body: (command.BraceGroup children: [ (C {(eval)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(objdump)} {(-t)} {(${ VSub_Name obj)}) (C {(grep)} {(${ VSub_Number 1)}) (C {(sed)} { (SQ < 's/\\([0-9a-f]\\+\\) .\\{7\\} \\([^ \\t]\\+\\).*/section="\\2"; section_offset="0x\\1" /' > ) } ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:section_offset) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(printf)} {(DQ ('0x%016x'))} { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(${ VSub_Name section_offset)}) right: (arith_expr.ArithWord w:{($ VSub_Number '$2')}) ) ) } ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) ) (command.FuncDef name: find_symbol_and_offset_from_reloc body: (command.BraceGroup children: [ (C {(eval)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ VSub_DollarName '$reloc')}) (C {(sed)} { (SQ < 's/\\([^+]\\+\\)+\\?\\(0x[0-9a-f]\\+\\)\\?/symbol="\\1"; symbol_offset="\\2"/' > ) } ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name symbol_offset))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:symbol_offset) op: Equal rhs: {(0x0)} ) ] ) ] ) ] ) ] ) ) (command.FuncDef name: find_alt_replacement_target body: (command.BraceGroup children: [ (C {(eval)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(objdump)} {(-rj)} {(.altinstructions)} {(${ VSub_Name obj)}) (C {(grep)} {(-B1)} {(DQ (${ VSub_Name section) ('+') (${ VSub_Name section_offset))} ) (C {(head)} {(-n1)}) (C {(awk)} {(SQ <'{print $3}'>)}) (C {(sed)} { (SQ < 's/\\([^+]\\+\\)+\\(0x[0-9a-f]\\+\\)/alt_target_section="\\1"; alt_target_offset="\\2"/' > ) } ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ) (command.FuncDef name: handle_alt_replacement_reloc body: (command.BraceGroup children: [ (C {(find_alt_replacement_target)} {(${ VSub_Name section)} {(${ VSub_Name section_offset)}) (C {(echo)} {(DQ ('Error: found a reference to .altinstr_replacement in __ex_table:'))}) (command.Pipeline children: [ (C {(addr2line)} {(-fip)} {(-j)} {(${ VSub_Name alt_target_section)} {(-e)} {(${ VSub_Name obj)} {(${ VSub_Name alt_target_offset)} ) (C {(awk)} {(SQ <'{print "\\t" $0}'>)}) ] negated: F ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:error) op:Equal rhs:{(true)})] ) ] ) ) (command.FuncDef name: is_executable_section body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {(objdump)} {(-hwj)} {(${ VSub_Name section)} {(${ VSub_Name obj)}) (C {(grep)} {(-q)} {(CODE)}) ] negated: F ) (command.ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) ) (command.FuncDef name: handle_suspicious_generic_reloc body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(is_executable_section)} {(${ VSub_Name section)}) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} { (DQ ('Warning: found a reference to section ') (word_part.EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) (${ VSub_Name section) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' in __ex_table:') ) } ) (command.Pipeline children: [ (C {(addr2line)} {(-fip)} {(-j)} {(${ VSub_Name section)} {(-e)} {(${ VSub_Name obj)} {(${ VSub_Name section_offset)} ) (C {(awk)} {(SQ <'{print "\\t" $0}'>)}) ] negated: F ) ] ) ] else_action: [ (C {(echo)} { (DQ ('Error: found a reference to non-executable section ') (word_part.EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) (${ VSub_Name section) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' in __ex_table at offset ') (${ VSub_Name section_offset) ) } ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:error) op:Equal rhs:{(true)})] ) ] ) ] ) ) (command.FuncDef name: handle_suspicious_reloc body: (command.BraceGroup children: [ (command.Case to_match: {(DQ (${ VSub_Name section))} arms: [ (case_arm pat_list: [{(DQ (.altinstr_replacement))}] action: [ (C {(handle_alt_replacement_reloc)} {(${ VSub_Name section)} {(${ VSub_Name section_offset)} ) ] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (C {(handle_suspicious_generic_reloc)} {(${ VSub_Name section)} {(${ VSub_Name section_offset)} ) ] ) ] ) ] ) ) (command.FuncDef name: diagnose body: (command.BraceGroup children: [ (command.ForEach iter_name: reloc iter_words: [{(${ VSub_Name suspicious_relocs)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(find_symbol_and_offset_from_reloc)} {(${ VSub_Name reloc)}) (C {(find_section_offset_from_symbol)} {(${ VSub_Name symbol)} {(${ VSub_Name symbol_offset)} ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Lit_Other '[')} {(-z)} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ VSub_DollarName '$section')}) (C {(grep)} {(-v)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(eval)} {(echo)} {(-e) (Lit_LBrace '{') (${ VSub_Name white_list) (Lit_RBrace '}') } ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) ) } {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (command.Sentence child: (command.ControlFlow token:<ControlFlow_Continue continue>) terminator: <Op_Semi ';'> ) ] ) ] ) (C {(handle_suspicious_reloc)}) ] ) ) ] ) ) (command.FuncDef name: check_debug_info body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DPipe] children: [ (command.SimpleCommand words: [{(objdump)} {(-hj)} {(.debug_info)} {(${ VSub_Name obj)}] redirects: [ (redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)}) (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) (C {(echo)} {(-e)} { (DQ (${ VSub_Name obj) (' does not contain debug information, the addr2line output will be limited.') (Lit_Other '\\') (n) ) } {(DQ ('Recompile ') (${ 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 {(Lit_Other '[')} {(DQ (${ VSub_Name error))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})] ) ] ) (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] )