mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-05-22 00:49:35 +03:00
Merge pull request #2526 from LemonBoy/arch-format-osx
Build archives using the K_DARWIN format when targeting osx
This commit is contained in:
@@ -776,14 +776,6 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
|
||||
}
|
||||
|
||||
static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path, OutType child_out_type) {
|
||||
// The Mach-O LLD code is not well maintained, and trips an assertion
|
||||
// when we link compiler_rt and libc.zig as libraries rather than objects.
|
||||
// Here we workaround this by having compiler_rt and libc.zig be objects.
|
||||
// TODO write our own linker. https://github.com/ziglang/zig/issues/1535
|
||||
if (parent_gen->zig_target->os == OsMacOSX) {
|
||||
child_out_type = OutTypeObj;
|
||||
}
|
||||
|
||||
CodeGen *child_gen = create_child_codegen(parent_gen, full_path, child_out_type,
|
||||
parent_gen->libc);
|
||||
codegen_set_out_name(child_gen, buf_create_from_str(aname));
|
||||
|
||||
+1
-1
@@ -1350,7 +1350,7 @@ static void init_rand() {
|
||||
zig_panic("unable to open /dev/urandom");
|
||||
}
|
||||
char bytes[sizeof(unsigned)];
|
||||
size_t amt_read;
|
||||
ssize_t amt_read;
|
||||
while ((amt_read = read(fd, bytes, sizeof(unsigned))) == -1) {
|
||||
if (errno == EINTR) continue;
|
||||
zig_panic("unable to read /dev/urandom");
|
||||
|
||||
@@ -877,6 +877,7 @@ bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size
|
||||
case ZigLLVM_Linux:
|
||||
kind = object::Archive::K_GNU;
|
||||
break;
|
||||
case ZigLLVM_MacOSX:
|
||||
case ZigLLVM_Darwin:
|
||||
case ZigLLVM_IOS:
|
||||
kind = object::Archive::K_DARWIN;
|
||||
|
||||
Reference in New Issue
Block a user