aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/Compile.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/Build/Step/Compile.zig')
-rw-r--r--lib/std/Build/Step/Compile.zig25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig
index 9ede31c917..2d08541545 100644
--- a/lib/std/Build/Step/Compile.zig
+++ b/lib/std/Build/Step/Compile.zig
@@ -189,7 +189,8 @@ dll_export_fns: ?bool = null,
subsystem: ?std.Target.SubSystem = null,
-entry_symbol_name: ?[]const u8 = null,
+/// How the linker must handle the entry point of the executable.
+entry: Entry = .default,
/// List of symbols forced as undefined in the symbol table
/// thus forcing their resolution by the linker.
@@ -304,6 +305,18 @@ const FrameworkLinkInfo = struct {
weak: bool = false,
};
+const Entry = union(enum) {
+ /// Let the compiler decide whether to make an entry point and what to name
+ /// it.
+ default,
+ /// The executable will have no entry point.
+ disabled,
+ /// The executable will have an entry point with the default symbol name.
+ enabled,
+ /// The executable will have an entry point with the specified symbol name.
+ symbol_name: []const u8,
+};
+
pub const IncludeDir = union(enum) {
path: LazyPath,
path_system: LazyPath,
@@ -1418,9 +1431,13 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
try zig_args.append(try std.fmt.allocPrint(b.allocator, "-ofmt={s}", .{@tagName(ofmt)}));
}
- if (self.entry_symbol_name) |entry| {
- try zig_args.append("--entry");
- try zig_args.append(entry);
+ switch (self.entry) {
+ .default => {},
+ .disabled => try zig_args.append("-fno-entry"),
+ .enabled => try zig_args.append("-fentry"),
+ .symbol_name => |entry_name| {
+ try zig_args.append(try std.fmt.allocPrint(b.allocator, "-fentry={s}", .{entry_name}));
+ },
}
{