mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 14:59:14 +00:00
Merge pull request #17419 from ziglang/unsound-native-target-info
std: fix memory bug in getExternalExecutor
This commit is contained in:
commit
41a4908dcc
@ -679,7 +679,7 @@ fn runCommand(
|
||||
}
|
||||
|
||||
const need_cross_glibc = exe.target.isGnuLibC() and exe.is_linking_libc;
|
||||
switch (b.host.getExternalExecutor(exe.target_info, .{
|
||||
switch (b.host.getExternalExecutor(&exe.target_info, .{
|
||||
.qemu_fixes_dl = need_cross_glibc and b.glibc_runtimes_dir != null,
|
||||
.link_libc = exe.is_linking_libc,
|
||||
})) {
|
||||
|
||||
@ -1002,7 +1002,7 @@ pub const GetExternalExecutorOptions = struct {
|
||||
/// of the other target.
|
||||
pub fn getExternalExecutor(
|
||||
host: NativeTargetInfo,
|
||||
candidate: NativeTargetInfo,
|
||||
candidate: *const NativeTargetInfo,
|
||||
options: GetExternalExecutorOptions,
|
||||
) Executor {
|
||||
const os_match = host.target.os.tag == candidate.target.os.tag;
|
||||
|
||||
@ -3667,7 +3667,7 @@ fn buildOutputType(
|
||||
test_exec_args.items,
|
||||
self_exe_path.?,
|
||||
arg_mode,
|
||||
target_info,
|
||||
&target_info,
|
||||
&comp_destroyed,
|
||||
all_args,
|
||||
runtime_args_start,
|
||||
@ -3995,7 +3995,7 @@ fn runOrTest(
|
||||
test_exec_args: []const ?[]const u8,
|
||||
self_exe_path: []const u8,
|
||||
arg_mode: ArgMode,
|
||||
target_info: std.zig.system.NativeTargetInfo,
|
||||
target_info: *const std.zig.system.NativeTargetInfo,
|
||||
comp_destroyed: *bool,
|
||||
all_args: []const []const u8,
|
||||
runtime_args_start: ?usize,
|
||||
@ -6256,7 +6256,7 @@ fn parseIntSuffix(arg: []const u8, prefix_len: usize) u64 {
|
||||
fn warnAboutForeignBinaries(
|
||||
arena: Allocator,
|
||||
arg_mode: ArgMode,
|
||||
target_info: std.zig.system.NativeTargetInfo,
|
||||
target_info: *const std.zig.system.NativeTargetInfo,
|
||||
link_libc: bool,
|
||||
) !void {
|
||||
const host_cross_target: std.zig.CrossTarget = .{};
|
||||
|
||||
@ -590,7 +590,7 @@ pub fn lowerToBuildSteps(
|
||||
const run = if (case.target.ofmt == .c) run_step: {
|
||||
const target_info = std.zig.system.NativeTargetInfo.detect(case.target) catch |err|
|
||||
std.debug.panic("unable to detect notive host: {s}\n", .{@errorName(err)});
|
||||
if (host.getExternalExecutor(target_info, .{ .link_libc = true }) != .native) {
|
||||
if (host.getExternalExecutor(&target_info, .{ .link_libc = true }) != .native) {
|
||||
// We wouldn't be able to run the compiled C code.
|
||||
break :no_exec;
|
||||
}
|
||||
|
||||
@ -1571,7 +1571,7 @@ fn genHtml(
|
||||
const target_info = try std.zig.system.NativeTargetInfo.detect(
|
||||
cross_target,
|
||||
);
|
||||
switch (host.getExternalExecutor(target_info, .{
|
||||
switch (host.getExternalExecutor(&target_info, .{
|
||||
.link_libc = code.link_libc,
|
||||
})) {
|
||||
.native => {},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user