I don’t know how I got the idea, but now it works:
The issue was either the wrong entry point being loaded when having both _entry
and _start
(somehow Zig ignores my _entry
function and uses _start
, even though in the linker script I have clearly stated ENTRY(_entry)
) or a symbol collision when using _start
in either a separate startup program or everything.
My solution was to leave everything that will be needed when doing @import("root")
in the src/test_main.zig
file but move the test main function to src/main.zig
. Then, I specified src/test_main.zig
as the test runner (which didn’t contain the actual test runner code) and src/main.zig
as the root source file. src/main.zig
exports _start
(and there it’ll check whether it’s in testing mode or not and conditionally invoke tmain
or kmain
).