| author | |
| committer | |
| log | 2cbeb85a96af25f2718a604aa2bec4f76dd85018 |
| tree | efc5b9f311f53440d656b006d7c5ecec3a0443f6 |
| parent | 2e887452d5cd8e912f6bdb36bd0da6faee383465 |
is moved from the linker to the frontend. This is a follow-up from
4cb2f11693b1bf13770b8ad6a8b8a1e37101a516.3 files changed, 9 insertions(+), 4 deletions(-)
src/Compilation.zig+4| ... | @@ -852,6 +852,10 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -852,6 +852,10 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 852 | // WASI-only. Resolve the optional exec-model option, defaults to command. | 852 | // WASI-only. Resolve the optional exec-model option, defaults to command. |
| 853 | const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command; | 853 | const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command; |
| 854 | 854 | ||
| 855 | if (options.linker_export_table and options.linker_import_table) { | ||
| 856 | return error.ExportTableAndImportTableConflict; | ||
| 857 | } | ||
| 858 | |||
| 855 | const comp: *Compilation = comp: { | 859 | const comp: *Compilation = comp: { |
| 856 | // For allocations that have the same lifetime as Compilation. This arena is used only during this | 860 | // For allocations that have the same lifetime as Compilation. This arena is used only during this |
| 857 | // initialization and then is freed in deinit(). | 861 | // initialization and then is freed in deinit(). |
src/link/Wasm.zig+2-4| ... | @@ -1123,14 +1123,12 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { | ... | @@ -1123,14 +1123,12 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { |
| 1123 | } | 1123 | } |
| 1124 | 1124 | ||
| 1125 | if (self.base.options.import_table) { | 1125 | if (self.base.options.import_table) { |
| 1126 | if (self.base.options.export_table) { | 1126 | assert(self.base.options.export_table); |
| 1127 | log.err("--import-table and --export-table may not be used together", .{}); | ||
| 1128 | return error.InvalidArgs; | ||
| 1129 | } | ||
| 1130 | try argv.append("--import-table"); | 1127 | try argv.append("--import-table"); |
| 1131 | } | 1128 | } |
| 1132 | 1129 | ||
| 1133 | if (self.base.options.export_table) { | 1130 | if (self.base.options.export_table) { |
| 1131 | assert(!self.base.options.import_table); | ||
| 1134 | try argv.append("--export-table"); | 1132 | try argv.append("--export-table"); |
| 1135 | } | 1133 | } |
| 1136 | 1134 |
src/main.zig+3| ... | @@ -2543,6 +2543,9 @@ fn buildOutputType( | ... | @@ -2543,6 +2543,9 @@ fn buildOutputType( |
| 2543 | } | 2543 | } |
| 2544 | process.exit(1); | 2544 | process.exit(1); |
| 2545 | }, | 2545 | }, |
| 2546 | error.ExportTableAndImportTableConflict => { | ||
| 2547 | fatal("--import-table and --export-table may not be used together", .{}); | ||
| 2548 | }, | ||
| 2546 | else => fatal("unable to create compilation: {s}", .{@errorName(err)}), | 2549 | else => fatal("unable to create compilation: {s}", .{@errorName(err)}), |
| 2547 | }; | 2550 | }; |
| 2548 | var comp_destroyed = false; | 2551 | var comp_destroyed = false; |