Skip to content

fix(relinker): accept zero-sized data symbols at load boundaries - #4985

Closed
Ondra97 wants to merge 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-zero-sized-guest-symbols
Closed

Ondra97 wants to merge 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-zero-sized-guest-symbols

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What

Bundled modules with zero-sized defined data or NOTYPE symbols at a load boundary were rejected because the reader and native export writers required one byte. A fixture whose writable load ends at 0x2400 and whose data symbol denotes that address failed before producing output.

Accept these symbols as validated address points, including the load endpoint. Function symbols still require executable bytes, nonempty ranges must remain contained, and writable ranges still reject size zero before the size - 1 calculation.

The ELF symbol specification allows zero to mean no or unknown size. GNU ld's documented boundary labels assign a symbol to the end of an output section.

Tested

Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0, Python 3.14; final base main c2565f014:

Linux/Mac output was inspected on Windows; no Linux or macOS execution, full runtime build or commercial title run.

Checklist

  • Based on current main; no other open PR implements the same fix
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stub added
  • No notes, investigation Markdown files or images added to the repository
  • New third-party code is a submodule built from source: no dependency added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes (Codex)

@coltken95

Copy link
Copy Markdown

Linux validation (Ubuntu 24.04, GCC 13.3, Release), this PR's commit on main at 77b9f72:

  • guest_zero_sized_symbols, guest_module_identity and guest_export_lookup pass, so the relinked Linux output is executed here, not only inspected.
  • With main's relinker sources and this PR's tests, guest_zero_sized_symbols fails and the other two pass, so the new test catches the rejection.

AI-assisted: yes

@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Windows test: head c9a49a682 merged onto current main 5d50886ee, together with 9 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest for the tests this change adds or touches: guest_zero_sized_symbols passed, windows_guest_export_aliases passed; python tools/check_conventions.py --base upstream/main passed for the combined tree. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants