add pie in hopes to fix relocations

This commit is contained in:
Brendan Hansknecht 2024-12-11 19:54:59 -08:00
parent cf463c16bb
commit 4f29d46bdc
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -75,11 +75,12 @@ fn generateLlvmIrFile(
) void {
const obj = b.addObject(.{ .strip = true, .name = object_name, .root_source_file = main_path, .optimize = mode, .target = target, .use_llvm = true });
obj.root_module.stack_check = false;
obj.pie = true;
if (target.result.cpu.arch != std.Target.Cpu.Arch.wasm32)
obj.bundle_compiler_rt = true;
obj.root_module.stack_check = false;
// Generating the bin seems required to get zig to generate the llvm ir.
_ = obj.getEmittedBin();
const ir_file = obj.getEmittedLlvmIr();
@ -110,6 +111,7 @@ fn generateObjectFile(
obj.link_function_sections = true;
obj.root_module.stack_check = false;
obj.pie = true;
if (target.result.cpu.arch != std.Target.Cpu.Arch.wasm32)
obj.bundle_compiler_rt = true;