commit 96e3222796df6124a54b1261936d8262b660fbf4 (tree)
parent 8bf5a3a5c1b5dd814d6a0fc47a4182ff5ecfe77d
Author: Sébastien Marie <semarie@online.fr>
Date: Mon, 14 Dec 2020 14:01:39 +0000
openbsd: crt0.o file is different when build static or dynamic mode
it is a first step for support static *and* dynamic mode for openbsd
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
@@ -1441,8 +1441,14 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
if (link_in_crt) {
const crt1o: []const u8 = o: {
- if (target.os.tag == .netbsd or target.os.tag == .openbsd) {
+ if (target.os.tag == .netbsd) {
break :o "crt0.o";
+ } else if (target.os.tag == .openbsd) {
+ if (self.base.options.link_mode == .Static) {
+ break :o "rcrt0.o";
+ } else {
+ break :o "crt0.o";
+ }
} else if (target.isAndroid()) {
if (self.base.options.link_mode == .Dynamic) {
break :o "crtbegin_dynamic.o";