Repository navigation
aura-raw.ld: fit the SPTM_VIRT ESP Stage 2 below _file_limit again - #252
Merged
Merged
Conversation
Since #70, an ESP Stage 2 built with SPTM_VIRT=1 but without SPTM_VIRT_ESP (USE_CLANG=1 BUILDSTD=1 CHAINLOADING=1 SPTM_VIRT=1 ESP_STAGE2=1 DEBUGUSB_PROXY=1) no longer links: _file_vital_end is at 0x13bcc8, 113864 B past _file_limit. .text crossed one 64 KiB step and the read-only segment, which now also holds the virtualized SPTM's code, crossed another. Moving code into .init no longer helps, as .init and .text share their steps. - Link the compressed boot logos past _file_vital_end again, with the fonts. c5c5b35 put them there; 21a2a83, from a tree whose limit still covered the whole file part, linked them as .rodata, so the *_48.o(.data) lines in aura-raw.ld stopped matching and 42 KiB of logos went back into the vital region. A logo the DCP overwrites fails its gzip CRC in fb.c and is left blank, as c5c5b35 intended. aura.ld (the Mach-O) keeps them in .rodata. - Build the kboot_*.o handoff objects and the sptm_virt objects at -Oz, as kboot.o and sptm_virt_cl4.o already are, and aura's own Rust crate at opt-level "z", as ed25519-compact already is. All of it is setup or development code; sha2, which hashes each measured kernel, nv2.c and the dependencies keep their levels. - Put sptm_virt_s2r.o's code in .text with the room that frees, so .text and the read-only segment each stay below their step. Both are in the one executable mapping, [_base, _rodata_end). _file_limit is unchanged. With the flags above (clang 23, rustc 1.99, cold build) _file_vital_end is now 0x11bcc0: 23608 B left in .text, 16120 B in .rodata and 17216 B of data room. The image is 64 KiB smaller. A Stage 1 (RELEASE=1 CHAINLOADING=1 BUILTIN_LOGO=aurora) has 18424 B of headroom. Signed-off-by: Diljit Singh <hey@djdev.me>
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.
What
Since #70, an ESP Stage 2 built with
SPTM_VIRT=1but withoutSPTM_VIRT_ESPno longer links:_file_vital_endlands at0x13bcc8, 113864 B past_file_limit..textcrossed one 64 KiB step, and the read-only segment (which now also holds the virtualized SPTM's code) crossed another. The CI jobs build this code only at-Ozor withSPTM_VIRT_ESP, so they didn't catch it. Moving code into.initno longer helps, because.initand.textnow share their steps.Changes
_file_vital_end. c5c5b35 linked the compressed boot logos with the fonts after_file_vital_end. 21a2a83 (written against a limit that still covered the whole file part) renamed their section to.rodata, so the*_48.o(.data)lines inaura-raw.ldstopped matching and 42 KiB of logos went back into the vital region. They're now linked with the fonts again. A logo the DCP overwrites fails its gzip CRC infb.cand is left blank, as c5c5b35 intended.aura.ld(the Mach-O) is unchanged.kboot_*.ohandoff objects and thesptm_virt*.oobjects build at-Oz, askboot.oandsptm_virt_cl4.oalready do. aura's own Rust crate builds atopt-level = "z", ased25519-compactalready does: it's ADT lookups, GPU init data and the ESP/chainload paths, with nothing in an exception or I/O path.sha2, which hashes every measured kernel, keeps the default, and so donv2.cand the other dependencies.sptm_virt_s2r.o's code goes in.text, using the room the above frees, so.textand the read-only segment each stay below their step. Both are inside the one executable mapping,[_base, _rodata_end)(memory.c)._file_limitis unchanged.Result
Cold builds, clang 23, rustc 1.99:
SPTM_VIRT=1 ESP_STAGE2=1 DEBUGUSB_PROXY=1(flags above)0x13bcc8)_file_vital_end 0x11bcc0: 23608 B left in.text, 16120 B in.rodata, 17216 B dataRELEASE=1 CHAINLOADING=1 BUILTIN_LOGO=auroraSPTM_VIRT_ESP=1at-Oz-OzThe image is also 64 KiB smaller. Both builds carry the logos (
verify-logo). Everything moved stays in the same segment lifetime: nothing frees or remaps part of[_base, _rodata_end), andstart.Sstill copies the file part up to_file_end, logos included.🤖 Generated with Claude Code