File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -463,7 +463,8 @@ def get_symbol(elffile, name):
463463 rev_reloc_symbols = {}
464464
465465 # dump_mem("XX Original code at 15a1 = ", ql.mem.read(0x15a1, 8))
466- for section in elffile .iter_sections ():
466+ _sections = list (elffile .iter_sections ())
467+ for section in _sections :
467468 # only care about reloc section
468469 if not isinstance (section , RelocationSection ):
469470 continue
@@ -472,9 +473,15 @@ def get_symbol(elffile, name):
472473 if section .name == ".rela.gnu.linkonce.this_module" :
473474 continue
474475
476+ dest_sec_idx = section .header .get ('sh_info' , None )
477+ if dest_sec_idx is not None and dest_sec_idx < len (_sections ):
478+ dest_sec = _sections [dest_sec_idx ]
479+ if dest_sec .header ['sh_flags' ] & 2 == 0 :
480+ # The target section is not loaded into memory, so just continue
481+ continue
482+
475483 # The symbol table section pointed to in sh_link
476484 symtable = elffile .get_section (section ['sh_link' ])
477-
478485 for rel in section .iter_relocations ():
479486 if rel ['r_info_sym' ] == 0 :
480487 continue
You can’t perform that action at this time.
0 commit comments