| ... | ... | @@ -1141,7 +1141,7 @@ pub fn updateFunc(self: *Coff, pt: Zcu.PerThread, func_index: InternPool.Index, |
| 1141 | 1141 | |
| 1142 | 1142 | const LowerConstResult = union(enum) { |
| 1143 | 1143 | ok: Atom.Index, |
| 1144 | | fail: *Module.ErrorMsg, |
| 1144 | fail: *Zcu.ErrorMsg, |
| 1145 | 1145 | }; |
| 1146 | 1146 | |
| 1147 | 1147 | fn lowerConst( |
| ... | ... | @@ -1151,7 +1151,7 @@ fn lowerConst( |
| 1151 | 1151 | val: Value, |
| 1152 | 1152 | required_alignment: InternPool.Alignment, |
| 1153 | 1153 | sect_id: u16, |
| 1154 | | src_loc: Module.LazySrcLoc, |
| 1154 | src_loc: Zcu.LazySrcLoc, |
| 1155 | 1155 | ) !LowerConstResult { |
| 1156 | 1156 | const gpa = self.base.comp.gpa; |
| 1157 | 1157 | |
| ... | ... | @@ -1462,15 +1462,15 @@ pub fn freeNav(self: *Coff, nav_index: InternPool.NavIndex) void { |
| 1462 | 1462 | pub fn updateExports( |
| 1463 | 1463 | self: *Coff, |
| 1464 | 1464 | pt: Zcu.PerThread, |
| 1465 | | exported: Module.Exported, |
| 1465 | exported: Zcu.Exported, |
| 1466 | 1466 | export_indices: []const u32, |
| 1467 | 1467 | ) link.File.UpdateExportsError!void { |
| 1468 | 1468 | if (build_options.skip_non_native and builtin.object_format != .coff) { |
| 1469 | 1469 | @panic("Attempted to compile for object format that was disabled by build configuration"); |
| 1470 | 1470 | } |
| 1471 | 1471 | |
| 1472 | | const mod = pt.zcu; |
| 1473 | | const ip = &mod.intern_pool; |
| 1472 | const zcu = pt.zcu; |
| 1473 | const ip = &zcu.intern_pool; |
| 1474 | 1474 | const comp = self.base.comp; |
| 1475 | 1475 | const target = comp.root_mod.resolved_target.result; |
| 1476 | 1476 | |
| ... | ... | @@ -1478,7 +1478,7 @@ pub fn updateExports( |
| 1478 | 1478 | // Even in the case of LLVM, we need to notice certain exported symbols in order to |
| 1479 | 1479 | // detect the default subsystem. |
| 1480 | 1480 | for (export_indices) |export_idx| { |
| 1481 | | const exp = mod.all_exports.items[export_idx]; |
| 1481 | const exp = zcu.all_exports.items[export_idx]; |
| 1482 | 1482 | const exported_nav_index = switch (exp.exported) { |
| 1483 | 1483 | .nav => |nav| nav, |
| 1484 | 1484 | .uav => continue, |
| ... | ... | @@ -1490,20 +1490,20 @@ pub fn updateExports( |
| 1490 | 1490 | .x86 => .Stdcall, |
| 1491 | 1491 | else => .C, |
| 1492 | 1492 | }; |
| 1493 | | const exported_cc = Type.fromInterned(exported_ty).fnCallingConvention(mod); |
| 1493 | const exported_cc = Type.fromInterned(exported_ty).fnCallingConvention(zcu); |
| 1494 | 1494 | if (exported_cc == .C and exp.opts.name.eqlSlice("main", ip) and comp.config.link_libc) { |
| 1495 | | mod.stage1_flags.have_c_main = true; |
| 1495 | zcu.stage1_flags.have_c_main = true; |
| 1496 | 1496 | } else if (exported_cc == winapi_cc and target.os.tag == .windows) { |
| 1497 | 1497 | if (exp.opts.name.eqlSlice("WinMain", ip)) { |
| 1498 | | mod.stage1_flags.have_winmain = true; |
| 1498 | zcu.stage1_flags.have_winmain = true; |
| 1499 | 1499 | } else if (exp.opts.name.eqlSlice("wWinMain", ip)) { |
| 1500 | | mod.stage1_flags.have_wwinmain = true; |
| 1500 | zcu.stage1_flags.have_wwinmain = true; |
| 1501 | 1501 | } else if (exp.opts.name.eqlSlice("WinMainCRTStartup", ip)) { |
| 1502 | | mod.stage1_flags.have_winmain_crt_startup = true; |
| 1502 | zcu.stage1_flags.have_winmain_crt_startup = true; |
| 1503 | 1503 | } else if (exp.opts.name.eqlSlice("wWinMainCRTStartup", ip)) { |
| 1504 | | mod.stage1_flags.have_wwinmain_crt_startup = true; |
| 1504 | zcu.stage1_flags.have_wwinmain_crt_startup = true; |
| 1505 | 1505 | } else if (exp.opts.name.eqlSlice("DllMainCRTStartup", ip)) { |
| 1506 | | mod.stage1_flags.have_dllmain_crt_startup = true; |
| 1506 | zcu.stage1_flags.have_dllmain_crt_startup = true; |
| 1507 | 1507 | } |
| 1508 | 1508 | } |
| 1509 | 1509 | } |
| ... | ... | @@ -1519,15 +1519,15 @@ pub fn updateExports( |
| 1519 | 1519 | break :blk self.navs.getPtr(nav).?; |
| 1520 | 1520 | }, |
| 1521 | 1521 | .uav => |uav| self.uavs.getPtr(uav) orelse blk: { |
| 1522 | | const first_exp = mod.all_exports.items[export_indices[0]]; |
| 1522 | const first_exp = zcu.all_exports.items[export_indices[0]]; |
| 1523 | 1523 | const res = try self.lowerUav(pt, uav, .none, first_exp.src); |
| 1524 | 1524 | switch (res) { |
| 1525 | 1525 | .mcv => {}, |
| 1526 | 1526 | .fail => |em| { |
| 1527 | 1527 | // TODO maybe it's enough to return an error here and let Module.processExportsInner |
| 1528 | 1528 | // handle the error? |
| 1529 | | try mod.failed_exports.ensureUnusedCapacity(mod.gpa, 1); |
| 1530 | | mod.failed_exports.putAssumeCapacityNoClobber(export_indices[0], em); |
| 1529 | try zcu.failed_exports.ensureUnusedCapacity(zcu.gpa, 1); |
| 1530 | zcu.failed_exports.putAssumeCapacityNoClobber(export_indices[0], em); |
| 1531 | 1531 | return; |
| 1532 | 1532 | }, |
| 1533 | 1533 | } |
| ... | ... | @@ -1538,12 +1538,12 @@ pub fn updateExports( |
| 1538 | 1538 | const atom = self.getAtom(atom_index); |
| 1539 | 1539 | |
| 1540 | 1540 | for (export_indices) |export_idx| { |
| 1541 | | const exp = mod.all_exports.items[export_idx]; |
| 1542 | | log.debug("adding new export '{}'", .{exp.opts.name.fmt(&mod.intern_pool)}); |
| 1541 | const exp = zcu.all_exports.items[export_idx]; |
| 1542 | log.debug("adding new export '{}'", .{exp.opts.name.fmt(&zcu.intern_pool)}); |
| 1543 | 1543 | |
| 1544 | | if (exp.opts.section.toSlice(&mod.intern_pool)) |section_name| { |
| 1544 | if (exp.opts.section.toSlice(&zcu.intern_pool)) |section_name| { |
| 1545 | 1545 | if (!mem.eql(u8, section_name, ".text")) { |
| 1546 | | try mod.failed_exports.putNoClobber(gpa, export_idx, try Module.ErrorMsg.create( |
| 1546 | try zcu.failed_exports.putNoClobber(gpa, export_idx, try Zcu.ErrorMsg.create( |
| 1547 | 1547 | gpa, |
| 1548 | 1548 | exp.src, |
| 1549 | 1549 | "Unimplemented: ExportOptions.section", |
| ... | ... | @@ -1554,7 +1554,7 @@ pub fn updateExports( |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | if (exp.opts.linkage == .link_once) { |
| 1557 | | try mod.failed_exports.putNoClobber(gpa, export_idx, try Module.ErrorMsg.create( |
| 1557 | try zcu.failed_exports.putNoClobber(gpa, export_idx, try Zcu.ErrorMsg.create( |
| 1558 | 1558 | gpa, |
| 1559 | 1559 | exp.src, |
| 1560 | 1560 | "Unimplemented: GlobalLinkage.link_once", |
| ... | ... | @@ -1563,7 +1563,7 @@ pub fn updateExports( |
| 1563 | 1563 | continue; |
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | | const exp_name = exp.opts.name.toSlice(&mod.intern_pool); |
| 1566 | const exp_name = exp.opts.name.toSlice(&zcu.intern_pool); |
| 1567 | 1567 | const sym_index = metadata.getExport(self, exp_name) orelse blk: { |
| 1568 | 1568 | const sym_index = if (self.getGlobalIndex(exp_name)) |global_index| ind: { |
| 1569 | 1569 | const global = self.globals.items[global_index]; |
| ... | ... | @@ -1609,14 +1609,14 @@ pub fn deleteExport( |
| 1609 | 1609 | .nav => |nav| self.navs.getPtr(nav), |
| 1610 | 1610 | .uav => |uav| self.uavs.getPtr(uav), |
| 1611 | 1611 | } orelse return; |
| 1612 | | const mod = self.base.comp.module.?; |
| 1613 | | const name_slice = name.toSlice(&mod.intern_pool); |
| 1612 | const zcu = self.base.comp.module.?; |
| 1613 | const name_slice = name.toSlice(&zcu.intern_pool); |
| 1614 | 1614 | const sym_index = metadata.getExportPtr(self, name_slice) orelse return; |
| 1615 | 1615 | |
| 1616 | 1616 | const gpa = self.base.comp.gpa; |
| 1617 | 1617 | const sym_loc = SymbolWithLoc{ .sym_index = sym_index.*, .file = null }; |
| 1618 | 1618 | const sym = self.getSymbolPtr(sym_loc); |
| 1619 | | log.debug("deleting export '{}'", .{name.fmt(&mod.intern_pool)}); |
| 1619 | log.debug("deleting export '{}'", .{name.fmt(&zcu.intern_pool)}); |
| 1620 | 1620 | assert(sym.storage_class == .EXTERNAL and sym.section_number != .UNDEFINED); |
| 1621 | 1621 | sym.* = .{ |
| 1622 | 1622 | .name = [_]u8{0} ** 8, |
| ... | ... | @@ -1843,7 +1843,7 @@ pub fn lowerUav( |
| 1843 | 1843 | pt: Zcu.PerThread, |
| 1844 | 1844 | uav: InternPool.Index, |
| 1845 | 1845 | explicit_alignment: InternPool.Alignment, |
| 1846 | | src_loc: Module.LazySrcLoc, |
| 1846 | src_loc: Zcu.LazySrcLoc, |
| 1847 | 1847 | ) !codegen.GenResult { |
| 1848 | 1848 | const zcu = pt.zcu; |
| 1849 | 1849 | const gpa = zcu.gpa; |
| ... | ... | @@ -1872,7 +1872,7 @@ pub fn lowerUav( |
| 1872 | 1872 | src_loc, |
| 1873 | 1873 | ) catch |err| switch (err) { |
| 1874 | 1874 | error.OutOfMemory => return error.OutOfMemory, |
| 1875 | | else => |e| return .{ .fail = try Module.ErrorMsg.create( |
| 1875 | else => |e| return .{ .fail = try Zcu.ErrorMsg.create( |
| 1876 | 1876 | gpa, |
| 1877 | 1877 | src_loc, |
| 1878 | 1878 | "lowerAnonDecl failed with error: {s}", |
| ... | ... | @@ -2730,8 +2730,6 @@ const ImportTable = @import("Coff/ImportTable.zig"); |
| 2730 | 2730 | const Liveness = @import("../Liveness.zig"); |
| 2731 | 2731 | const LlvmObject = @import("../codegen/llvm.zig").Object; |
| 2732 | 2732 | const Zcu = @import("../Zcu.zig"); |
| 2733 | | /// Deprecated. |
| 2734 | | const Module = Zcu; |
| 2735 | 2733 | const InternPool = @import("../InternPool.zig"); |
| 2736 | 2734 | const Object = @import("Coff/Object.zig"); |
| 2737 | 2735 | const Relocation = @import("Coff/Relocation.zig"); |