From f4f5b2bc41e09ed68caf3c839433e44bd9b33249 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Wed, 24 Jul 2024 00:51:03 -0400 Subject: [PATCH] llvm: force `TargetOptions.UseInitArray` to `true` The `TargetOptions` default constructor initializes all `bool`s 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. --- src/zig_llvm.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index 5aca64cd0a..167e7a162f 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -129,6 +129,7 @@ LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Tri TargetOptions opt; + opt.UseInitArray = true; opt.FunctionSections = function_sections; opt.DataSections = data_sections; switch (float_abi) {