port(Macho): copy __text section from input, introduce more output commands#1810
Merged
marxin merged 12 commits intowild-linker:mainfrom Apr 6, 2026
Merged
port(Macho): copy __text section from input, introduce more output commands#1810marxin merged 12 commits intowild-linker:mainfrom
marxin merged 12 commits intowild-linker:mainfrom
Conversation
) wild-linker@f704b10 stopped processing debug relocations during layout to fix GC. As a side effect, local symbols referenced only from debug sections no longer get merged resolutions on RISC-V/LoongArch64, causing the section resolution fallback in `get_resolution()` to be reached for the first time on these architectures. This fallback only returned the section base address, which was sufficient for x86-64/AArch64 where debug relocations reference section symbols (value=0). On RISC-V/LoongArch64, the referenced local symbols have non-zero values, so the missing offset caused paired relocations like `R_RISCV_SET_ULEB128` / `R_RISCV_SUB_ULEB128` to compute incorrect differences, producing wrong values or overflowing the ULEB128 buffer. Include `sym.value()` adjusted for relaxation deltas in the fallback, matching [the fix already applied in `apply_debug_relocation()`](https://github.com/wild-linker/wild/blob/8708f550d3f57edd047709eb94cf21b552a69a6c/libwild/src/elf_writer.rs#L3020-L3038). fix wild-linker#1796
davidlattimore
approved these changes
Apr 5, 2026
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.
Another implementation step where I properly filled up the section flags (R,W,X) and the
__textand__datasections are properly copied from the input. By given that, I can dump the assembly of the final binary:Next, I will focus on the mandatory commands that will eventually allow running a binary.
Issue #757