Skip to content

feat: implement --emit-relocs - #2461

Draft
vishruth-thimmaiah wants to merge 4 commits into
wild-linker:mainfrom
vishruth-thimmaiah:emit_relocs
Draft

vishruth-thimmaiah wants to merge 4 commits into
wild-linker:mainfrom
vishruth-thimmaiah:emit_relocs

Conversation

@vishruth-thimmaiah

@vishruth-thimmaiah vishruth-thimmaiah commented Aug 28, 2026

Copy link
Copy Markdown
Member

Adds support for --emit-relocs. This flag is used to retain all relocations from input files, similar to a partial object.

Signed-off-by: Vishruth Thimmaiah <vishruththimmaiah@gmail.com>
Signed-off-by: Vishruth Thimmaiah <vishruththimmaiah@gmail.com>
Signed-off-by: Vishruth Thimmaiah <vishruththimmaiah@gmail.com>
Signed-off-by: Vishruth Thimmaiah <vishruththimmaiah@gmail.com>
@vishruth-thimmaiah
vishruth-thimmaiah marked this pull request as ready for review August 28, 2026 13:55

@davidlattimore davidlattimore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this get offsets correct when riscv size-reducing relaxations occur? If not, it might be reasonable to error if the flag is enabled concurrently with size-reducing relaxations - unless there's an easy way to make them work.

Comment thread libwild/src/elf.rs
let old_flags = per_symbol_flags
.get_atomic(canonical)
.fetch_or(ValueFlags::SYMTAB_INSTALLED);
if !old_flags.contains(ValueFlags::SYMTAB_INSTALLED) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this deterministic? It looks like it might not be. I wonder if it might be simpler if you just set the flag on the canonical definition and made it responsible for writing the symtab entry.

@davidlattimore

Copy link
Copy Markdown
Member

Another thought... do other linkers emit one relocation section per input section or one relocation section per output section? I'm unsure if it matters, but one per output section is likely to perform a whole lot better.

@vishruth-thimmaiah
vishruth-thimmaiah marked this pull request as draft September 6, 2026 12:04
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