Skip to content

Seed r2 for ppc32 small-data so pdg resolves sdata globals ##ppc#251

Open
phix33 wants to merge 1 commit into
radareorg:masterfrom
phix33:ppc32-sda-seed-gate
Open

Seed r2 for ppc32 small-data so pdg resolves sdata globals ##ppc#251
phix33 wants to merge 1 commit into
radareorg:masterfrom
phix33:ppc32-sda-seed-gate

Conversation

@phix33

@phix33 phix33 commented Jun 22, 2026

Copy link
Copy Markdown

Checklist

  • Closing issues: #issue
  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some documentation

Description

Extends the global-pointer seed in seedGlobalPointerRegister from ppc64-only to ppc32 BE, so pdg resolves r2-relative small-data loads to named globals instead of *(unaff_r2 + offset). Mirrors the radare2-side anal.gp autoresolve (radare2 01b34f32f5); r2 holds the TOC base on ppc64 and the small-data base on ppc32.

Adds two r2r tests (seeded resolves, unseeded bails) and a 564-byte ppc32 BE test binary.

Comment thread src/core_ghidra.cpp
regname = r_reg_alias_getname (core->anal->reg, R_REG_ALIAS_GP);
if (!regname && r_str_startswith (acfg->arch, "ppc")
&& acfg->bits == 64 && R_ARCH_CONFIG_IS_BIG_ENDIAN (acfg)) {
&& (acfg->bits == 32 || acfg->bits == 64)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about dropping the bits check here? Is endian actually important for anything here? I mean theres no need to see if its ppc32 or ppc64 when there’s no ppc16 or ppc8. And i think this check also applies to little endian ppcs, right?

Comment thread src/core_ghidra.cpp
if (!regname && r_str_startswith (acfg->arch, "ppc")
&& acfg->bits == 64 && R_ARCH_CONFIG_IS_BIG_ENDIAN (acfg)) {
&& (acfg->bits == 32 || acfg->bits == 64)
&& R_ARCH_CONFIG_IS_BIG_ENDIAN (acfg)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endian check can go away too

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.

2 participants