Warn instead of aborting when no function covers the ELF entry point - #207
Open
Sinan-Karakaya wants to merge 1 commit into
Open
Warn instead of aborting when no function covers the ELF entry point#207Sinan-Karakaya wants to merge 1 commit into
Sinan-Karakaya wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts function-table generation to tolerate ELFs whose e_entry points into non-code data (e.g., crt0 tables), avoiding late-stage aborts that leave partially generated output.
Changes:
- Replace a hard failure when the ELF entry point cannot be resolved to a function name with a warning and continued emission.
- Skip registering the entry point in the function table when no function covers it, preserving generation of other outputs.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| std::ostringstream oss; | ||
| oss << "No function covers the ELF entry point; skipping its table registration. " | ||
| << "Set the entry explicitly if the runtime should start here."; | ||
| cg.m_reporter->warning("function-table", oss.str()); |
Not every toolchain points e_entry at an instruction. Metrowerks CodeWarrior for PS2 emits a crt0 data table there -- scratchpad addresses and size words -- with the first real instruction some way past it, so no function covers the entry address and neither entryName nor getFunctionName() resolves. The emitter threw in that case, which aborted the run after every per-function source had already been written but before register_functions.cpp, ps2_recompiled_functions.h and ps2_recompiled_stubs.h were generated, leaving an output directory that looks complete and is not. Skip the entry registration with a warning instead. Synthesizing a name would emit a table reference to a definition that was never generated and fail at link time, and the start address for such a binary has to come from configuration regardless.
Sinan-Karakaya
force-pushed
the
fix/entry-point-no-abort
branch
from
August 17, 2026 16:47
dc45fd3 to
340befc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not every toolchain points
e_entryat an instruction. Metrowerks CodeWarrior for PS2 emits a crt0 data table there — scratchpad addresses and size words — with the first real instruction some way past it. No function covers the entry address, so neitherentryNamenorgetFunctionName()resolves andFunctionTableEmitter::emitthrows:That happens after every per-function source has already been written, but before
register_functions.cpp,ps2_recompiled_functions.handps2_recompiled_stubs.hare generated — leaving an output directory that looks complete and is not.This skips the entry registration with a warning instead of aborting.
I considered synthesizing a name (
entry_%08X) but that emits a function-table reference to a definition that was never generated, which then fails at link time. For a binary shaped like this the start address has to come from configuration regardless, so recording the situation and continuing seemed the more useful behaviour.Concretely, on Dragon Quest VIII (NTSC-U) the header entry is
0x00100008, which is 33 words of crt0 data; the first instruction is at0x0010008C. The run now completes and reports: