wasm does not like PIC

This commit is contained in:
Brendan Hansknecht 2024-12-12 17:43:44 -08:00
parent 3162fbf83f
commit 0f5f5fbe54
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -106,12 +106,13 @@ fn generateObjectFile(
step_name: []const u8,
object_name: []const u8,
) void {
const obj = b.addObject(.{ .strip = true, .pic = true, .name = object_name, .root_source_file = main_path, .optimize = mode, .target = target, .use_llvm = true });
const is_wasm = target.result.cpu.arch == .wasm32 or target.result.cpu.arch == .wasm64;
const obj = b.addObject(.{ .strip = true, .pic = !is_wasm, .name = object_name, .root_source_file = main_path, .optimize = mode, .target = target, .use_llvm = true });
obj.link_function_sections = true;
obj.root_module.stack_check = false;
if (target.result.cpu.arch != std.Target.Cpu.Arch.wasm32)
if (!is_wasm)
obj.bundle_compiler_rt = true;
const obj_file = obj.getEmittedBin();