From 10c2b36444788ae0518dfc8908a4821f4e60ed67 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 6 Apr 2021 16:02:18 +0200 Subject: [PATCH] stage1: Work around a small problem in LLVM API The missing initializer for a single field in the TargetOptions class was enough to turn the stack protectors into hot garbage. Fixes #8408 --- src/zig_llvm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index 5a7d60f83b..12ae9de75e 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -153,6 +153,11 @@ LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Tri } TargetOptions opt; + + // Work around the missing initialization of this field in the default + // constructor. Use -1 so that the default value is used. + opt.StackProtectorGuardOffset = (unsigned)-1; + opt.FunctionSections = function_sections; switch (float_abi) { case ZigLLVMABITypeDefault: