mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
stage2: error check for mixing --import-table and --export-table
is moved from the linker to the frontend. This is a follow-up from 4cb2f11693b1bf13770b8ad6a8b8a1e37101a516.
This commit is contained in:
parent
2e887452d5
commit
2cbeb85a96
@ -852,6 +852,10 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
|
||||
// WASI-only. Resolve the optional exec-model option, defaults to command.
|
||||
const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command;
|
||||
|
||||
if (options.linker_export_table and options.linker_import_table) {
|
||||
return error.ExportTableAndImportTableConflict;
|
||||
}
|
||||
|
||||
const comp: *Compilation = comp: {
|
||||
// For allocations that have the same lifetime as Compilation. This arena is used only during this
|
||||
// initialization and then is freed in deinit().
|
||||
|
||||
@ -1123,14 +1123,12 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
|
||||
}
|
||||
|
||||
if (self.base.options.import_table) {
|
||||
if (self.base.options.export_table) {
|
||||
log.err("--import-table and --export-table may not be used together", .{});
|
||||
return error.InvalidArgs;
|
||||
}
|
||||
assert(self.base.options.export_table);
|
||||
try argv.append("--import-table");
|
||||
}
|
||||
|
||||
if (self.base.options.export_table) {
|
||||
assert(!self.base.options.import_table);
|
||||
try argv.append("--export-table");
|
||||
}
|
||||
|
||||
|
||||
@ -2543,6 +2543,9 @@ fn buildOutputType(
|
||||
}
|
||||
process.exit(1);
|
||||
},
|
||||
error.ExportTableAndImportTableConflict => {
|
||||
fatal("--import-table and --export-table may not be used together", .{});
|
||||
},
|
||||
else => fatal("unable to create compilation: {s}", .{@errorName(err)}),
|
||||
};
|
||||
var comp_destroyed = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user