diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-06-11 16:52:17 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-06-11 16:52:22 +0200 |
| commit | b93fd4bb73506a8feb0b4c312c1afbf88cc9248d (patch) | |
| tree | f512539ec804f7bfd23588f8bf50606a760a1454 /src | |
| parent | 961d556570e19c2fca1ba5ad1aadd843f012b7ed (diff) | |
| download | zig-b93fd4bb73506a8feb0b4c312c1afbf88cc9248d.tar.gz zig-b93fd4bb73506a8feb0b4c312c1afbf88cc9248d.zip | |
zld: match all __DATA sections as __data except __const
Examples of such sections include:
* in Go, you will get `__DATA,__noptrdata` or `__DATA,__go_buildinfo`
which should be mapped to `__DATA,__data`
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO/Zld.zig | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/link/MachO/Zld.zig b/src/link/MachO/Zld.zig index e9ed34fce6..225f14fc4e 100644 --- a/src/link/MachO/Zld.zig +++ b/src/link/MachO/Zld.zig @@ -857,24 +857,23 @@ fn getMatchingSection(self: *Zld, section: macho.section_64) ?MatchingSection { .seg = self.text_segment_cmd_index.?, .sect = self.ustring_section_index.?, }; - } else { - break :blk .{ - .seg = self.text_segment_cmd_index.?, - .sect = self.text_const_section_index.?, - }; } - } else if (mem.eql(u8, segname, "__DATA")) { - if (mem.eql(u8, sectname, "__data")) { - break :blk .{ - .seg = self.data_segment_cmd_index.?, - .sect = self.data_section_index.?, - }; - } else if (mem.eql(u8, sectname, "__const")) { + break :blk .{ + .seg = self.text_segment_cmd_index.?, + .sect = self.text_const_section_index.?, + }; + } + if (mem.eql(u8, segname, "__DATA")) { + if (mem.eql(u8, sectname, "__const")) { break :blk .{ .seg = self.data_const_segment_cmd_index.?, .sect = self.data_const_section_index.?, }; } + break :blk .{ + .seg = self.data_segment_cmd_index.?, + .sect = self.data_section_index.?, + }; } break :blk null; }, |
