Coff2: create a new linker from scratch

This commit is contained in:
Jacob Young 2025-09-21 23:14:28 -04:00
parent d5f09f56e0
commit e1f3fc6ce2
58 changed files with 3493 additions and 911 deletions

View File

@ -1082,7 +1082,7 @@ pub fn toElfMachine(target: *const Target) std.elf.EM {
}; };
} }
pub fn toCoffMachine(target: *const Target) std.coff.MachineType { pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
return switch (target.cpu.arch) { return switch (target.cpu.arch) {
.arm => .ARM, .arm => .ARM,
.thumb => .ARMNT, .thumb => .ARMNT,
@ -1092,7 +1092,7 @@ pub fn toCoffMachine(target: *const Target) std.coff.MachineType {
.riscv32 => .RISCV32, .riscv32 => .RISCV32,
.riscv64 => .RISCV64, .riscv64 => .RISCV64,
.x86 => .I386, .x86 => .I386,
.x86_64 => .X64, .x86_64 => .AMD64,
.amdgcn, .amdgcn,
.arc, .arc,

View File

@ -50,7 +50,7 @@ pub fn eqlString(a: []const u8, b: []const u8) bool {
} }
pub fn hashString(s: []const u8) u32 { pub fn hashString(s: []const u8) u32 {
return @as(u32, @truncate(std.hash.Wyhash.hash(0, s))); return @truncate(std.hash.Wyhash.hash(0, s));
} }
/// Deprecated in favor of `ArrayHashMapWithAllocator` (no code changes needed) /// Deprecated in favor of `ArrayHashMapWithAllocator` (no code changes needed)

File diff suppressed because it is too large Load Diff

View File

@ -78,13 +78,15 @@ pub fn defaultQueryPageSize() usize {
}; };
var size = global.cached_result.load(.unordered); var size = global.cached_result.load(.unordered);
if (size > 0) return size; if (size > 0) return size;
size = switch (builtin.os.tag) { size = size: switch (builtin.os.tag) {
.linux => if (builtin.link_libc) @intCast(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE))) else std.os.linux.getauxval(std.elf.AT_PAGESZ), .linux => if (builtin.link_libc)
.driverkit, .ios, .macos, .tvos, .visionos, .watchos => blk: { @max(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE)), 0)
else
std.os.linux.getauxval(std.elf.AT_PAGESZ),
.driverkit, .ios, .macos, .tvos, .visionos, .watchos => {
const task_port = std.c.mach_task_self(); const task_port = std.c.mach_task_self();
// mach_task_self may fail "if there are any resource failures or other errors". // mach_task_self may fail "if there are any resource failures or other errors".
if (task_port == std.c.TASK.NULL) if (task_port == std.c.TASK.NULL) break :size 0;
break :blk 0;
var info_count = std.c.TASK.VM.INFO_COUNT; var info_count = std.c.TASK.VM.INFO_COUNT;
var vm_info: std.c.task_vm_info_data_t = undefined; var vm_info: std.c.task_vm_info_data_t = undefined;
vm_info.page_size = 0; vm_info.page_size = 0;
@ -94,21 +96,28 @@ pub fn defaultQueryPageSize() usize {
@as(std.c.task_info_t, @ptrCast(&vm_info)), @as(std.c.task_info_t, @ptrCast(&vm_info)),
&info_count, &info_count,
); );
assert(vm_info.page_size != 0); break :size @intCast(vm_info.page_size);
break :blk @intCast(vm_info.page_size);
}, },
.windows => blk: { .windows => {
var info: std.os.windows.SYSTEM_INFO = undefined; var sbi: windows.SYSTEM_BASIC_INFORMATION = undefined;
std.os.windows.kernel32.GetSystemInfo(&info); switch (windows.ntdll.NtQuerySystemInformation(
break :blk info.dwPageSize; .SystemBasicInformation,
&sbi,
@sizeOf(windows.SYSTEM_BASIC_INFORMATION),
null,
)) {
.SUCCESS => break :size sbi.PageSize,
else => break :size 0,
}
}, },
else => if (builtin.link_libc) else => if (builtin.link_libc)
@intCast(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE))) @max(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE)), 0)
else if (builtin.os.tag == .freestanding or builtin.os.tag == .other) else if (builtin.os.tag == .freestanding or builtin.os.tag == .other)
@compileError("unsupported target: freestanding/other") @compileError("unsupported target: freestanding/other")
else else
@compileError("pageSize on " ++ @tagName(builtin.cpu.arch) ++ "-" ++ @tagName(builtin.os.tag) ++ " is not supported without linking libc, using the default implementation"), @compileError("pageSize on " ++ @tagName(builtin.cpu.arch) ++ "-" ++ @tagName(builtin.os.tag) ++ " is not supported without linking libc, using the default implementation"),
}; };
if (size == 0) size = page_size_max;
assert(size >= page_size_min); assert(size >= page_size_min);
assert(size <= page_size_max); assert(size <= page_size_max);

View File

@ -256,8 +256,8 @@ test_filters: []const []const u8,
link_task_wait_group: WaitGroup = .{}, link_task_wait_group: WaitGroup = .{},
link_prog_node: std.Progress.Node = .none, link_prog_node: std.Progress.Node = .none,
link_uav_prog_node: std.Progress.Node = .none, link_const_prog_node: std.Progress.Node = .none,
link_lazy_prog_node: std.Progress.Node = .none, link_synth_prog_node: std.Progress.Node = .none,
llvm_opt_bisect_limit: c_int, llvm_opt_bisect_limit: c_int,
@ -1982,13 +1982,13 @@ pub fn create(gpa: Allocator, arena: Allocator, diag: *CreateDiagnostic, options
}; };
if (have_zcu and (!need_llvm or use_llvm)) { if (have_zcu and (!need_llvm or use_llvm)) {
if (output_mode == .Obj) break :s .zcu; if (output_mode == .Obj) break :s .zcu;
if (options.config.use_new_linker) break :s .zcu;
switch (target_util.zigBackend(target, use_llvm)) { switch (target_util.zigBackend(target, use_llvm)) {
else => {}, else => {},
.stage2_aarch64, .stage2_x86_64 => if (target.ofmt == .coff) { .stage2_aarch64, .stage2_x86_64 => if (target.ofmt == .coff) {
break :s if (is_exe_or_dyn_lib) .dyn_lib else .zcu; break :s if (is_exe_or_dyn_lib) .dyn_lib else .zcu;
}, },
} }
if (options.config.use_new_linker) break :s .zcu;
} }
if (need_llvm and !build_options.have_llvm) break :s .none; // impossible to build without llvm if (need_llvm and !build_options.have_llvm) break :s .none; // impossible to build without llvm
if (is_exe_or_dyn_lib) break :s .lib; if (is_exe_or_dyn_lib) break :s .lib;
@ -3081,22 +3081,30 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE
comp.link_prog_node = main_progress_node.start("Linking", 0); comp.link_prog_node = main_progress_node.start("Linking", 0);
if (lf.cast(.elf2)) |elf| { if (lf.cast(.elf2)) |elf| {
comp.link_prog_node.increaseEstimatedTotalItems(3); comp.link_prog_node.increaseEstimatedTotalItems(3);
comp.link_uav_prog_node = comp.link_prog_node.start("Constants", 0); comp.link_const_prog_node = comp.link_prog_node.start("Constants", 0);
comp.link_lazy_prog_node = comp.link_prog_node.start("Synthetics", 0); comp.link_synth_prog_node = comp.link_prog_node.start("Synthetics", 0);
elf.mf.update_prog_node = comp.link_prog_node.start("Relocations", elf.mf.updates.items.len); elf.mf.update_prog_node = comp.link_prog_node.start("Relocations", elf.mf.updates.items.len);
} else if (lf.cast(.coff2)) |coff| {
comp.link_prog_node.increaseEstimatedTotalItems(3);
comp.link_const_prog_node = comp.link_prog_node.start("Constants", 0);
comp.link_synth_prog_node = comp.link_prog_node.start("Synthetics", 0);
coff.mf.update_prog_node = comp.link_prog_node.start("Relocations", coff.mf.updates.items.len);
} }
} }
defer { defer {
comp.link_prog_node.end(); comp.link_prog_node.end();
comp.link_prog_node = .none; comp.link_prog_node = .none;
comp.link_uav_prog_node.end(); comp.link_const_prog_node.end();
comp.link_uav_prog_node = .none; comp.link_const_prog_node = .none;
comp.link_lazy_prog_node.end(); comp.link_synth_prog_node.end();
comp.link_lazy_prog_node = .none; comp.link_synth_prog_node = .none;
if (comp.bin_file) |lf| { if (comp.bin_file) |lf| {
if (lf.cast(.elf2)) |elf| { if (lf.cast(.elf2)) |elf| {
elf.mf.update_prog_node.end(); elf.mf.update_prog_node.end();
elf.mf.update_prog_node = .none; elf.mf.update_prog_node = .none;
} else if (lf.cast(.coff2)) |coff| {
coff.mf.update_prog_node.end();
coff.mf.update_prog_node = .none;
} }
} }
} }

View File

@ -438,6 +438,8 @@ pub fn resolve(options: Options) ResolveError!Config {
if (options.use_new_linker) |x| break :b x; if (options.use_new_linker) |x| break :b x;
if (target.ofmt == .coff) break :b true;
break :b options.incremental; break :b options.incremental;
}; };

View File

@ -11919,10 +11919,10 @@ pub fn getString(ip: *InternPool, key: []const u8) OptionalNullTerminatedString
var map_index = hash; var map_index = hash;
while (true) : (map_index += 1) { while (true) : (map_index += 1) {
map_index &= map_mask; map_index &= map_mask;
const entry = map.at(map_index); const entry = &map.entries[map_index];
const index = entry.acquire().unwrap() orelse return null; const index = entry.value.unwrap() orelse return .none;
if (entry.hash != hash) continue; if (entry.hash != hash) continue;
if (index.eqlSlice(key, ip)) return index; if (index.eqlSlice(key, ip)) return index.toOptional();
} }
} }

View File

@ -993,6 +993,8 @@ pub fn genNavRef(
}, },
.link_once => unreachable, .link_once => unreachable,
} }
} else if (lf.cast(.coff2)) |coff| {
return .{ .sym_index = @intFromEnum(try coff.navSymbol(zcu, nav_index)) };
} else { } else {
const msg = try ErrorMsg.create(zcu.gpa, src_loc, "TODO genNavRef for target {}", .{target}); const msg = try ErrorMsg.create(zcu.gpa, src_loc, "TODO genNavRef for target {}", .{target});
return .{ .fail = msg }; return .{ .fail = msg };

View File

@ -89,6 +89,7 @@ pub fn emitMir(emit: *Emit) Error!void {
} }
var reloc_info_buf: [2]RelocInfo = undefined; var reloc_info_buf: [2]RelocInfo = undefined;
var reloc_info_index: usize = 0; var reloc_info_index: usize = 0;
const ip = &emit.pt.zcu.intern_pool;
while (lowered_relocs.len > 0 and while (lowered_relocs.len > 0 and
lowered_relocs[0].lowered_inst_index == lowered_index) : ({ lowered_relocs[0].lowered_inst_index == lowered_index) : ({
lowered_relocs = lowered_relocs[1..]; lowered_relocs = lowered_relocs[1..];
@ -114,7 +115,6 @@ pub fn emitMir(emit: *Emit) Error!void {
return error.EmitFail; return error.EmitFail;
}, },
}; };
const ip = &emit.pt.zcu.intern_pool;
break :target switch (ip.getNav(nav).status) { break :target switch (ip.getNav(nav).status) {
.unresolved => unreachable, .unresolved => unreachable,
.type_resolved => |type_resolved| .{ .type_resolved => |type_resolved| .{
@ -175,6 +175,8 @@ pub fn emitMir(emit: *Emit) Error!void {
coff_file.getAtom(atom).getSymbolIndex().? coff_file.getAtom(atom).getSymbolIndex().?
else |err| else |err|
return emit.fail("{s} creating lazy symbol", .{@errorName(err)}) return emit.fail("{s} creating lazy symbol", .{@errorName(err)})
else if (emit.bin_file.cast(.coff2)) |elf|
@intFromEnum(try elf.lazySymbol(lazy_sym))
else else
return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),
.is_extern = false, .is_extern = false,
@ -190,8 +192,13 @@ pub fn emitMir(emit: *Emit) Error!void {
try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null) try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null)
else if (emit.bin_file.cast(.coff)) |coff_file| else if (emit.bin_file.cast(.coff)) |coff_file|
try coff_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, "compiler_rt") try coff_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, "compiler_rt")
else else if (emit.bin_file.cast(.coff2)) |coff| @intFromEnum(try coff.globalSymbol(
return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), extern_func.toSlice(&emit.lower.mir).?,
switch (comp.compiler_rt_strat) {
.none, .lib, .obj, .zcu => null,
.dyn_lib => "compiler_rt",
},
)) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),
.is_extern = true, .is_extern = true,
.type = .symbol, .type = .symbol,
}, },
@ -314,6 +321,18 @@ pub fn emitMir(emit: *Emit) Error!void {
}, emit.lower.target), reloc_info), }, emit.lower.target), reloc_info),
else => unreachable, else => unreachable,
} }
} else if (emit.bin_file.cast(.coff2)) |_| {
switch (lowered_inst.encoding.mnemonic) {
.lea => try emit.encodeInst(try .new(.none, .lea, &.{
lowered_inst.ops[0],
.{ .mem = .initRip(.none, 0) },
}, emit.lower.target), reloc_info),
.mov => try emit.encodeInst(try .new(.none, .mov, &.{
lowered_inst.ops[0],
.{ .mem = .initRip(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, 0) },
}, emit.lower.target), reloc_info),
else => unreachable,
}
} else return emit.fail("TODO implement relocs for {s}", .{ } else return emit.fail("TODO implement relocs for {s}", .{
@tagName(emit.bin_file.tag), @tagName(emit.bin_file.tag),
}); });
@ -683,7 +702,7 @@ pub fn emitMir(emit: *Emit) Error!void {
table_reloc.source_offset, table_reloc.source_offset,
@enumFromInt(emit.atom_index), @enumFromInt(emit.atom_index),
@as(i64, table_offset) + table_reloc.target_offset, @as(i64, table_offset) + table_reloc.target_offset,
.{ .x86_64 = .@"32" }, .{ .X86_64 = .@"32" },
); );
for (emit.lower.mir.table) |entry| { for (emit.lower.mir.table) |entry| {
try elf.addReloc( try elf.addReloc(
@ -691,7 +710,7 @@ pub fn emitMir(emit: *Emit) Error!void {
table_offset, table_offset,
@enumFromInt(emit.atom_index), @enumFromInt(emit.atom_index),
emit.code_offset_mapping.items[entry], emit.code_offset_mapping.items[entry],
.{ .x86_64 = .@"64" }, .{ .X86_64 = .@"64" },
); );
table_offset += ptr_size; table_offset += ptr_size;
} }
@ -800,7 +819,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
end_offset - 4, end_offset - 4,
@enumFromInt(reloc.target.index), @enumFromInt(reloc.target.index),
reloc.off, reloc.off,
.{ .x86_64 = .@"32" }, .{ .X86_64 = .@"32" },
) else if (emit.bin_file.cast(.coff)) |coff_file| { ) else if (emit.bin_file.cast(.coff)) |coff_file| {
const atom_index = coff_file.getAtomIndexForSymbol( const atom_index = coff_file.getAtomIndexForSymbol(
.{ .sym_index = emit.atom_index, .file = null }, .{ .sym_index = emit.atom_index, .file = null },
@ -816,7 +835,13 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
.pcrel = true, .pcrel = true,
.length = 2, .length = 2,
}); });
} else unreachable, } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(
@enumFromInt(emit.atom_index),
end_offset - 4,
@enumFromInt(reloc.target.index),
reloc.off,
.{ .AMD64 = .REL32 },
) else unreachable,
.branch => if (emit.bin_file.cast(.elf)) |elf_file| { .branch => if (emit.bin_file.cast(.elf)) |elf_file| {
const zo = elf_file.zigObjectPtr().?; const zo = elf_file.zigObjectPtr().?;
const atom = zo.symbol(emit.atom_index).atom(elf_file).?; const atom = zo.symbol(emit.atom_index).atom(elf_file).?;
@ -831,7 +856,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
end_offset - 4, end_offset - 4,
@enumFromInt(reloc.target.index), @enumFromInt(reloc.target.index),
reloc.off - 4, reloc.off - 4,
.{ .x86_64 = .PC32 }, .{ .X86_64 = .PC32 },
) else if (emit.bin_file.cast(.macho)) |macho_file| { ) else if (emit.bin_file.cast(.macho)) |macho_file| {
const zo = macho_file.getZigObject().?; const zo = macho_file.getZigObject().?;
const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?;
@ -863,7 +888,13 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
.pcrel = true, .pcrel = true,
.length = 2, .length = 2,
}); });
} else return emit.fail("TODO implement {s} reloc for {s}", .{ } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(
@enumFromInt(emit.atom_index),
end_offset - 4,
@enumFromInt(reloc.target.index),
reloc.off,
.{ .AMD64 = .REL32 },
) else return emit.fail("TODO implement {s} reloc for {s}", .{
@tagName(reloc.target.type), @tagName(emit.bin_file.tag), @tagName(reloc.target.type), @tagName(emit.bin_file.tag),
}), }),
.tls => if (emit.bin_file.cast(.elf)) |elf_file| { .tls => if (emit.bin_file.cast(.elf)) |elf_file| {
@ -892,7 +923,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
end_offset - 4, end_offset - 4,
@enumFromInt(reloc.target.index), @enumFromInt(reloc.target.index),
reloc.off, reloc.off,
.{ .x86_64 = .TPOFF32 }, .{ .X86_64 = .TPOFF32 },
) else if (emit.bin_file.cast(.macho)) |macho_file| { ) else if (emit.bin_file.cast(.macho)) |macho_file| {
const zo = macho_file.getZigObject().?; const zo = macho_file.getZigObject().?;
const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?;

View File

@ -96,6 +96,7 @@ pub const Env = enum {
.spirv_backend, .spirv_backend,
.lld_linker, .lld_linker,
.coff_linker, .coff_linker,
.coff2_linker,
.elf_linker, .elf_linker,
.elf2_linker, .elf2_linker,
.macho_linker, .macho_linker,
@ -284,6 +285,7 @@ pub const Feature = enum {
lld_linker, lld_linker,
coff_linker, coff_linker,
coff2_linker,
elf_linker, elf_linker,
elf2_linker, elf2_linker,
macho_linker, macho_linker,

View File

@ -610,27 +610,20 @@ pub const File = struct {
} }
} }
} }
const output_mode = comp.config.output_mode; base.file = try emit.root_dir.handle.openFile(emit.sub_path, .{ .mode = .read_write });
const link_mode = comp.config.link_mode;
base.file = try emit.root_dir.handle.createFile(emit.sub_path, .{
.truncate = false,
.read = true,
.mode = determineMode(output_mode, link_mode),
});
}, },
.elf2 => { .elf2, .coff2 => if (base.file == null) {
const elf = base.cast(.elf2).?; const mf = if (base.cast(.elf2)) |elf|
if (base.file == null) { &elf.mf
elf.mf.file = try base.emit.root_dir.handle.createFile(base.emit.sub_path, .{ else if (base.cast(.coff2)) |coff|
.truncate = false, &coff.mf
.read = true, else
.mode = determineMode(comp.config.output_mode, comp.config.link_mode), unreachable;
}); mf.file = try base.emit.root_dir.handle.openFile(base.emit.sub_path, .{
base.file = elf.mf.file; .mode = .read_write,
try elf.mf.ensureTotalCapacity( });
@intCast(elf.mf.nodes.items[0].location().resolve(&elf.mf)[1]), base.file = mf.file;
); try mf.ensureTotalCapacity(@intCast(mf.nodes.items[0].location().resolve(mf)[1]));
}
}, },
.c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }), .c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }),
.plan9 => unreachable, .plan9 => unreachable,
@ -654,12 +647,9 @@ pub const File = struct {
pub fn makeExecutable(base: *File) !void { pub fn makeExecutable(base: *File) !void {
dev.check(.make_executable); dev.check(.make_executable);
const comp = base.comp; const comp = base.comp;
const output_mode = comp.config.output_mode; switch (comp.config.output_mode) {
const link_mode = comp.config.link_mode;
switch (output_mode) {
.Obj => return, .Obj => return,
.Lib => switch (link_mode) { .Lib => switch (comp.config.link_mode) {
.static => return, .static => return,
.dynamic => {}, .dynamic => {},
}, },
@ -702,15 +692,18 @@ pub const File = struct {
} }
} }
}, },
.elf2 => { .elf2, .coff2 => if (base.file) |f| {
const elf = base.cast(.elf2).?; const mf = if (base.cast(.elf2)) |elf|
if (base.file) |f| { &elf.mf
elf.mf.unmap(); else if (base.cast(.coff2)) |coff|
assert(elf.mf.file.handle == f.handle); &coff.mf
elf.mf.file = undefined; else
f.close(); unreachable;
base.file = null; mf.unmap();
} assert(mf.file.handle == f.handle);
mf.file = undefined;
f.close();
base.file = null;
}, },
.c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }), .c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }),
.plan9 => unreachable, .plan9 => unreachable,
@ -828,7 +821,7 @@ pub const File = struct {
.spirv => {}, .spirv => {},
.goff, .xcoff => {}, .goff, .xcoff => {},
.plan9 => unreachable, .plan9 => unreachable,
.elf2 => {}, .elf2, .coff2 => {},
inline else => |tag| { inline else => |tag| {
dev.check(tag.devFeature()); dev.check(tag.devFeature());
return @as(*tag.Type(), @fieldParentPtr("base", base)).updateLineNumber(pt, ti_id); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateLineNumber(pt, ti_id);
@ -864,7 +857,7 @@ pub const File = struct {
pub fn idle(base: *File, tid: Zcu.PerThread.Id) !bool { pub fn idle(base: *File, tid: Zcu.PerThread.Id) !bool {
switch (base.tag) { switch (base.tag) {
else => return false, else => return false,
inline .elf2 => |tag| { inline .elf2, .coff2 => |tag| {
dev.check(tag.devFeature()); dev.check(tag.devFeature());
return @as(*tag.Type(), @fieldParentPtr("base", base)).idle(tid); return @as(*tag.Type(), @fieldParentPtr("base", base)).idle(tid);
}, },
@ -874,7 +867,7 @@ pub const File = struct {
pub fn updateErrorData(base: *File, pt: Zcu.PerThread) !void { pub fn updateErrorData(base: *File, pt: Zcu.PerThread) !void {
switch (base.tag) { switch (base.tag) {
else => {}, else => {},
inline .elf2 => |tag| { inline .elf2, .coff2 => |tag| {
dev.check(tag.devFeature()); dev.check(tag.devFeature());
return @as(*tag.Type(), @fieldParentPtr("base", base)).updateErrorData(pt); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateErrorData(pt);
}, },
@ -1155,7 +1148,7 @@ pub const File = struct {
if (base.zcu_object_basename != null) return; if (base.zcu_object_basename != null) return;
switch (base.tag) { switch (base.tag) {
inline .elf2, .wasm => |tag| { inline .elf2, .coff2, .wasm => |tag| {
dev.check(tag.devFeature()); dev.check(tag.devFeature());
return @as(*tag.Type(), @fieldParentPtr("base", base)).prelink(base.comp.link_prog_node); return @as(*tag.Type(), @fieldParentPtr("base", base)).prelink(base.comp.link_prog_node);
}, },
@ -1165,6 +1158,7 @@ pub const File = struct {
pub const Tag = enum { pub const Tag = enum {
coff, coff,
coff2,
elf, elf,
elf2, elf2,
macho, macho,
@ -1179,6 +1173,7 @@ pub const File = struct {
pub fn Type(comptime tag: Tag) type { pub fn Type(comptime tag: Tag) type {
return switch (tag) { return switch (tag) {
.coff => Coff, .coff => Coff,
.coff2 => Coff2,
.elf => Elf, .elf => Elf,
.elf2 => Elf2, .elf2 => Elf2,
.macho => MachO, .macho => MachO,
@ -1194,7 +1189,7 @@ pub const File = struct {
fn fromObjectFormat(ofmt: std.Target.ObjectFormat, use_new_linker: bool) Tag { fn fromObjectFormat(ofmt: std.Target.ObjectFormat, use_new_linker: bool) Tag {
return switch (ofmt) { return switch (ofmt) {
.coff => .coff, .coff => if (use_new_linker) .coff2 else .coff,
.elf => if (use_new_linker) .elf2 else .elf, .elf => if (use_new_linker) .elf2 else .elf,
.macho => .macho, .macho => .macho,
.wasm => .wasm, .wasm => .wasm,
@ -1280,6 +1275,7 @@ pub const File = struct {
pub const Lld = @import("link/Lld.zig"); pub const Lld = @import("link/Lld.zig");
pub const C = @import("link/C.zig"); pub const C = @import("link/C.zig");
pub const Coff = @import("link/Coff.zig"); pub const Coff = @import("link/Coff.zig");
pub const Coff2 = @import("link/Coff2.zig");
pub const Elf = @import("link/Elf.zig"); pub const Elf = @import("link/Elf.zig");
pub const Elf2 = @import("link/Elf2.zig"); pub const Elf2 = @import("link/Elf2.zig");
pub const MachO = @import("link/MachO.zig"); pub const MachO = @import("link/MachO.zig");

View File

@ -125,11 +125,11 @@ const UavTable = std.AutoHashMapUnmanaged(InternPool.Index, AvMetadata);
const RelocTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Relocation)); const RelocTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Relocation));
const BaseRelocationTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(u32)); const BaseRelocationTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(u32));
const default_file_alignment: u16 = 0x200; pub const default_file_alignment: u16 = 0x200;
const default_size_of_stack_reserve: u32 = 0x1000000; pub const default_size_of_stack_reserve: u32 = 0x1000000;
const default_size_of_stack_commit: u32 = 0x1000; pub const default_size_of_stack_commit: u32 = 0x1000;
const default_size_of_heap_reserve: u32 = 0x100000; pub const default_size_of_heap_reserve: u32 = 0x100000;
const default_size_of_heap_commit: u32 = 0x1000; pub const default_size_of_heap_commit: u32 = 0x1000;
const Section = struct { const Section = struct {
header: coff_util.SectionHeader, header: coff_util.SectionHeader,
@ -334,51 +334,51 @@ pub fn createEmpty(
if (coff.text_section_index == null) { if (coff.text_section_index == null) {
const file_size: u32 = @intCast(options.program_code_size_hint); const file_size: u32 = @intCast(options.program_code_size_hint);
coff.text_section_index = try coff.allocateSection(".text", file_size, .{ coff.text_section_index = try coff.allocateSection(".text", file_size, .{
.CNT_CODE = 1, .CNT_CODE = true,
.MEM_EXECUTE = 1, .MEM_EXECUTE = true,
.MEM_READ = 1, .MEM_READ = true,
}); });
} }
if (coff.got_section_index == null) { if (coff.got_section_index == null) {
const file_size = @as(u32, @intCast(options.symbol_count_hint)) * coff.ptr_width.size(); const file_size = @as(u32, @intCast(options.symbol_count_hint)) * coff.ptr_width.size();
coff.got_section_index = try coff.allocateSection(".got", file_size, .{ coff.got_section_index = try coff.allocateSection(".got", file_size, .{
.CNT_INITIALIZED_DATA = 1, .CNT_INITIALIZED_DATA = true,
.MEM_READ = 1, .MEM_READ = true,
}); });
} }
if (coff.rdata_section_index == null) { if (coff.rdata_section_index == null) {
const file_size: u32 = coff.page_size; const file_size: u32 = coff.page_size;
coff.rdata_section_index = try coff.allocateSection(".rdata", file_size, .{ coff.rdata_section_index = try coff.allocateSection(".rdata", file_size, .{
.CNT_INITIALIZED_DATA = 1, .CNT_INITIALIZED_DATA = true,
.MEM_READ = 1, .MEM_READ = true,
}); });
} }
if (coff.data_section_index == null) { if (coff.data_section_index == null) {
const file_size: u32 = coff.page_size; const file_size: u32 = coff.page_size;
coff.data_section_index = try coff.allocateSection(".data", file_size, .{ coff.data_section_index = try coff.allocateSection(".data", file_size, .{
.CNT_INITIALIZED_DATA = 1, .CNT_INITIALIZED_DATA = true,
.MEM_READ = 1, .MEM_READ = true,
.MEM_WRITE = 1, .MEM_WRITE = true,
}); });
} }
if (coff.idata_section_index == null) { if (coff.idata_section_index == null) {
const file_size = @as(u32, @intCast(options.symbol_count_hint)) * coff.ptr_width.size(); const file_size = @as(u32, @intCast(options.symbol_count_hint)) * coff.ptr_width.size();
coff.idata_section_index = try coff.allocateSection(".idata", file_size, .{ coff.idata_section_index = try coff.allocateSection(".idata", file_size, .{
.CNT_INITIALIZED_DATA = 1, .CNT_INITIALIZED_DATA = true,
.MEM_READ = 1, .MEM_READ = true,
}); });
} }
if (coff.reloc_section_index == null) { if (coff.reloc_section_index == null) {
const file_size = @as(u32, @intCast(options.symbol_count_hint)) * @sizeOf(coff_util.BaseRelocation); const file_size = @as(u32, @intCast(options.symbol_count_hint)) * @sizeOf(coff_util.BaseRelocation);
coff.reloc_section_index = try coff.allocateSection(".reloc", file_size, .{ coff.reloc_section_index = try coff.allocateSection(".reloc", file_size, .{
.CNT_INITIALIZED_DATA = 1, .CNT_INITIALIZED_DATA = true,
.MEM_DISCARDABLE = 1, .MEM_DISCARDABLE = true,
.MEM_READ = 1, .MEM_READ = true,
}); });
} }
@ -477,7 +477,7 @@ pub fn deinit(coff: *Coff) void {
coff.base_relocs.deinit(gpa); coff.base_relocs.deinit(gpa);
} }
fn allocateSection(coff: *Coff, name: []const u8, size: u32, flags: coff_util.SectionHeaderFlags) !u16 { fn allocateSection(coff: *Coff, name: []const u8, size: u32, flags: coff_util.SectionHeader.Flags) !u16 {
const index = @as(u16, @intCast(coff.sections.slice().len)); const index = @as(u16, @intCast(coff.sections.slice().len));
const off = coff.findFreeSpace(size, default_file_alignment); const off = coff.findFreeSpace(size, default_file_alignment);
// Memory is always allocated in sequence // Memory is always allocated in sequence
@ -836,7 +836,7 @@ fn writeAtom(coff: *Coff, atom_index: Atom.Index, code: []u8, resolve_relocs: bo
try debugMem(gpa, handle, pvaddr, mem_code); try debugMem(gpa, handle, pvaddr, mem_code);
} }
if (section.header.flags.MEM_WRITE == 0) { if (!section.header.flags.MEM_WRITE) {
writeMemProtected(handle, pvaddr, mem_code) catch |err| { writeMemProtected(handle, pvaddr, mem_code) catch |err| {
log.warn("writing to protected memory failed with error: {s}", .{@errorName(err)}); log.warn("writing to protected memory failed with error: {s}", .{@errorName(err)});
}; };
@ -2227,21 +2227,21 @@ fn writeHeader(coff: *Coff) !void {
mem.writeInt(u32, buffer.writer.buffer[0x3c..][0..4], msdos_stub.len, .little); mem.writeInt(u32, buffer.writer.buffer[0x3c..][0..4], msdos_stub.len, .little);
writer.writeAll("PE\x00\x00") catch unreachable; writer.writeAll("PE\x00\x00") catch unreachable;
var flags = coff_util.CoffHeaderFlags{ var flags: coff_util.Header.Flags = .{
.EXECUTABLE_IMAGE = 1, .EXECUTABLE_IMAGE = true,
.DEBUG_STRIPPED = 1, // TODO .DEBUG_STRIPPED = true, // TODO
}; };
switch (coff.ptr_width) { switch (coff.ptr_width) {
.p32 => flags.@"32BIT_MACHINE" = 1, .p32 => flags.@"32BIT_MACHINE" = true,
.p64 => flags.LARGE_ADDRESS_AWARE = 1, .p64 => flags.LARGE_ADDRESS_AWARE = true,
} }
if (coff.base.comp.config.output_mode == .Lib and coff.base.comp.config.link_mode == .dynamic) { if (coff.base.comp.config.output_mode == .Lib and coff.base.comp.config.link_mode == .dynamic) {
flags.DLL = 1; flags.DLL = true;
} }
const timestamp = if (coff.repro) 0 else std.time.timestamp(); const timestamp = if (coff.repro) 0 else std.time.timestamp();
const size_of_optional_header = @as(u16, @intCast(coff.getOptionalHeaderSize() + coff.getDataDirectoryHeadersSize())); const size_of_optional_header = @as(u16, @intCast(coff.getOptionalHeaderSize() + coff.getDataDirectoryHeadersSize()));
var coff_header = coff_util.CoffHeader{ var coff_header: coff_util.Header = .{
.machine = target.toCoffMachine(), .machine = target.toCoffMachine(),
.number_of_sections = @as(u16, @intCast(coff.sections.slice().len)), // TODO what if we prune a section .number_of_sections = @as(u16, @intCast(coff.sections.slice().len)), // TODO what if we prune a section
.time_date_stamp = @as(u32, @truncate(@as(u64, @bitCast(timestamp)))), .time_date_stamp = @as(u32, @truncate(@as(u64, @bitCast(timestamp)))),
@ -2254,10 +2254,10 @@ fn writeHeader(coff: *Coff) !void {
writer.writeAll(mem.asBytes(&coff_header)) catch unreachable; writer.writeAll(mem.asBytes(&coff_header)) catch unreachable;
const dll_flags: coff_util.DllFlags = .{ const dll_flags: coff_util.DllFlags = .{
.HIGH_ENTROPY_VA = 1, // TODO do we want to permit non-PIE builds at all? .HIGH_ENTROPY_VA = true, // TODO do we want to permit non-PIE builds at all?
.DYNAMIC_BASE = 1, .DYNAMIC_BASE = true,
.TERMINAL_SERVER_AWARE = 1, // We are not a legacy app .TERMINAL_SERVER_AWARE = true, // We are not a legacy app
.NX_COMPAT = 1, // We are compatible with Data Execution Prevention .NX_COMPAT = true, // We are compatible with Data Execution Prevention
}; };
const subsystem: coff_util.Subsystem = .WINDOWS_CUI; const subsystem: coff_util.Subsystem = .WINDOWS_CUI;
const size_of_image: u32 = coff.getSizeOfImage(); const size_of_image: u32 = coff.getSizeOfImage();
@ -2269,13 +2269,13 @@ fn writeHeader(coff: *Coff) !void {
var size_of_initialized_data: u32 = 0; var size_of_initialized_data: u32 = 0;
var size_of_uninitialized_data: u32 = 0; var size_of_uninitialized_data: u32 = 0;
for (coff.sections.items(.header)) |header| { for (coff.sections.items(.header)) |header| {
if (header.flags.CNT_CODE == 1) { if (header.flags.CNT_CODE) {
size_of_code += header.size_of_raw_data; size_of_code += header.size_of_raw_data;
} }
if (header.flags.CNT_INITIALIZED_DATA == 1) { if (header.flags.CNT_INITIALIZED_DATA) {
size_of_initialized_data += header.size_of_raw_data; size_of_initialized_data += header.size_of_raw_data;
} }
if (header.flags.CNT_UNINITIALIZED_DATA == 1) { if (header.flags.CNT_UNINITIALIZED_DATA) {
size_of_uninitialized_data += header.size_of_raw_data; size_of_uninitialized_data += header.size_of_raw_data;
} }
} }
@ -2283,7 +2283,7 @@ fn writeHeader(coff: *Coff) !void {
switch (coff.ptr_width) { switch (coff.ptr_width) {
.p32 => { .p32 => {
var opt_header = coff_util.OptionalHeaderPE32{ var opt_header = coff_util.OptionalHeaderPE32{
.magic = coff_util.IMAGE_NT_OPTIONAL_HDR32_MAGIC, .magic = .PE32,
.major_linker_version = 0, .major_linker_version = 0,
.minor_linker_version = 0, .minor_linker_version = 0,
.size_of_code = size_of_code, .size_of_code = size_of_code,
@ -2318,7 +2318,7 @@ fn writeHeader(coff: *Coff) !void {
}, },
.p64 => { .p64 => {
var opt_header = coff_util.OptionalHeaderPE64{ var opt_header = coff_util.OptionalHeaderPE64{
.magic = coff_util.IMAGE_NT_OPTIONAL_HDR64_MAGIC, .magic = .@"PE32+",
.major_linker_version = 0, .major_linker_version = 0,
.minor_linker_version = 0, .minor_linker_version = 0,
.size_of_code = size_of_code, .size_of_code = size_of_code,
@ -2422,7 +2422,7 @@ fn allocatedVirtualSize(coff: *Coff, start: u32) u32 {
fn getSizeOfHeaders(coff: Coff) u32 { fn getSizeOfHeaders(coff: Coff) u32 {
const msdos_hdr_size = msdos_stub.len + 4; const msdos_hdr_size = msdos_stub.len + 4;
return @as(u32, @intCast(msdos_hdr_size + @sizeOf(coff_util.CoffHeader) + coff.getOptionalHeaderSize() + return @as(u32, @intCast(msdos_hdr_size + @sizeOf(coff_util.Header) + coff.getOptionalHeaderSize() +
coff.getDataDirectoryHeadersSize() + coff.getSectionHeadersSize())); coff.getDataDirectoryHeadersSize() + coff.getSectionHeadersSize()));
} }
@ -2443,7 +2443,7 @@ fn getSectionHeadersSize(coff: Coff) u32 {
fn getDataDirectoryHeadersOffset(coff: Coff) u32 { fn getDataDirectoryHeadersOffset(coff: Coff) u32 {
const msdos_hdr_size = msdos_stub.len + 4; const msdos_hdr_size = msdos_stub.len + 4;
return @as(u32, @intCast(msdos_hdr_size + @sizeOf(coff_util.CoffHeader) + coff.getOptionalHeaderSize())); return @as(u32, @intCast(msdos_hdr_size + @sizeOf(coff_util.Header) + coff.getOptionalHeaderSize()));
} }
fn getSectionHeadersOffset(coff: Coff) u32 { fn getSectionHeadersOffset(coff: Coff) u32 {
@ -3116,7 +3116,7 @@ fn pwriteAll(coff: *Coff, bytes: []const u8, offset: u64) error{LinkFailure}!voi
/// A "page" is 512 bytes. /// A "page" is 512 bytes.
/// A "long" is 4 bytes. /// A "long" is 4 bytes.
/// A "word" is 2 bytes. /// A "word" is 2 bytes.
const msdos_stub: [120]u8 = .{ pub const msdos_stub: [120]u8 = .{
'M', 'Z', // Magic number. Stands for Mark Zbikowski (designer of the MS-DOS executable format). 'M', 'Z', // Magic number. Stands for Mark Zbikowski (designer of the MS-DOS executable format).
0x78, 0x00, // Number of bytes in the last page. This matches the size of this entire MS-DOS stub. 0x78, 0x00, // Number of bytes in the last page. This matches the size of this entire MS-DOS stub.
0x01, 0x00, // Number of pages. 0x01, 0x00, // Number of pages.

2128
src/link/Coff2.zig Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,17 +34,28 @@ pub fn init(file: std.fs.File, gpa: std.mem.Allocator) !MappedFile {
.writers = .{}, .writers = .{},
}; };
errdefer mf.deinit(gpa); errdefer mf.deinit(gpa);
const size: u64, const blksize = if (is_windows) const size: u64, const block_size = stat: {
.{ try windows.GetFileSizeEx(file.handle), 1 } if (is_windows) {
else stat: { var sbi: windows.SYSTEM_BASIC_INFORMATION = undefined;
break :stat .{
try windows.GetFileSizeEx(file.handle),
switch (windows.ntdll.NtQuerySystemInformation(
.SystemBasicInformation,
&sbi,
@sizeOf(windows.SYSTEM_BASIC_INFORMATION),
null,
)) {
.SUCCESS => @max(sbi.PageSize, sbi.AllocationGranularity),
else => std.heap.page_size_max,
},
};
}
const stat = try std.posix.fstat(mf.file.handle); const stat = try std.posix.fstat(mf.file.handle);
if (!std.posix.S.ISREG(stat.mode)) return error.PathAlreadyExists; if (!std.posix.S.ISREG(stat.mode)) return error.PathAlreadyExists;
break :stat .{ @bitCast(stat.size), stat.blksize }; break :stat .{ @bitCast(stat.size), @max(std.heap.pageSize(), stat.blksize) };
}; };
mf.flags = .{ mf.flags = .{
.block_size = .fromByteUnits( .block_size = .fromByteUnits(std.math.ceilPowerOfTwoAssert(usize, block_size)),
std.math.ceilPowerOfTwoAssert(usize, @max(std.heap.pageSize(), blksize)),
),
.copy_file_range_unsupported = false, .copy_file_range_unsupported = false,
.fallocate_insert_range_unsupported = false, .fallocate_insert_range_unsupported = false,
.fallocate_punch_hole_unsupported = false, .fallocate_punch_hole_unsupported = false,
@ -90,9 +101,11 @@ pub const Node = extern struct {
resized: bool, resized: bool,
/// Whether this node might contain non-zero bytes. /// Whether this node might contain non-zero bytes.
has_content: bool, has_content: bool,
/// Whether a moved event on this node bubbles down to children.
bubbles_moved: bool,
unused: @Type(.{ .int = .{ unused: @Type(.{ .int = .{
.signedness = .unsigned, .signedness = .unsigned,
.bits = 32 - @bitSizeOf(std.mem.Alignment) - 5, .bits = 32 - @bitSizeOf(std.mem.Alignment) - 6,
} }) = 0, } }) = 0,
}; };
@ -136,6 +149,25 @@ pub const Node = extern struct {
return &mf.nodes.items[@intFromEnum(ni)]; return &mf.nodes.items[@intFromEnum(ni)];
} }
pub fn parent(ni: Node.Index, mf: *const MappedFile) Node.Index {
return ni.get(mf).parent;
}
pub const ChildIterator = struct {
mf: *const MappedFile,
ni: Node.Index,
pub fn next(it: *ChildIterator) ?Node.Index {
const ni = it.ni;
if (ni == .none) return null;
it.ni = ni.get(it.mf).next;
return ni;
}
};
pub fn children(ni: Node.Index, mf: *const MappedFile) ChildIterator {
return .{ .mf = mf, .ni = ni.get(mf).first };
}
pub fn childrenMoved(ni: Node.Index, gpa: std.mem.Allocator, mf: *MappedFile) !void { pub fn childrenMoved(ni: Node.Index, gpa: std.mem.Allocator, mf: *MappedFile) !void {
var child_ni = ni.get(mf).last; var child_ni = ni.get(mf).last;
while (child_ni != .none) { while (child_ni != .none) {
@ -147,9 +179,10 @@ pub const Node = extern struct {
pub fn hasMoved(ni: Node.Index, mf: *const MappedFile) bool { pub fn hasMoved(ni: Node.Index, mf: *const MappedFile) bool {
var parent_ni = ni; var parent_ni = ni;
while (parent_ni != Node.Index.root) { while (parent_ni != Node.Index.root) {
const parent = parent_ni.get(mf); const parent_node = parent_ni.get(mf);
if (parent.flags.moved) return true; if (!parent_node.flags.bubbles_moved) break;
parent_ni = parent.parent; if (parent_node.flags.moved) return true;
parent_ni = parent_node.parent;
} }
return false; return false;
} }
@ -163,12 +196,7 @@ pub const Node = extern struct {
return node_moved.*; return node_moved.*;
} }
fn movedAssumeCapacity(ni: Node.Index, mf: *MappedFile) void { fn movedAssumeCapacity(ni: Node.Index, mf: *MappedFile) void {
var parent_ni = ni; if (ni.hasMoved(mf)) return;
while (parent_ni != Node.Index.root) {
const parent_node = parent_ni.get(mf);
if (parent_node.flags.moved) return;
parent_ni = parent_node.parent;
}
const node = ni.get(mf); const node = ni.get(mf);
node.flags.moved = true; node.flags.moved = true;
if (node.flags.resized) return; if (node.flags.resized) return;
@ -242,10 +270,10 @@ pub const Node = extern struct {
var offset, const size = ni.location(mf).resolve(mf); var offset, const size = ni.location(mf).resolve(mf);
var parent_ni = ni; var parent_ni = ni;
while (true) { while (true) {
const parent = parent_ni.get(mf); const parent_node = parent_ni.get(mf);
if (set_has_content) parent.flags.has_content = true; if (set_has_content) parent_node.flags.has_content = true;
if (parent_ni == .none) break; if (parent_ni == .none) break;
parent_ni = parent.parent; parent_ni = parent_node.parent;
offset += parent_ni.location(mf).resolve(mf)[0]; offset += parent_ni.location(mf).resolve(mf)[0];
} }
return .{ .offset = offset, .size = size }; return .{ .offset = offset, .size = size };
@ -449,6 +477,7 @@ fn addNode(mf: *MappedFile, gpa: std.mem.Allocator, opts: struct {
.moved = true, .moved = true,
.resized = true, .resized = true,
.has_content = false, .has_content = false,
.bubbles_moved = opts.add_node.bubbles_moved,
}, },
.location_payload = location_payload, .location_payload = location_payload,
}; };
@ -471,6 +500,7 @@ pub const AddNodeOptions = struct {
fixed: bool = false, fixed: bool = false,
moved: bool = false, moved: bool = false,
resized: bool = false, resized: bool = false,
bubbles_moved: bool = true,
}; };
pub fn addOnlyChildNode( pub fn addOnlyChildNode(

View File

@ -233,7 +233,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool {
pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.CompilerBackend) bool { pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.CompilerBackend) bool {
return switch (ofmt) { return switch (ofmt) {
.elf => switch (backend) { .elf, .coff => switch (backend) {
.stage2_x86_64 => true, .stage2_x86_64 => true,
else => false, else => false,
}, },

View File

@ -1650,7 +1650,6 @@ test "coerce between pointers of compatible differently-named floats" {
if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows and !builtin.link_libc) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows and !builtin.link_libc) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
@ -2883,7 +2882,6 @@ test "@intFromFloat vector boundary cases" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
const S = struct { const S = struct {
fn case(comptime I: type, unshifted_inputs: [2]f32, expected: [2]I) !void { fn case(comptime I: type, unshifted_inputs: [2]f32, expected: [2]I) !void {

View File

@ -43,7 +43,6 @@ export fn testPackedStuff(a: *const PackedStruct, b: *const PackedUnion) void {
} }
test "export function alias" { test "export function alias" {
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
_ = struct { _ = struct {

View File

@ -16,7 +16,6 @@ export var a_mystery_symbol: i32 = 1234;
test "function extern symbol" { test "function extern symbol" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
const a = @extern(*const fn () callconv(.c) i32, .{ .name = "a_mystery_function" }); const a = @extern(*const fn () callconv(.c) i32, .{ .name = "a_mystery_function" });
@ -29,7 +28,6 @@ export fn a_mystery_function() i32 {
test "function extern symbol matches extern decl" { test "function extern symbol matches extern decl" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
const S = struct { const S = struct {

View File

@ -158,7 +158,6 @@ test "cmp f80/c_longdouble" {
if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testCmp(f80); try testCmp(f80);
try comptime testCmp(f80); try comptime testCmp(f80);
@ -283,7 +282,6 @@ test "vector cmp f80/c_longdouble" {
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testCmpVector(f80); try testCmpVector(f80);
try comptime testCmpVector(f80); try comptime testCmpVector(f80);
@ -396,7 +394,6 @@ test "@sqrt f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
if (builtin.os.tag == .freebsd) { if (builtin.os.tag == .freebsd) {
// TODO https://github.com/ziglang/zig/issues/10875 // TODO https://github.com/ziglang/zig/issues/10875
@ -526,7 +523,6 @@ test "@sin f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testSin(f80); try testSin(f80);
comptime try testSin(f80); comptime try testSin(f80);
@ -596,7 +592,6 @@ test "@cos f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testCos(f80); try testCos(f80);
try comptime testCos(f80); try comptime testCos(f80);
@ -666,7 +661,6 @@ test "@tan f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testTan(f80); try testTan(f80);
try comptime testTan(f80); try comptime testTan(f80);
@ -736,7 +730,6 @@ test "@exp f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testExp(f80); try testExp(f80);
try comptime testExp(f80); try comptime testExp(f80);
@ -810,7 +803,6 @@ test "@exp2 f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testExp2(f80); try testExp2(f80);
try comptime testExp2(f80); try comptime testExp2(f80);
@ -879,7 +871,6 @@ test "@log f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testLog(f80); try testLog(f80);
try comptime testLog(f80); try comptime testLog(f80);
@ -946,7 +937,6 @@ test "@log2 f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testLog2(f80); try testLog2(f80);
try comptime testLog2(f80); try comptime testLog2(f80);
@ -1019,7 +1009,6 @@ test "@log10 f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testLog10(f80); try testLog10(f80);
try comptime testLog10(f80); try comptime testLog10(f80);
@ -1086,7 +1075,6 @@ test "@abs f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testFabs(f80); try testFabs(f80);
try comptime testFabs(f80); try comptime testFabs(f80);
@ -1204,7 +1192,6 @@ test "@floor f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
@ -1295,7 +1282,6 @@ test "@ceil f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
@ -1388,7 +1374,6 @@ test "@trunc f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
// https://github.com/ziglang/zig/issues/12602 // https://github.com/ziglang/zig/issues/12602
@ -1485,7 +1470,6 @@ test "neg f80/f128/c_longdouble" {
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
try testNeg(f80); try testNeg(f80);
try comptime testNeg(f80); try comptime testNeg(f80);
@ -1741,7 +1725,6 @@ test "comptime calls are only memoized when float arguments are bit-for-bit equa
test "result location forwarded through unary float builtins" { test "result location forwarded through unary float builtins" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;

View File

@ -31,7 +31,6 @@ test "import c keywords" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
try std.testing.expect(int == .c_keyword_variable); try std.testing.expect(int == .c_keyword_variable);

View File

@ -1416,7 +1416,6 @@ test "remainder division" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
@ -1425,6 +1424,8 @@ test "remainder division" {
return error.SkipZigTest; return error.SkipZigTest;
} }
if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff and builtin.abi != .gnu) return error.SkipZigTest;
try comptime remdiv(f16); try comptime remdiv(f16);
try comptime remdiv(f32); try comptime remdiv(f32);
try comptime remdiv(f64); try comptime remdiv(f64);
@ -1496,9 +1497,10 @@ test "float modulo division using @mod" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff and builtin.abi != .gnu) return error.SkipZigTest;
try comptime fmod(f16); try comptime fmod(f16);
try comptime fmod(f32); try comptime fmod(f32);
try comptime fmod(f64); try comptime fmod(f64);
@ -1686,7 +1688,6 @@ test "signed zeros are represented properly" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
const S = struct { const S = struct {
fn doTheTest() !void { fn doTheTest() !void {
@ -1824,7 +1825,8 @@ test "float divide by zero" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff and builtin.abi != .gnu) return error.SkipZigTest;
const S = struct { const S = struct {
fn doTheTest(comptime F: type, zero: F, one: F) !void { fn doTheTest(comptime F: type, zero: F, one: F) !void {

View File

@ -14,7 +14,6 @@ test "call extern function defined with conflicting type" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt == .coff) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
@import("conflicting_externs/a.zig").issue529(null); @import("conflicting_externs/a.zig").issue529(null);

View File

@ -5255,7 +5255,8 @@ inline fn mod(comptime Type: type, lhs: Type, rhs: Type) Type {
return @mod(lhs, rhs); return @mod(lhs, rhs);
} }
test mod { test mod {
if (@import("builtin").object_format == .coff and @import("builtin").target.abi != .gnu) return error.SkipZigTest; const builtin = @import("builtin");
if (builtin.object_format == .coff and builtin.abi != .gnu) return error.SkipZigTest;
const test_mod = binary(mod, .{}); const test_mod = binary(mod, .{});
try test_mod.testInts(); try test_mod.testInts();
try test_mod.testIntVectors(); try test_mod.testIntVectors();

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
//#target=wasm32-wasi-selfhosted //#target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
//#target=wasm32-wasi-selfhosted //#target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#update=initial version #update=initial version

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted
#update=initial version #update=initial version
#file=main.zig #file=main.zig

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted
#update=initial version #update=initial version
#file=main.zig #file=main.zig

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#update=initial version #update=initial version

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#update=initial version #update=initial version

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
//#target=wasm32-wasi-selfhosted //#target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
//#target=wasm32-wasi-selfhosted //#target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#update=non-inline version #update=non-inline version

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
//#target=wasm32-wasi-selfhosted //#target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted

View File

@ -1,4 +1,5 @@
#target=x86_64-linux-selfhosted #target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe #target=x86_64-linux-cbe
#target=x86_64-windows-cbe #target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted #target=wasm32-wasi-selfhosted