aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-12-26 21:39:39 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 17:51:21 -0700
commit57562c8d507667b6fefcb7fbc7a305fbd610b5dd (patch)
treef0e494bdace7302f7cce8ad8c9c7d3227bd81d64 /src/link.zig
parentc9fe43679f8d8f0db6250cc881b59cc68daaf128 (diff)
downloadzig-57562c8d507667b6fefcb7fbc7a305fbd610b5dd.tar.gz
zig-57562c8d507667b6fefcb7fbc7a305fbd610b5dd.zip
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.
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig9
1 files changed, 9 insertions, 0 deletions
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