Changes:
- x86_64: Copy arguments into the shadow store when generating a variadic function on Win64
- x86_64: Implement @cVaStart for Win64
- x86_64: Implement @cVaArg for Win64
- x86_64: Duplicate floating point register args equivalent integer registers when calling variadic functions on Win64
- tests: Enable var_args tests for the self-hosted backend on windows
- tests: Add var_args test for floating point arguments
- Build: support installing the
compiler_rt.dll
I noticed there was missing test coverage for float variadic arguments, which I added - but it's disabled for the llvm backend on non-windows, as it was failing when I tested it locally on linux.
The compiler_rt.dll change is an extension of the existing hack used for the x86_64 backend when combined with the Coff linker. If that is not a desirable change I can drop that commit from this PR, but it was very useful for me in my local testing, as I could do the following, ie:
pubfnbuild(b:*std.Build)!void{constoptimize=b.standardOptimizeOption(.{});constexe_gnu=b.addExecutable(.{.name="args_gnu",.root_module=b.createModule(.{.root_source_file=b.path("src/main.zig"),.target=b.resolveTargetQuery(trystd.Target.Query.parse(.{.arch_os_abi="x86_64-windows-gnu",})),.optimize=optimize,}),.use_llvm=false,.use_lld=false,});constexe_msvc=b.addExecutable(.{.name="args_msvc",.root_module=b.createModule(.{.root_source_file=b.path("src/main.zig"),.target=b.resolveTargetQuery(trystd.Target.Query.parse(.{.arch_os_abi="x86_64-windows-msvc",})),.optimize=optimize,}),.use_llvm=false,.use_lld=false,});b.getInstallStep().dependOn(&b.addInstallArtifact(exe_gnu,.{.dest_dir=.{.override=.{.custom="gnu"}},.compiler_rt_dyn_lib_dir=.{.override=.{.custom="gnu"}},}).step);b.getInstallStep().dependOn(&b.addInstallArtifact(exe_msvc,.{.dest_dir=.{.override=.{.custom="msvc"}},.compiler_rt_dyn_lib_dir=.{.override=.{.custom="msvc"}},}).step);}
Without the ability to install the dll, using the self-hosted backed on windows with build.zig isn't possible.
Changes:
- x86_64: Copy arguments into the shadow store when generating a variadic function on Win64
- x86_64: Implement @cVaStart for Win64
- x86_64: Implement @cVaArg for Win64
- x86_64: Duplicate floating point register args equivalent integer registers when calling variadic functions on Win64
- tests: Enable var_args tests for the self-hosted backend on windows
- tests: Add var_args test for floating point arguments
- Build: support installing the `compiler_rt.dll`
I noticed there was missing test coverage for float variadic arguments, which I added - but it's disabled for the llvm backend on non-windows, as it was failing when I tested it locally on linux.
The `compiler_rt.dll` change is an extension of the existing hack used for the x86_64 backend when combined with the Coff linker. If that is not a desirable change I can drop that commit from this PR, but it was very useful for me in my local testing, as I could do the following, ie:
```zig
pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const exe_gnu = b.addExecutable(.{
.name = "args_gnu",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.resolveTargetQuery(try std.Target.Query.parse(.{
.arch_os_abi = "x86_64-windows-gnu",
})),
.optimize = optimize,
}),
.use_llvm = false,
.use_lld = false,
});
const exe_msvc = b.addExecutable(.{
.name = "args_msvc",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.resolveTargetQuery(try std.Target.Query.parse(.{
.arch_os_abi = "x86_64-windows-msvc",
})),
.optimize = optimize,
}),
.use_llvm = false,
.use_lld = false,
});
b.getInstallStep().dependOn(&b.addInstallArtifact(exe_gnu, .{
.dest_dir = .{ .override = .{ .custom = "gnu" } },
.compiler_rt_dyn_lib_dir = .{ .override = .{ .custom = "gnu" } },
}).step);
b.getInstallStep().dependOn(&b.addInstallArtifact(exe_msvc, .{
.dest_dir = .{ .override = .{ .custom = "msvc" } },
.compiler_rt_dyn_lib_dir = .{ .override = .{ .custom = "msvc" } },
}).step);
}
```
Without the ability to install the dll, using the self-hosted backed on windows with build.zig isn't possible.