| ... | ... | @@ -1305,7 +1305,7 @@ pub fn findGlobalSymbol(wasm: *Wasm, name: []const u8) ?SymbolLoc { |
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | fn checkUndefinedSymbols(wasm: *const Wasm) !void { |
| 1308 | | if (wasm.base.options.output_mode == .Obj) return; |
| 1308 | if (wasm.base.comp.config.output_mode == .Obj) return; |
| 1309 | 1309 | if (wasm.base.options.import_symbols) return; |
| 1310 | 1310 | |
| 1311 | 1311 | var found_undefined_symbols = false; |
| ... | ... | @@ -2065,7 +2065,7 @@ fn mapFunctionTable(wasm: *Wasm) void { |
| 2065 | 2065 | } |
| 2066 | 2066 | } |
| 2067 | 2067 | |
| 2068 | | if (wasm.import_table or wasm.base.options.output_mode == .Obj) { |
| 2068 | if (wasm.import_table or wasm.base.comp.config.output_mode == .Obj) { |
| 2069 | 2069 | const sym_loc = wasm.findGlobalSymbol("__indirect_function_table").?; |
| 2070 | 2070 | const import = wasm.imports.getPtr(sym_loc).?; |
| 2071 | 2071 | import.kind.table.limits.min = index - 1; // we start at index 1. |
| ... | ... | @@ -2230,11 +2230,11 @@ fn parseAtom(wasm: *Wasm, atom_index: Atom.Index, kind: Kind) !void { |
| 2230 | 2230 | // we set the entire region of it to zeroes. |
| 2231 | 2231 | // We do not have to do this when exporting the memory (the default) because the runtime |
| 2232 | 2232 | // will do it for us, and we do not emit the bss segment at all. |
| 2233 | | if ((wasm.base.options.output_mode == .Obj or wasm.base.options.import_memory) and kind.data == .uninitialized) { |
| 2233 | if ((wasm.base.comp.config.output_mode == .Obj or wasm.base.options.import_memory) and kind.data == .uninitialized) { |
| 2234 | 2234 | @memset(atom.code.items, 0); |
| 2235 | 2235 | } |
| 2236 | 2236 | |
| 2237 | | const should_merge = wasm.base.options.output_mode != .Obj; |
| 2237 | const should_merge = wasm.base.comp.config.output_mode != .Obj; |
| 2238 | 2238 | const gop = try wasm.data_segments.getOrPut(gpa, segment_info.outputName(should_merge)); |
| 2239 | 2239 | if (gop.found_existing) { |
| 2240 | 2240 | const index = gop.value_ptr.*; |
| ... | ... | @@ -2392,7 +2392,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void { |
| 2392 | 2392 | }; |
| 2393 | 2393 | |
| 2394 | 2394 | const atom = wasm.getAtom(atom_index); |
| 2395 | | const merge_segment = wasm.base.options.output_mode != .Obj; |
| 2395 | const merge_segment = wasm.base.comp.config.output_mode != .Obj; |
| 2396 | 2396 | const segment_info = if (atom.file) |object_index| blk: { |
| 2397 | 2397 | break :blk wasm.objects.items[object_index].segment_info; |
| 2398 | 2398 | } else wasm.segment_info.values(); |
| ... | ... | @@ -2934,7 +2934,7 @@ fn mergeTypes(wasm: *Wasm) !void { |
| 2934 | 2934 | |
| 2935 | 2935 | fn setupExports(wasm: *Wasm) !void { |
| 2936 | 2936 | const gpa = wasm.base.comp.gpa; |
| 2937 | | if (wasm.base.options.output_mode == .Obj) return; |
| 2937 | if (wasm.base.comp.config.output_mode == .Obj) return; |
| 2938 | 2938 | log.debug("Building exports from symbols", .{}); |
| 2939 | 2939 | |
| 2940 | 2940 | const force_exp_names = wasm.base.options.export_symbol_names; |
| ... | ... | @@ -3009,7 +3009,7 @@ fn setupStart(wasm: *Wasm) !void { |
| 3009 | 3009 | } |
| 3010 | 3010 | |
| 3011 | 3011 | // Ensure the symbol is exported so host environment can access it |
| 3012 | | if (wasm.base.options.output_mode != .Obj) { |
| 3012 | if (wasm.base.comp.config.output_mode != .Obj) { |
| 3013 | 3013 | symbol.setFlag(.WASM_SYM_EXPORTED); |
| 3014 | 3014 | } |
| 3015 | 3015 | } |
| ... | ... | @@ -3029,7 +3029,7 @@ fn setupMemory(wasm: *Wasm) !void { |
| 3029 | 3029 | break :blk base; |
| 3030 | 3030 | } else 0; |
| 3031 | 3031 | |
| 3032 | | const is_obj = wasm.base.options.output_mode == .Obj; |
| 3032 | const is_obj = wasm.base.comp.config.output_mode == .Obj; |
| 3033 | 3033 | |
| 3034 | 3034 | if (place_stack_first and !is_obj) { |
| 3035 | 3035 | memory_ptr = stack_alignment.forward(memory_ptr); |
| ... | ... | @@ -3155,7 +3155,7 @@ pub fn getMatchingSegment(wasm: *Wasm, object_index: u16, symbol_index: u32) !u3 |
| 3155 | 3155 | switch (symbol.tag) { |
| 3156 | 3156 | .data => { |
| 3157 | 3157 | const segment_info = object.segment_info[symbol.index]; |
| 3158 | | const merge_segment = wasm.base.options.output_mode != .Obj; |
| 3158 | const merge_segment = wasm.base.comp.config.output_mode != .Obj; |
| 3159 | 3159 | const result = try wasm.data_segments.getOrPut(gpa, segment_info.outputName(merge_segment)); |
| 3160 | 3160 | if (!result.found_existing) { |
| 3161 | 3161 | result.value_ptr.* = index; |
| ... | ... | @@ -3797,7 +3797,7 @@ fn writeToFile( |
| 3797 | 3797 | var code_section_index: ?u32 = null; |
| 3798 | 3798 | // Index of the data section. Used to tell relocation table where the section lives. |
| 3799 | 3799 | var data_section_index: ?u32 = null; |
| 3800 | | const is_obj = wasm.base.options.output_mode == .Obj or (!use_llvm and use_lld); |
| 3800 | const is_obj = wasm.base.comp.config.output_mode == .Obj or (!use_llvm and use_lld); |
| 3801 | 3801 | |
| 3802 | 3802 | var binary_bytes = std.ArrayList(u8).init(gpa); |
| 3803 | 3803 | defer binary_bytes.deinit(); |
| ... | ... | @@ -4550,7 +4550,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4550 | 4550 | sub_prog_node.context.refresh(); |
| 4551 | 4551 | defer sub_prog_node.end(); |
| 4552 | 4552 | |
| 4553 | | const is_obj = wasm.base.options.output_mode == .Obj; |
| 4553 | const is_obj = wasm.base.comp.config.output_mode == .Obj; |
| 4554 | 4554 | const compiler_rt_path: ?[]const u8 = blk: { |
| 4555 | 4555 | if (comp.compiler_rt_lib) |lib| break :blk lib.full_object_path; |
| 4556 | 4556 | if (comp.compiler_rt_obj) |obj| break :blk obj.full_object_path; |
| ... | ... | @@ -4750,7 +4750,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4750 | 4750 | try argv.append("--allow-undefined"); |
| 4751 | 4751 | } |
| 4752 | 4752 | |
| 4753 | | if (wasm.base.options.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic) { |
| 4753 | if (wasm.base.comp.config.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic) { |
| 4754 | 4754 | try argv.append("--shared"); |
| 4755 | 4755 | } |
| 4756 | 4756 | if (wasm.base.options.pie) { |
| ... | ... | @@ -4769,8 +4769,8 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4769 | 4769 | } |
| 4770 | 4770 | |
| 4771 | 4771 | if (target.os.tag == .wasi) { |
| 4772 | | const is_exe_or_dyn_lib = wasm.base.options.output_mode == .Exe or |
| 4773 | | (wasm.base.options.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic); |
| 4772 | const is_exe_or_dyn_lib = wasm.base.comp.config.output_mode == .Exe or |
| 4773 | (wasm.base.comp.config.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic); |
| 4774 | 4774 | if (is_exe_or_dyn_lib) { |
| 4775 | 4775 | for (wasm.wasi_emulated_libs) |crt_file| { |
| 4776 | 4776 | try argv.append(try comp.get_libc_crt_file( |
| ... | ... | @@ -4818,7 +4818,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4818 | 4818 | try argv.append(p); |
| 4819 | 4819 | } |
| 4820 | 4820 | |
| 4821 | | if (wasm.base.options.output_mode != .Obj and |
| 4821 | if (wasm.base.comp.config.output_mode != .Obj and |
| 4822 | 4822 | !wasm.base.options.skip_linker_dependencies and |
| 4823 | 4823 | !wasm.base.options.link_libc) |
| 4824 | 4824 | { |
| ... | ... | @@ -4904,7 +4904,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4904 | 4904 | // it, and then can react to that in the same way as trying to run an ELF file |
| 4905 | 4905 | // from a foreign CPU architecture. |
| 4906 | 4906 | if (fs.has_executable_bit and target.os.tag == .wasi and |
| 4907 | | wasm.base.options.output_mode == .Exe) |
| 4907 | wasm.base.comp.config.output_mode == .Exe) |
| 4908 | 4908 | { |
| 4909 | 4909 | // TODO: what's our strategy for reporting linker errors from this function? |
| 4910 | 4910 | // report a nice error here with the file path if it fails instead of |