| ... | ... | @@ -3340,36 +3340,19 @@ fn collectExportData(self: *MachO, trie: *Trie) !void { |
| 3340 | 3340 | const exec_segment = self.segments.items[self.header_segment_cmd_index.?]; |
| 3341 | 3341 | const base_address = exec_segment.vmaddr; |
| 3342 | 3342 | |
| 3343 | | if (self.base.options.output_mode == .Exe) { |
| 3344 | | for (&[_]SymbolWithLoc{ |
| 3345 | | try self.getEntryPoint(), |
| 3346 | | self.getGlobal("__mh_execute_header").?, |
| 3347 | | }) |global| { |
| 3348 | | const sym = self.getSymbol(global); |
| 3349 | | const sym_name = self.getSymbolName(global); |
| 3350 | | log.debug(" (putting '{s}' defined at 0x{x})", .{ sym_name, sym.n_value }); |
| 3351 | | try trie.put(gpa, .{ |
| 3352 | | .name = sym_name, |
| 3353 | | .vmaddr_offset = sym.n_value - base_address, |
| 3354 | | .export_flags = macho.EXPORT_SYMBOL_FLAGS_KIND_REGULAR, |
| 3355 | | }); |
| 3356 | | } |
| 3357 | | } else { |
| 3358 | | assert(self.base.options.output_mode == .Lib); |
| 3359 | | for (self.globals.items) |global| { |
| 3360 | | const sym = self.getSymbol(global); |
| 3343 | for (self.globals.items) |global| { |
| 3344 | const sym = self.getSymbol(global); |
| 3361 | 3345 | |
| 3362 | | if (sym.undf()) continue; |
| 3363 | | if (!sym.ext()) continue; |
| 3346 | if (sym.undf()) continue; |
| 3347 | if (!sym.ext()) continue; |
| 3364 | 3348 | |
| 3365 | | const sym_name = self.getSymbolName(global); |
| 3366 | | log.debug(" (putting '{s}' defined at 0x{x})", .{ sym_name, sym.n_value }); |
| 3367 | | try trie.put(gpa, .{ |
| 3368 | | .name = sym_name, |
| 3369 | | .vmaddr_offset = sym.n_value - base_address, |
| 3370 | | .export_flags = macho.EXPORT_SYMBOL_FLAGS_KIND_REGULAR, |
| 3371 | | }); |
| 3372 | | } |
| 3349 | const sym_name = self.getSymbolName(global); |
| 3350 | log.debug(" (putting '{s}' defined at 0x{x})", .{ sym_name, sym.n_value }); |
| 3351 | try trie.put(gpa, .{ |
| 3352 | .name = sym_name, |
| 3353 | .vmaddr_offset = sym.n_value - base_address, |
| 3354 | .export_flags = macho.EXPORT_SYMBOL_FLAGS_KIND_REGULAR, |
| 3355 | }); |
| 3373 | 3356 | } |
| 3374 | 3357 | |
| 3375 | 3358 | try trie.finalize(gpa); |