openbsd: address link/Elf.zig comments

- restore correct behaviour on Android target for appending "crtend_android.o"
- some nits
This commit is contained in:
Sébastien Marie 2020-10-11 10:12:40 +00:00
parent 97ec9fdd79
commit 9ff51f22b4

View File

@ -1448,14 +1448,14 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
}; };
try argv.append(try comp.get_libc_crt_file(arena, crt1o)); try argv.append(try comp.get_libc_crt_file(arena, crt1o));
if (target_util.libc_needs_crti_crtn(target)) { if (target_util.libc_needs_crti_crtn(target)) {
const crtio: []const u8 = o: { const crti_o = o: {
if (target.os.tag == .openbsd) { if (target.os.tag == .openbsd) {
break :o "crtbegin.o"; break :o "crtbegin.o";
} else { } else {
break :o "crti.o"; break :o "crti.o";
} }
}; };
try argv.append(try comp.get_libc_crt_file(arena, crtio)); try argv.append(try comp.get_libc_crt_file(arena, crti_o));
} }
} }
@ -1599,8 +1599,8 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
// crt end // crt end
if (link_in_crt) { if (link_in_crt) {
if (target_util.libc_needs_crti_crtn(target)) { if (target.isAndroid() or target_util.libc_needs_crti_crtn(target)) {
const crtno: []const u8 = o: { const crtn_o = o: {
if (target.os.tag == .openbsd) { if (target.os.tag == .openbsd) {
break :o "crtend.o"; break :o "crtend.o";
} else if (target.isAndroid()) { } else if (target.isAndroid()) {
@ -1609,7 +1609,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
break :o "crtn.o"; break :o "crtn.o";
} }
}; };
try argv.append(try comp.get_libc_crt_file(arena, crtno)); try argv.append(try comp.get_libc_crt_file(arena, crtn_o));
} }
} }