| ... | ... | @@ -614,7 +614,6 @@ fn linkWithZld(self: *MachO, comp: *Compilation) !void { |
| 614 | 614 | const is_dyn_lib = self.base.options.link_mode == .Dynamic and is_lib; |
| 615 | 615 | const is_exe_or_dyn_lib = is_dyn_lib or self.base.options.output_mode == .Exe; |
| 616 | 616 | const stack_size = self.base.options.stack_size_override orelse 0; |
| 617 | | const allow_shlib_undefined = self.base.options.allow_shlib_undefined orelse !self.base.options.is_native_os; |
| 618 | 617 | |
| 619 | 618 | const id_symlink_basename = "zld.id"; |
| 620 | 619 | |
| ... | ... | @@ -629,8 +628,6 @@ fn linkWithZld(self: *MachO, comp: *Compilation) !void { |
| 629 | 628 | // We are about to obtain this lock, so here we give other processes a chance first. |
| 630 | 629 | self.base.releaseLock(); |
| 631 | 630 | |
| 632 | | try man.addOptionalFile(self.base.options.linker_script); |
| 633 | | try man.addOptionalFile(self.base.options.version_script); |
| 634 | 631 | try man.addListOfFiles(self.base.options.objects); |
| 635 | 632 | for (comp.c_object_table.keys()) |key| { |
| 636 | 633 | _ = try man.addFile(key.status.success.object_path, null); |
| ... | ... | @@ -639,21 +636,14 @@ fn linkWithZld(self: *MachO, comp: *Compilation) !void { |
| 639 | 636 | // We can skip hashing libc and libc++ components that we are in charge of building from Zig |
| 640 | 637 | // installation sources because they are always a product of the compiler version + target information. |
| 641 | 638 | man.hash.add(stack_size); |
| 642 | | man.hash.add(self.base.options.rdynamic); |
| 643 | | man.hash.addListOfBytes(self.base.options.extra_lld_args); |
| 644 | 639 | man.hash.addListOfBytes(self.base.options.lib_dirs); |
| 645 | 640 | man.hash.addListOfBytes(self.base.options.framework_dirs); |
| 646 | 641 | man.hash.addListOfBytes(self.base.options.frameworks); |
| 647 | 642 | man.hash.addListOfBytes(self.base.options.rpath_list); |
| 648 | | man.hash.add(self.base.options.skip_linker_dependencies); |
| 649 | | man.hash.add(self.base.options.z_nodelete); |
| 650 | | man.hash.add(self.base.options.z_defs); |
| 651 | 643 | if (is_dyn_lib) { |
| 652 | 644 | man.hash.addOptional(self.base.options.version); |
| 653 | 645 | } |
| 654 | 646 | man.hash.addStringSet(self.base.options.system_libs); |
| 655 | | man.hash.add(allow_shlib_undefined); |
| 656 | | man.hash.add(self.base.options.bind_global_refs_locally); |
| 657 | 647 | man.hash.addOptionalBytes(self.base.options.sysroot); |
| 658 | 648 | |
| 659 | 649 | // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock. |
| ... | ... | @@ -909,16 +899,12 @@ fn linkWithZld(self: *MachO, comp: *Compilation) !void { |
| 909 | 899 | Compilation.dump_argv(argv.items); |
| 910 | 900 | } |
| 911 | 901 | |
| 912 | | self.base.file = try fs.cwd().createFile(full_out_path, .{ |
| 902 | const sub_path = self.base.options.emit.?.sub_path; |
| 903 | self.base.file = try directory.handle.createFile(sub_path, .{ |
| 913 | 904 | .truncate = true, |
| 914 | 905 | .read = true, |
| 915 | | .mode = if (std.Target.current.os.tag == .windows) 0 else 0o777, |
| 906 | .mode = link.determineMode(self.base.options), |
| 916 | 907 | }); |
| 917 | | self.page_size = switch (self.base.options.target.cpu.arch) { |
| 918 | | .aarch64 => 0x4000, |
| 919 | | .x86_64 => 0x1000, |
| 920 | | else => unreachable, |
| 921 | | }; |
| 922 | 908 | |
| 923 | 909 | // TODO mimicking insertion of null symbol from incremental linker. |
| 924 | 910 | // This will need to moved. |
| ... | ... | @@ -932,10 +918,14 @@ fn linkWithZld(self: *MachO, comp: *Compilation) !void { |
| 932 | 918 | try self.strtab.append(self.base.allocator, 0); |
| 933 | 919 | |
| 934 | 920 | try self.populateMetadata(); |
| 921 | try self.addRpathLCs(rpaths.items); |
| 935 | 922 | try self.parseInputFiles(positionals.items, self.base.options.sysroot); |
| 936 | 923 | try self.parseLibs(libs.items, self.base.options.sysroot); |
| 937 | 924 | try self.resolveSymbols(); |
| 938 | 925 | try self.parseTextBlocks(); |
| 926 | try self.addLoadDylibLCs(); |
| 927 | try self.addDataInCodeLC(); |
| 928 | try self.addCodeSignatureLC(); |
| 939 | 929 | |
| 940 | 930 | { |
| 941 | 931 | // Add dyld_stub_binder as the final GOT entry. |
| ... | ... | @@ -953,10 +943,6 @@ fn linkWithZld(self: *MachO, comp: *Compilation) !void { |
| 953 | 943 | } |
| 954 | 944 | |
| 955 | 945 | try self.sortSections(); |
| 956 | | try self.addRpathLCs(rpaths.items); |
| 957 | | try self.addLoadDylibLCs(); |
| 958 | | try self.addDataInCodeLC(); |
| 959 | | try self.addCodeSignatureLC(); |
| 960 | 946 | try self.allocateTextSegment(); |
| 961 | 947 | try self.allocateDataConstSegment(); |
| 962 | 948 | try self.allocateDataSegment(); |