From 57562c8d507667b6fefcb7fbc7a305fbd610b5dd Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 26 Dec 2023 21:39:39 -0700 Subject: compiler: push entry symbol name resolution into the linker This is necessary because on COFF, the entry symbol name is not known until the linker has looked at the set of global symbol names to determine which of the four possible main entry points is present. --- src/link.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/link.zig') diff --git a/src/link.zig b/src/link.zig index 8fc1e8cc91..a051d27b12 100644 --- a/src/link.zig +++ b/src/link.zig @@ -83,6 +83,8 @@ pub const File = struct { symbol_count_hint: u64 = 32, program_code_size_hint: u64 = 256 * 1024, + /// This may depend on what symbols are found during the linking process. + entry: Entry, /// Virtual address of the entry point procedure relative to image base. entry_addr: ?u64, stack_size: ?u64, @@ -169,6 +171,13 @@ pub const File = struct { module_definition_file: ?[]const u8, wasi_emulated_libs: []const wasi_libc.CRTFile, + + pub const Entry = union(enum) { + default, + disabled, + enabled, + named: []const u8, + }; }; /// Attempts incremental linking, if the file already exists. If -- cgit v1.2.3