authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-12-06 10:45:14+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-12-06 22:25:44+01:00
log79316ee10bcee1dcc6ed966fd405699ce51155d4
tree8d1067d5157b2e23703c3e7ee02f57a14754e1df
parent559e216f3fd86329c29e9f8ff70e0d00b1e903b9

lib/std/macho: add missing LC defs and missing N_NO_DEAD_STRIP desc for nlists


1 files changed, 27 insertions(+), 12 deletions(-)

lib/std/macho.zig+27-12
......@@ -843,15 +843,15 @@ pub const nlist_64 = extern struct {
843843 n_value: u64,
844844
845845 pub fn stab(sym: nlist_64) bool {
846 return (N_STAB & sym.n_type) != 0;
846 return N_STAB & sym.n_type != 0;
847847 }
848848
849849 pub fn pext(sym: nlist_64) bool {
850 return (N_PEXT & sym.n_type) != 0;
850 return N_PEXT & sym.n_type != 0;
851851 }
852852
853853 pub fn ext(sym: nlist_64) bool {
854 return (N_EXT & sym.n_type) != 0;
854 return N_EXT & sym.n_type != 0;
855855 }
856856
857857 pub fn sect(sym: nlist_64) bool {
......@@ -875,15 +875,19 @@ pub const nlist_64 = extern struct {
875875 }
876876
877877 pub fn weakDef(sym: nlist_64) bool {
878 return (sym.n_desc & N_WEAK_DEF) != 0;
878 return sym.n_desc & N_WEAK_DEF != 0;
879879 }
880880
881881 pub fn weakRef(sym: nlist_64) bool {
882 return (sym.n_desc & N_WEAK_REF) != 0;
882 return sym.n_desc & N_WEAK_REF != 0;
883883 }
884884
885885 pub fn discarded(sym: nlist_64) bool {
886 return (sym.n_desc & N_DESC_DISCARDED) != 0;
886 return sym.n_desc & N_DESC_DISCARDED != 0;
887 }
888
889 pub fn noDeadStrip(sym: nlist_64) bool {
890 return sym.n_desc & N_NO_DEAD_STRIP != 0;
887891 }
888892
889893 pub fn tentative(sym: nlist_64) bool {
......@@ -1002,7 +1006,7 @@ pub const LC = enum(u32) {
10021006
10031007 /// load a dynamically linked shared library that is allowed to be missing
10041008 /// (all symbols are weak imported).
1005 LOAD_WEAK_DYLIB = (0x18 | LC_REQ_DYLD),
1009 LOAD_WEAK_DYLIB = 0x18 | LC_REQ_DYLD,
10061010
10071011 /// 64-bit segment of this file to be mapped
10081012 SEGMENT_64 = 0x19,
......@@ -1014,7 +1018,7 @@ pub const LC = enum(u32) {
10141018 UUID = 0x1b,
10151019
10161020 /// runpath additions
1017 RPATH = (0x1c | LC_REQ_DYLD),
1021 RPATH = 0x1c | LC_REQ_DYLD,
10181022
10191023 /// local of code signature
10201024 CODE_SIGNATURE = 0x1d,
......@@ -1023,7 +1027,7 @@ pub const LC = enum(u32) {
10231027 SEGMENT_SPLIT_INFO = 0x1e,
10241028
10251029 /// load and re-export dylib
1026 REEXPORT_DYLIB = (0x1f | LC_REQ_DYLD),
1030 REEXPORT_DYLIB = 0x1f | LC_REQ_DYLD,
10271031
10281032 /// delay load of dylib until first use
10291033 LAZY_LOAD_DYLIB = 0x20,
......@@ -1035,10 +1039,10 @@ pub const LC = enum(u32) {
10351039 DYLD_INFO = 0x22,
10361040
10371041 /// compressed dyld information only
1038 DYLD_INFO_ONLY = (0x22 | LC_REQ_DYLD),
1042 DYLD_INFO_ONLY = 0x22 | LC_REQ_DYLD,
10391043
10401044 /// load upward dylib
1041 LOAD_UPWARD_DYLIB = (0x23 | LC_REQ_DYLD),
1045 LOAD_UPWARD_DYLIB = 0x23 | LC_REQ_DYLD,
10421046
10431047 /// build for MacOSX min OS version
10441048 VERSION_MIN_MACOSX = 0x24,
......@@ -1053,7 +1057,7 @@ pub const LC = enum(u32) {
10531057 DYLD_ENVIRONMENT = 0x27,
10541058
10551059 /// replacement for LC_UNIXTHREAD
1056 MAIN = (0x28 | LC_REQ_DYLD),
1060 MAIN = 0x28 | LC_REQ_DYLD,
10571061
10581062 /// table of non-instructions in __text
10591063 DATA_IN_CODE = 0x29,
......@@ -1085,6 +1089,12 @@ pub const LC = enum(u32) {
10851089 /// build for platform min OS version
10861090 BUILD_VERSION = 0x32,
10871091
1092 /// used with linkedit_data_command, payload is trie
1093 DYLD_EXPORTS_TRIE = 0x33 | LC_REQ_DYLD,
1094
1095 /// used with linkedit_data_command
1096 DYLD_CHAINED_FIXUPS = 0x34 | LC_REQ_DYLD,
1097
10881098 _,
10891099};
10901100
......@@ -1629,6 +1639,11 @@ pub const REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY: u16 = 5;
16291639/// to avoid removing symbols that must exist: If the symbol has this bit set, strip does not strip it.
16301640pub const REFERENCED_DYNAMICALLY: u16 = 0x10;
16311641
1642/// The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a
1643/// relocatable .o file (MH_OBJECT filetype). And is used to indicate to the
1644/// static link editor it is never to dead strip the symbol.
1645pub const N_NO_DEAD_STRIP: u16 = 0x20;
1646
16321647/// Used by the dynamic linker at runtime. Do not set this bit.
16331648pub const N_DESC_DISCARDED: u16 = 0x20;
16341649