Skip to content

Commit

Permalink
disable auto arch detect
Browse files Browse the repository at this point in the history
  • Loading branch information
DennyDai committed Mar 3, 2024
1 parent 8376ad0 commit 34e084b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/patcherex2/targets/elf_arm_mimxrt1052.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def finalize(self):


class ElfArmMimxrt1052(ElfArmLinux):
@staticmethod
def detect_target(binary_path):
return False

def get_binfmt_tool(self, binfmt_tool):
binfmt_tool = binfmt_tool or "default"
if binfmt_tool == "default":
Expand Down
17 changes: 1 addition & 16 deletions src/patcherex2/targets/elf_leon3_bare.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,12 @@ def _init_memory_analysis(self):
unused_funcs = self.p.binary_analyzer.get_unused_funcs()

for func in unused_funcs:
file_offset = self.p.binary_analyzer.mem_addr_to_file_offset(func["addr"])
block = MappedBlock(
file_offset,
func["addr"],
func["size"],
is_free=True,
flag=MemoryFlag.RX,
)
self.p.allocation_manager.add_block(block)
self.p.allocation_manager.add_free_space(func["addr"], func["size"], "RX")


class ElfLeon3Bare(Target):
@staticmethod
def detect_target(binary_path):
with open(binary_path, "rb") as f:
magic = f.read(0x14)
# NOTE: probably should not default sparc to this target, but it's fine for now
if magic.startswith(b"\x7fELF") and magic.startswith(
b"\x00\x02", 0x12
): # EM_SPARC
return True
return False

def get_assembler(self, assembler):
Expand Down

0 comments on commit 34e084b

Please sign in to comment.