[docs]defload_relocations():forfilenameinos.listdir(path):ifnotfilename.endswith(".py"):continueiffilename=="__init__.py":continuelog.debug("Importing PE relocation module: %s",filename[:-3])module=importlib.import_module(".%s"%filename[:-3],"cle.backends.pe.relocation")try:arch_name=module.archexceptAttributeError:continueforitem_nameindir(module):ifitem_namenotinarchinfo.defines:continueitem=getattr(module,item_name)ifnotisinstance(item,type)ornotissubclass(item,Relocation):continueALL_RELOCATIONS[arch_name][archinfo.defines[item_name]]=item
[docs]defget_relocation(arch,r_type):ifr_type==0:returnNonetry:returnALL_RELOCATIONS[arch][r_type]exceptKeyError:if(arch,r_type)notincomplaint_log:complaint_log.add((arch,r_type))log.warning("Unknown reloc %d on %s",r_type,arch)returnNone