blaise/compiler
Graeme Geldenhuys d0032269d6 feat(freebsd): select the RTL unit list per target (Step 5)
EnsureRTLObjects hard-coded the Linux RTL adapter set: rtl.platform.layout.linux
in the base list, and for a --static link the Linux kernel leaf
(runtime.start.static.linux, runtime.syscall.linux, runtime.libc.linux,
runtime.libc2.linux, runtime.thread.static.linux). A --target freebsd-x86_64
program therefore always linked Linux/libc RTL code regardless of the target.

Extract the selection into a pure, unit-tested helper BuildRTLUnitList(AStatic,
AOS) that follows the target: the platform-layout adapter becomes
rtl.platform.layout.<os>, and the --static kernel leaf swaps to the freestanding
per-OS units (runtime.start.static.<os>, runtime.syscall.<os>,
runtime.libc.<os>, runtime.libc2.<os>, runtime.thread.static.<os>) plus the
OS-invariant runtime.cstub. EnsureRTLObjects now drives it off AOpts.Static and
AOpts.Target.OS. Linux is the default suffix, so the existing Linux link path is
byte-for-byte unchanged; FreeBSD selects its full adapter set with no Linux RTL
unit present.

Tests: TBackendDriverContractTests.TestRTLUnits_* cover the Linux-dynamic,
Linux-static, FreeBSD-static-swaps and FreeBSD-static-no-Linux-leaf cases.
Verified: --static Linux hello-world still runs (regression check); all four
fixpoints + QBE & native TestRunner green (4024 tests).
2026-07-01 10:28:13 +01:00
..
src feat(freebsd): select the RTL unit list per target (Step 5) 2026-07-01 10:28:13 +01:00
project.xml refactor(rtl): relocate RTL units into the compiler tree (dotted-flat names) 2026-06-25 16:05:44 +01:00