Skip to content

Commit

Permalink
emerald: calling emerald should be legal
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Oct 21, 2024
1 parent 5c874c9 commit 0ebba07
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,21 @@ pub fn main() !void {
const all_args = try std.process.argsAlloc(arena);
const cmd = std.fs.path.basename(all_args[0]);
const tag: Ld.Tag = blk: {
if (mem.eql(u8, cmd, "ld")) break :blk switch (builtin.target.ofmt) {
.elf => .elf,
.macho => .macho,
.coff => .coff,
.wasm => .wasm,
else => |other| fatal("unsupported file format '{s}'", .{@tagName(other)}),
} else if (mem.eql(u8, cmd, "ld.emerald")) {
if (mem.eql(u8, cmd, "ld.emerald")) {
break :blk .elf;
} else if (mem.eql(u8, cmd, "ld64.emerald")) {
break :blk .macho;
} else if (mem.eql(u8, cmd, "emerald-link.exe")) {
break :blk .coff;
} else if (mem.eql(u8, cmd, "wasm-emerald")) {
break :blk .wasm;
} else {
std.io.getStdOut().writeAll(usage) catch {};
std.process.exit(0);
}
} else break :blk switch (builtin.target.ofmt) {
.elf => .elf,
.macho => .macho,
.coff => .coff,
.wasm => .wasm,
else => |other| fatal("unsupported file format '{s}'", .{@tagName(other)}),
};
};

const opts = try Ld.Options.parse(arena, tag, all_args[1..], .{
Expand Down

0 comments on commit 0ebba07

Please sign in to comment.