zig
zig copied to clipboard
llvm: force `TargetOptions.UseInitArray` to `true`
The TargetOptions default constructor initializes all bools to false, yet clang defaults to setting this option to true. Since recent glibc versions on linux do not appear to support this being set to false, just changing the default for now unless a use case for making it configurable is found.
Some context if anyone's interested: .ctors/.dtors are so archaic that even the "new" .init_array/.fini_array are over two decades old. Defaulting this to true is very sensible.
GCC still has a few backends that use the old ones, but they're mostly all niche architectures that are bordering on being unmaintained (FRV, MCore, RL78, ...). Also, apparently GNU ld has been transforming .ctors/.dtors into .init_array/.fini_array since at least 2011, so that may explain why those GCC backends haven't been updated.