Zig Version
0.17.0-dev.135+9df02121d
Steps to Reproduce and Observed Behavior
I'm building my kernel module with the following config but when trying to do floating point computation Zig emits builtin calls which shall not happen with the .no_builtin = true flag.
varkernel_target=target;kernel_target.query.cpu_arch=kernel_target.query.cpu_archorelse@import("builtin").cpu.arch;kernel_target.query=switch(kernel_target.query.cpu_arch.?){.x86_64=>.{.cpu_arch=.x86_64,.os_tag=.freestanding,.abi=.none,.cpu_features_add=std.Target.x86.featureSet(&.{.soft_float,.retpoline,.retpoline_external_thunk}),.cpu_features_sub=std.Target.x86.featureSet(&.{.mmx,.sse,.sse2,.avx,.avx2}),},else=>@panic("Correct feature flags unimplemented for target arch..."),};constobject_options:std.Build.ObjectOptions=.{.name="pside_zig",.use_llvm=true,.root_module=b.createModule(.{.root_source_file=b.path("src/kernelspace/main.zig"),.target=kernel_target,.optimize=kernel_optimize,.link_libc=false,.link_libcpp=false,.single_threaded=true,.strip=false,.unwind_tables=.none,.code_model=.kernel,.stack_protector=false,.stack_check=false,.pic=false,.red_zone=false,.omit_frame_pointer=false,.error_tracing=false,.no_builtin=true,.imports=&.{.{.name="communications",.module=communications_mod},.{.name="kernel",.module=bindings_mod},.{.name="serialization",.module=serialization_mod},},}),};
❯ zig build
make -C /lib/modules/6.19.14-arch1-1/build M=/home/giuseppe/Documents/pside/.zig-cache/o/f179c7b7eaad6c04f3dd98eccb0cdd4b modules
make[1]: Entering directory '/usr/lib/modules/6.19.14-arch1-1/build'
make[2]: Entering directory '/home/giuseppe/Documents/pside/.zig-cache/o/f179c7b7eaad6c04f3dd98eccb0cdd4b'
MODPOST Module.symvers
ERROR: modpost: "__divsf3" [pside.ko] undefined!
ERROR: modpost: "__floatundisf" [pside.ko] undefined!
make[4]: *** [/usr/lib/modules/6.19.14-arch1-1/build/scripts/Makefile.modpost:147: Module.symvers] Error 1
make[3]: *** [/usr/lib/modules/6.19.14-arch1-1/build/Makefile:2015: modpost] Error 2
make[2]: *** [/usr/lib/modules/6.19.14-arch1-1/build/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/home/giuseppe/Documents/pside/.zig-cache/o/f179c7b7eaad6c04f3dd98eccb0cdd4b'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/usr/lib/modules/6.19.14-arch1-1/build'
make: *** [Makefile:8: all] Error 2
Expected Behavior
If I'm not mistaken, such functions shall be included in the binary itself and not be treated as provided externally. Moreover, I feel like this is a regression since some time ago I was doing this exact thing and everything was compiling.
### Zig Version
0.17.0-dev.135+9df02121d
### Steps to Reproduce and Observed Behavior
I'm building my kernel module with the following config but when trying to do floating point computation Zig emits builtin calls which shall not happen with the `.no_builtin = true` flag.
```zig
var kernel_target = target;
kernel_target.query.cpu_arch = kernel_target.query.cpu_arch orelse @import("builtin").cpu.arch;
kernel_target.query = switch (kernel_target.query.cpu_arch.?) {
.x86_64 => .{
.cpu_arch = .x86_64,
.os_tag = .freestanding,
.abi = .none,
.cpu_features_add = std.Target.x86.featureSet(&.{ .soft_float, .retpoline, .retpoline_external_thunk }),
.cpu_features_sub = std.Target.x86.featureSet(&.{ .mmx, .sse, .sse2, .avx, .avx2 }),
},
else => @panic("Correct feature flags unimplemented for target arch..."),
};
const object_options: std.Build.ObjectOptions = .{
.name = "pside_zig",
.use_llvm = true,
.root_module = b.createModule(.{
.root_source_file = b.path("src/kernelspace/main.zig"),
.target = kernel_target,
.optimize = kernel_optimize,
.link_libc = false,
.link_libcpp = false,
.single_threaded = true,
.strip = false,
.unwind_tables = .none,
.code_model = .kernel,
.stack_protector = false,
.stack_check = false,
.pic = false,
.red_zone = false,
.omit_frame_pointer = false,
.error_tracing = false,
.no_builtin = true,
.imports = &.{
.{ .name = "communications", .module = communications_mod },
.{ .name = "kernel", .module = bindings_mod },
.{ .name = "serialization", .module = serialization_mod },
},
}),
};
```
```
❯ zig build
make -C /lib/modules/6.19.14-arch1-1/build M=/home/giuseppe/Documents/pside/.zig-cache/o/f179c7b7eaad6c04f3dd98eccb0cdd4b modules
make[1]: Entering directory '/usr/lib/modules/6.19.14-arch1-1/build'
make[2]: Entering directory '/home/giuseppe/Documents/pside/.zig-cache/o/f179c7b7eaad6c04f3dd98eccb0cdd4b'
MODPOST Module.symvers
ERROR: modpost: "__divsf3" [pside.ko] undefined!
ERROR: modpost: "__floatundisf" [pside.ko] undefined!
make[4]: *** [/usr/lib/modules/6.19.14-arch1-1/build/scripts/Makefile.modpost:147: Module.symvers] Error 1
make[3]: *** [/usr/lib/modules/6.19.14-arch1-1/build/Makefile:2015: modpost] Error 2
make[2]: *** [/usr/lib/modules/6.19.14-arch1-1/build/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/home/giuseppe/Documents/pside/.zig-cache/o/f179c7b7eaad6c04f3dd98eccb0cdd4b'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/usr/lib/modules/6.19.14-arch1-1/build'
make: *** [Makefile:8: all] Error 2
```
### Expected Behavior
If I'm not mistaken, such functions shall be included in the binary itself and not be treated as provided externally. Moreover, I feel like this is a regression since some time ago I was doing this exact thing and everything was compiling.