diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-12-26 21:39:39 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-01 17:51:21 -0700 |
| commit | 57562c8d507667b6fefcb7fbc7a305fbd610b5dd (patch) | |
| tree | f0e494bdace7302f7cce8ad8c9c7d3227bd81d64 /src/Compilation.zig | |
| parent | c9fe43679f8d8f0db6250cc881b59cc68daaf128 (diff) | |
| download | zig-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/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index d8c59f4f1b..9029d8ecbc 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -924,7 +924,7 @@ pub const LinkObject = struct { loption: bool = false, }; -pub const InitOptions = struct { +pub const CreateOptions = struct { zig_lib_directory: Directory, local_cache_directory: Directory, global_cache_directory: Directory, @@ -1054,7 +1054,7 @@ pub const InitOptions = struct { /// infinite recursion. skip_linker_dependencies: bool = false, hash_style: link.File.Elf.HashStyle = .both, - entry: ?[]const u8 = null, + entry: Entry = .default, force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}, stack_size: ?u64 = null, image_base: ?u64 = null, @@ -1089,6 +1089,8 @@ pub const InitOptions = struct { /// (Windows) PDB output path pdb_out_path: ?[]const u8 = null, error_limit: ?Compilation.Module.ErrorInt = null, + + pub const Entry = link.File.OpenOptions.Entry; }; fn addModuleTableToCacheHash( @@ -1159,7 +1161,7 @@ fn addModuleTableToCacheHash( } } -pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { +pub fn create(gpa: Allocator, options: CreateOptions) !*Compilation { const output_mode = options.config.output_mode; const is_dyn_lib = switch (output_mode) { .Obj, .Exe => false, @@ -1543,6 +1545,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .dynamicbase = options.linker_dynamicbase, .major_subsystem_version = options.major_subsystem_version, .minor_subsystem_version = options.minor_subsystem_version, + .entry = options.entry, .stack_size = options.stack_size, .image_base = options.image_base, .version_script = options.version_script, |
