Skip to content

Decompiler: avoid passing Sleigh IDs to BFD#3

Open
0xeb wants to merge 2 commits into
masterfrom
eb/bfd-sleigh-target-autodetect
Open

Decompiler: avoid passing Sleigh IDs to BFD#3
0xeb wants to merge 2 commits into
masterfrom
eb/bfd-sleigh-target-autodetect

Conversation

@0xeb
Copy link
Copy Markdown
Collaborator

@0xeb 0xeb commented May 3, 2026

Summary:

  • Treat an empty LoadImageBfd target as no explicit BFD target, passing NULL to bfd_openr().
  • When BfdArchitecture receives an explicit Sleigh language id, avoid forwarding it to BFD as an object target name.
  • Let BFD auto-detect the object format from the file header while resolveArchitecture() preserves the explicit Sleigh id.

Why:
resolveArchitecture() already treats colon-containing targets as Sleigh language ids. However, buildLoader() passed the same string through LoadImageBfd to bfd_openr(), where it is interpreted as a BFD target name. Values such as AARCH64:LE:64:v8A:default are valid Ghidra language ids, not BFD target names.

BFD distinguishes a NULL/default target from a literal empty target string. Passing NULL lets bfd_check_format() probe the supported object formats.

Testing:

  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant