mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Export _start as __start for MIPS targets
This commit is contained in:
parent
a9be62f085
commit
c8e4108c5b
2 changed files with 8 additions and 6 deletions
|
|
@ -13,6 +13,11 @@ const is_wasm = switch (builtin.arch) {
|
||||||
else => false,
|
else => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const is_mips = switch (builtin.arch) {
|
||||||
|
.mips, .mipsel, .mips64, .mips64el => true,
|
||||||
|
else => false,
|
||||||
|
};
|
||||||
|
|
||||||
comptime {
|
comptime {
|
||||||
if (builtin.link_libc) {
|
if (builtin.link_libc) {
|
||||||
@export("main", main, .Strong);
|
@export("main", main, .Strong);
|
||||||
|
|
@ -22,6 +27,8 @@ comptime {
|
||||||
@export("_start", wasm_freestanding_start, .Strong);
|
@export("_start", wasm_freestanding_start, .Strong);
|
||||||
} else if (builtin.os == .uefi) {
|
} else if (builtin.os == .uefi) {
|
||||||
@export("EfiMain", EfiMain, .Strong);
|
@export("EfiMain", EfiMain, .Strong);
|
||||||
|
} else if (is_mips) {
|
||||||
|
if (!@hasDecl(root, "__start")) @export("__start", _start, .Strong);
|
||||||
} else {
|
} else {
|
||||||
if (!@hasDecl(root, "_start")) @export("_start", _start, .Strong);
|
if (!@hasDecl(root, "_start")) @export("_start", _start, .Strong);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1813,14 +1813,9 @@ static void construct_linker_job_elf(LinkJob *lj) {
|
||||||
lj->args.append("--allow-shlib-undefined");
|
lj->args.append("--allow-shlib-undefined");
|
||||||
}
|
}
|
||||||
|
|
||||||
// MIPS entry point name is __start instead of _start, force the linker to
|
if (g->zig_target->os == OsZen) {
|
||||||
// use the latter
|
|
||||||
if (target_is_mips(g->zig_target) || g->zig_target->os == OsZen) {
|
|
||||||
lj->args.append("-e");
|
lj->args.append("-e");
|
||||||
lj->args.append("_start");
|
lj->args.append("_start");
|
||||||
}
|
|
||||||
|
|
||||||
if (g->zig_target->os == OsZen) {
|
|
||||||
lj->args.append("--image-base=0x10000000");
|
lj->args.append("--image-base=0x10000000");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue