| ... | ... | @@ -3117,6 +3117,10 @@ fn resolveSymbolsInDylibs(self: *MachO) !void { |
| 3117 | 3117 | undef.n_type |= macho.N_EXT; |
| 3118 | 3118 | undef.n_desc = @intCast(u16, ordinal + 1) * macho.N_SYMBOL_RESOLVER; |
| 3119 | 3119 | |
| 3120 | if (dylib.weak) { |
| 3121 | undef.n_desc |= macho.N_WEAK_REF; |
| 3122 | } |
| 3123 | |
| 3120 | 3124 | if (self.unresolved.fetchSwapRemove(resolv.where_index)) |entry| outer_blk: { |
| 3121 | 3125 | switch (entry.value) { |
| 3122 | 3126 | .none => {}, |
| ... | ... | @@ -5806,11 +5810,16 @@ fn writeDyldInfoData(self: *MachO) !void { |
| 5806 | 5810 | }, |
| 5807 | 5811 | .undef => { |
| 5808 | 5812 | const bind_sym = self.undefs.items[resolv.where_index]; |
| 5813 | var flags: u4 = 0; |
| 5814 | if (bind_sym.weakRef()) { |
| 5815 | flags |= @truncate(u4, macho.BIND_SYMBOL_FLAGS_WEAK_IMPORT); |
| 5816 | } |
| 5809 | 5817 | try bind_pointers.append(.{ |
| 5810 | 5818 | .offset = binding.offset + base_offset, |
| 5811 | 5819 | .segment_id = match.seg, |
| 5812 | | .dylib_ordinal = @divExact(@bitCast(i16, bind_sym.n_desc), macho.N_SYMBOL_RESOLVER), |
| 5820 | .dylib_ordinal = @divTrunc(@bitCast(i16, bind_sym.n_desc), macho.N_SYMBOL_RESOLVER), |
| 5813 | 5821 | .name = self.getString(bind_sym.n_strx), |
| 5822 | .bind_flags = flags, |
| 5814 | 5823 | }); |
| 5815 | 5824 | }, |
| 5816 | 5825 | } |
| ... | ... | @@ -5828,11 +5837,16 @@ fn writeDyldInfoData(self: *MachO) !void { |
| 5828 | 5837 | }, |
| 5829 | 5838 | .undef => { |
| 5830 | 5839 | const bind_sym = self.undefs.items[resolv.where_index]; |
| 5840 | var flags: u4 = 0; |
| 5841 | if (bind_sym.weakRef()) { |
| 5842 | flags |= @truncate(u4, macho.BIND_SYMBOL_FLAGS_WEAK_IMPORT); |
| 5843 | } |
| 5831 | 5844 | try lazy_bind_pointers.append(.{ |
| 5832 | 5845 | .offset = binding.offset + base_offset, |
| 5833 | 5846 | .segment_id = match.seg, |
| 5834 | | .dylib_ordinal = @divExact(@bitCast(i16, bind_sym.n_desc), macho.N_SYMBOL_RESOLVER), |
| 5847 | .dylib_ordinal = @divTrunc(@bitCast(i16, bind_sym.n_desc), macho.N_SYMBOL_RESOLVER), |
| 5835 | 5848 | .name = self.getString(bind_sym.n_strx), |
| 5849 | .bind_flags = flags, |
| 5836 | 5850 | }); |
| 5837 | 5851 | }, |
| 5838 | 5852 | } |