| ... | @@ -2967,60 +2967,16 @@ pub fn writeCodeSignature(self: *MachO, code_sig: *CodeSignature) !void { | ... | @@ -2967,60 +2967,16 @@ pub fn writeCodeSignature(self: *MachO, code_sig: *CodeSignature) !void { |
| 2967 | try self.base.file.?.pwriteAll(buffer.items, offset); | 2967 | try self.base.file.?.pwriteAll(buffer.items, offset); |
| 2968 | } | 2968 | } |
| 2969 | | 2969 | |
| 2970 | fn shrinkAtom(self: *MachO, atom_index: Atom.Index, new_block_size: u64) void { | | |
| 2971 | _ = self; | | |
| 2972 | _ = atom_index; | | |
| 2973 | _ = new_block_size; | | |
| 2974 | // TODO check the new capacity, and if it crosses the size threshold into a big enough | | |
| 2975 | // capacity, insert a free list node for it. | | |
| 2976 | } | | |
| 2977 | | | |
| 2978 | fn growAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignment: Alignment) !u64 { | | |
| 2979 | _ = self; | | |
| 2980 | _ = atom_index; | | |
| 2981 | _ = new_atom_size; | | |
| 2982 | _ = alignment; | | |
| 2983 | @panic("TODO growAtom"); | | |
| 2984 | } | | |
| 2985 | | | |
| 2986 | pub fn updateFunc(self: *MachO, mod: *Module, func_index: InternPool.Index, air: Air, liveness: Liveness) !void { | 2970 | pub fn updateFunc(self: *MachO, mod: *Module, func_index: InternPool.Index, air: Air, liveness: Liveness) !void { |
| 2987 | if (build_options.skip_non_native and builtin.object_format != .macho) { | 2971 | if (build_options.skip_non_native and builtin.object_format != .macho) { |
| 2988 | @panic("Attempted to compile for object format that was disabled by build configuration"); | 2972 | @panic("Attempted to compile for object format that was disabled by build configuration"); |
| 2989 | } | 2973 | } |
| 2990 | if (self.llvm_object) |llvm_object| return llvm_object.updateFunc(mod, func_index, air, liveness); | 2974 | if (self.llvm_object) |llvm_object| return llvm_object.updateFunc(mod, func_index, air, liveness); |
| 2991 | | 2975 | return self.getZigObject().?.updateFunc(self, mod, func_index, air, liveness); |
| 2992 | @panic("TODO updateFunc"); | | |
| 2993 | } | 2976 | } |
| 2994 | | 2977 | |
| 2995 | pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: InternPool.DeclIndex) !u32 { | 2978 | pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: InternPool.DeclIndex) !u32 { |
| 2996 | _ = self; | 2979 | return self.getZigObject().?.lowerUnnamedConst(self, typed_value, decl_index); |
| 2997 | _ = typed_value; | | |
| 2998 | _ = decl_index; | | |
| 2999 | | | |
| 3000 | @panic("TODO lowerUnnamedConst"); | | |
| 3001 | } | | |
| 3002 | | | |
| 3003 | const LowerConstResult = union(enum) { | | |
| 3004 | ok: Atom.Index, | | |
| 3005 | fail: *Module.ErrorMsg, | | |
| 3006 | }; | | |
| 3007 | | | |
| 3008 | fn lowerConst( | | |
| 3009 | self: *MachO, | | |
| 3010 | name: []const u8, | | |
| 3011 | tv: TypedValue, | | |
| 3012 | required_alignment: InternPool.Alignment, | | |
| 3013 | sect_id: u8, | | |
| 3014 | src_loc: Module.SrcLoc, | | |
| 3015 | ) !LowerConstResult { | | |
| 3016 | _ = self; | | |
| 3017 | _ = name; | | |
| 3018 | _ = tv; | | |
| 3019 | _ = required_alignment; | | |
| 3020 | _ = sect_id; | | |
| 3021 | _ = src_loc; | | |
| 3022 | | | |
| 3023 | @panic("TODO lowerConst"); | | |
| 3024 | } | 2980 | } |
| 3025 | | 2981 | |
| 3026 | pub fn updateDecl(self: *MachO, mod: *Module, decl_index: InternPool.DeclIndex) !void { | 2982 | pub fn updateDecl(self: *MachO, mod: *Module, decl_index: InternPool.DeclIndex) !void { |
| ... | @@ -3028,55 +2984,12 @@ pub fn updateDecl(self: *MachO, mod: *Module, decl_index: InternPool.DeclIndex) | ... | @@ -3028,55 +2984,12 @@ pub fn updateDecl(self: *MachO, mod: *Module, decl_index: InternPool.DeclIndex) |
| 3028 | @panic("Attempted to compile for object format that was disabled by build configuration"); | 2984 | @panic("Attempted to compile for object format that was disabled by build configuration"); |
| 3029 | } | 2985 | } |
| 3030 | if (self.llvm_object) |llvm_object| return llvm_object.updateDecl(mod, decl_index); | 2986 | if (self.llvm_object) |llvm_object| return llvm_object.updateDecl(mod, decl_index); |
| 3031 | | 2987 | return self.getZigObject().?.updateDecl(self, mod, decl_index); |
| 3032 | const tracy = trace(@src()); | | |
| 3033 | defer tracy.end(); | | |
| 3034 | | | |
| 3035 | @panic("TODO updateDecl"); | | |
| 3036 | } | | |
| 3037 | | | |
| 3038 | fn updateLazySymbolAtom( | | |
| 3039 | self: *MachO, | | |
| 3040 | sym: link.File.LazySymbol, | | |
| 3041 | atom_index: Atom.Index, | | |
| 3042 | section_index: u8, | | |
| 3043 | ) !void { | | |
| 3044 | _ = self; | | |
| 3045 | _ = sym; | | |
| 3046 | _ = atom_index; | | |
| 3047 | _ = section_index; | | |
| 3048 | @panic("TODO updateLazySymbolAtom"); | | |
| 3049 | } | | |
| 3050 | | | |
| 3051 | pub fn getOrCreateAtomForLazySymbol(self: *MachO, sym: link.File.LazySymbol) !Atom.Index { | | |
| 3052 | _ = self; | | |
| 3053 | _ = sym; | | |
| 3054 | @panic("TODO getOrCreateAtomForLazySymbol"); | | |
| 3055 | } | | |
| 3056 | | | |
| 3057 | pub fn getOrCreateAtomForDecl(self: *MachO, decl_index: InternPool.DeclIndex) !Atom.Index { | | |
| 3058 | _ = self; | | |
| 3059 | _ = decl_index; | | |
| 3060 | @panic("TODO getOrCreateAtomForDecl"); | | |
| 3061 | } | | |
| 3062 | | | |
| 3063 | fn getDeclOutputSection(self: *MachO, decl_index: InternPool.DeclIndex) u8 { | | |
| 3064 | _ = self; | | |
| 3065 | _ = decl_index; | | |
| 3066 | @panic("TODO getDeclOutputSection"); | | |
| 3067 | } | | |
| 3068 | | | |
| 3069 | fn updateDeclCode(self: *MachO, decl_index: InternPool.DeclIndex, code: []u8) !u64 { | | |
| 3070 | _ = self; | | |
| 3071 | _ = decl_index; | | |
| 3072 | _ = code; | | |
| 3073 | @panic("TODO updateDeclCode"); | | |
| 3074 | } | 2988 | } |
| 3075 | | 2989 | |
| 3076 | pub fn updateDeclLineNumber(self: *MachO, module: *Module, decl_index: InternPool.DeclIndex) !void { | 2990 | pub fn updateDeclLineNumber(self: *MachO, module: *Module, decl_index: InternPool.DeclIndex) !void { |
| 3077 | if (self.d_sym) |*d_sym| { | 2991 | if (self.llvm_object) |_| return; |
| 3078 | try d_sym.dwarf.updateDeclLineNumber(module, decl_index); | 2992 | return self.getZigObject().?.updateDeclLineNumber(module, decl_index); |
| 3079 | } | | |
| 3080 | } | 2993 | } |
| 3081 | | 2994 | |
| 3082 | pub fn updateExports( | 2995 | pub fn updateExports( |
| ... | @@ -3088,10 +3001,8 @@ pub fn updateExports( | ... | @@ -3088,10 +3001,8 @@ pub fn updateExports( |
| 3088 | if (build_options.skip_non_native and builtin.object_format != .macho) { | 3001 | if (build_options.skip_non_native and builtin.object_format != .macho) { |
| 3089 | @panic("Attempted to compile for object format that was disabled by build configuration"); | 3002 | @panic("Attempted to compile for object format that was disabled by build configuration"); |
| 3090 | } | 3003 | } |
| 3091 | if (self.llvm_object) |llvm_object| | 3004 | if (self.llvm_object) |llvm_object| return llvm_object.updateExports(mod, exported, exports); |
| 3092 | return llvm_object.updateExports(mod, exported, exports); | 3005 | return self.getZigObject().?.updateExports(self, mod, exported, exports); |
| 3093 | | | |
| 3094 | @panic("TODO updateExports"); | | |
| 3095 | } | 3006 | } |
| 3096 | | 3007 | |
| 3097 | pub fn deleteDeclExport( | 3008 | pub fn deleteDeclExport( |
| ... | @@ -3100,20 +3011,12 @@ pub fn deleteDeclExport( | ... | @@ -3100,20 +3011,12 @@ pub fn deleteDeclExport( |
| 3100 | name: InternPool.NullTerminatedString, | 3011 | name: InternPool.NullTerminatedString, |
| 3101 | ) Allocator.Error!void { | 3012 | ) Allocator.Error!void { |
| 3102 | if (self.llvm_object) |_| return; | 3013 | if (self.llvm_object) |_| return; |
| 3103 | _ = decl_index; | 3014 | return self.getZigObject().?.deleteDeclExport(self, decl_index, name); |
| 3104 | _ = name; | | |
| 3105 | @panic("TODO deleteDeclExport"); | | |
| 3106 | } | | |
| 3107 | | | |
| 3108 | fn freeUnnamedConsts(self: *MachO, decl_index: InternPool.DeclIndex) void { | | |
| 3109 | _ = self; | | |
| 3110 | _ = decl_index; | | |
| 3111 | @panic("TODO freeUnnamedConst"); | | |
| 3112 | } | 3015 | } |
| 3113 | | 3016 | |
| 3114 | pub fn freeDecl(self: *MachO, decl_index: InternPool.DeclIndex) void { | 3017 | pub fn freeDecl(self: *MachO, decl_index: InternPool.DeclIndex) void { |
| 3115 | if (self.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index); | 3018 | if (self.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index); |
| 3116 | @panic("TODO freeDecl"); | 3019 | return self.getZigObject().?.freeDecl(decl_index); |
| 3117 | } | 3020 | } |
| 3118 | | 3021 | |
| 3119 | pub fn getDeclVAddr(self: *MachO, decl_index: InternPool.DeclIndex, reloc_info: link.File.RelocInfo) !u64 { | 3022 | pub fn getDeclVAddr(self: *MachO, decl_index: InternPool.DeclIndex, reloc_info: link.File.RelocInfo) !u64 { |
| ... | @@ -3127,25 +3030,16 @@ pub fn lowerAnonDecl( | ... | @@ -3127,25 +3030,16 @@ pub fn lowerAnonDecl( |
| 3127 | explicit_alignment: InternPool.Alignment, | 3030 | explicit_alignment: InternPool.Alignment, |
| 3128 | src_loc: Module.SrcLoc, | 3031 | src_loc: Module.SrcLoc, |
| 3129 | ) !codegen.Result { | 3032 | ) !codegen.Result { |
| 3130 | _ = self; | 3033 | return self.getZigObject().?.lowerAnonDecl(self, decl_val, explicit_alignment, src_loc); |
| 3131 | _ = decl_val; | | |
| 3132 | _ = explicit_alignment; | | |
| 3133 | _ = src_loc; | | |
| 3134 | @panic("TODO lowerAnonDecl"); | | |
| 3135 | } | 3034 | } |
| 3136 | | 3035 | |
| 3137 | pub fn getAnonDeclVAddr(self: *MachO, decl_val: InternPool.Index, reloc_info: link.File.RelocInfo) !u64 { | 3036 | pub fn getAnonDeclVAddr(self: *MachO, decl_val: InternPool.Index, reloc_info: link.File.RelocInfo) !u64 { |
| 3138 | assert(self.llvm_object == null); | 3037 | assert(self.llvm_object == null); |
| 3139 | _ = decl_val; | 3038 | return self.getZigObject().?.getAnonDeclVAddr(self, decl_val, reloc_info); |
| 3140 | _ = reloc_info; | | |
| 3141 | @panic("TODO getAnonDeclVAddr"); | | |
| 3142 | } | 3039 | } |
| 3143 | | 3040 | |
| 3144 | pub fn getGlobalSymbol(self: *MachO, name: []const u8, lib_name: ?[]const u8) !u32 { | 3041 | pub fn getGlobalSymbol(self: *MachO, name: []const u8, lib_name: ?[]const u8) !u32 { |
| 3145 | _ = self; | 3042 | return self.getZigObject().?.getGlobalSymbol(self, name, lib_name); |
| 3146 | _ = name; | | |
| 3147 | _ = lib_name; | | |
| 3148 | @panic("TODO getGlobalSymbol"); | | |
| 3149 | } | 3043 | } |
| 3150 | | 3044 | |
| 3151 | pub fn padToIdeal(actual_size: anytype) @TypeOf(actual_size) { | 3045 | pub fn padToIdeal(actual_size: anytype) @TypeOf(actual_size) { |