diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-08-01 12:28:58 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-08-03 21:19:41 +0200 |
| commit | bb532584bc569edb563b757c658fd743731837ec (patch) | |
| tree | aa0c1356909f0be2431e5420b0e84ca5ae89e5ad /lib/std | |
| parent | f26d5ee7ea97c8fd6e5b2655f845be7e4293930e (diff) | |
| download | zig-bb532584bc569edb563b757c658fd743731837ec.tar.gz zig-bb532584bc569edb563b757c658fd743731837ec.zip | |
macho: update how we insert output sections
Instead of generating sections upfront, allow generation by scanning
the object files for input -> output sections mapping. Next, always
strive to keep output sections in the final container sorted as they
appear in the final binary. This makes the linker less messy wrt
handling of output sections sort order for dyld/macOS not to complain.
There's still more work to be done for incremental context though
to make this work but looks promising already.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/macho.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/std/macho.zig b/lib/std/macho.zig index 9334f79dc5..aa43229a76 100644 --- a/lib/std/macho.zig +++ b/lib/std/macho.zig @@ -780,7 +780,7 @@ pub const section_64 = extern struct { return parseName(§.segname); } - pub fn type_(sect: section_64) u8 { + pub fn @"type"(sect: section_64) u8 { return @truncate(u8, sect.flags & 0xff); } @@ -793,6 +793,11 @@ pub const section_64 = extern struct { return attr & S_ATTR_PURE_INSTRUCTIONS != 0 or attr & S_ATTR_SOME_INSTRUCTIONS != 0; } + pub fn isZerofill(sect: section_64) bool { + const tt = sect.@"type"(); + return tt == S_ZEROFILL or tt == S_GB_ZEROFILL or tt == S_THREAD_LOCAL_ZEROFILL; + } + pub fn isDebug(sect: section_64) bool { return sect.attrs() & S_ATTR_DEBUG != 0; } |
