Skip to content

Commit 12ab866

Browse files
committed
fix: payload branch wires link-time C runtime (-B/-L glibc lib)
With the sysroot cleared (validation) the linker lost the implicit crt1.o/ crti.o and -lm/-lc locations (CI: 'cannot find crt1.o'). The payload fallback now passes -B/-L <glibc payload lib> at link, completing the no-sysroot path end-to-end (compile headers via -idirafter + link runtime via -B/-L). Verified: fresh-home first-run builds AND runs.
1 parent 52c19ef commit 12ab866

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/build/flags.cppm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ CompileFlags compute_flags(const BuildPlan& plan) {
185185
compile_toolchain_flags += inc_flag(pp.glibcInclude);
186186
if (!pp.linuxInclude.empty())
187187
compile_toolchain_flags += inc_flag(pp.linuxInclude);
188+
// Link-time C runtime: a usable --sysroot would have provided the
189+
// startup objects and core libs implicitly. Without one, point the
190+
// driver at the glibc payload lib dir: -B for crt1.o/crti.o discovery,
191+
// -L for -lm/-lc resolution.
192+
link_toolchain_flags += " -B" + escape_path(pp.glibcLib);
193+
link_toolchain_flags += " -L" + escape_path(pp.glibcLib);
194+
f.sysroot = link_toolchain_flags;
188195
}
189196

190197
// Binutils -B flag

0 commit comments

Comments
 (0)