CLI: refactor(isla): rewrite assembler as ELF pipeline with linksem#101
Open
CLI: refactor(isla): rewrite assembler as ELF pipeline with linksem#101
Conversation
cb2163b to
a4869ad
Compare
c07e534 to
8a3cecd
Compare
a4869ad to
d3b7fd0
Compare
8ac5cbf to
eb03070
Compare
tperami
requested changes
May 6, 2026
Collaborator
tperami
left a comment
There was a problem hiding this comment.
Some nit-picks and the allocation of symbols can be simplified to avoid conflicts
|
|
||
| (** Compute (section_name, address) pairs for all sections. *) | ||
| let compute_section_layout (input : assembly_input) : (string * int) list = | ||
| let base = base_addr () in |
Collaborator
There was a problem hiding this comment.
My recommendation would be to not have that in the config, and just start at the next page after fixed sections, or in first non-zero page otherwise e.g., 0x1000 for page_bits = 12
eb03070 to
592370a
Compare
CLI: refactor(assembler): expose full ELF symbol table in assembly_result Replace linked_symbol with direct data + symbols fields. symbols now contains the full ELF symbol table for uniform address lookup (data symbols, code labels, sections).
592370a to
9277e33
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.
Summary
Replace the old assembler pipeline (
echo | llvm-mc → .o, objcopy → .bin) with a structured ELF pipeline:.s + .ld generation → clang+lld → linksem ELF parsingThe old pipeline returned raw bytes only, losing all address information. The new pipeline returns both machine code bytes and linker-assigned addresses via
assembly_input → assembly_resulttypes.Notes
Single clang invocation instead of separate llvm-mc + ld.lld: clang handles assemble + link in one step, reducing temp files and config keys (assemble + extract → single command).
Linksem for ELF parsing instead of objcopy: We need symbol addresses and section addresses, not just raw bytes. Linksem gives us the full ELF structure as OCaml types.
Delete symbols.ml: the manual bump allocator is replaced by real linker address resolution. One page per symbol so each gets independent page-table attributes.
Relocatable vs fixed-addr sections: relocatable sections share .text (linker places them), fixed-addr sections get their own named ELF sections at specified addresses (for exception handlers etc).