6 ms·
In Zig the default target is native, which turns on all the applicable CPU features. If you want to target something other than the native machine you can use -
by AndyKelley 8y ago
In Zig the default target is native, which turns on all the applicable CPU features. If you want to target something other than the native machine you can use --target-os --target-arch parameters. I haven't exposed extra CPU options for cross compiling yet.
- saagarjha 8y agoDo you consider the default architecture targetted by GCC (e.g. some old Intel) to be cross compiling? That is, can I make a binary that supports most x86 processors rather than just those with the particular extensions I support, with the current Zig compiler?
- AndyKelley 8y agoYes. You can pass the native OS and native arch as the cross compilation target, and produce a binary that runs on your machine and others that don't have the same extra CPU features.
- loeg 8y agoThat explains the difference in the SHA256 code case. Case closed ;-).