Skip to content

Commit

Permalink
Merge pull request #17727 from ziglang/elf-memory-deferred
Browse files Browse the repository at this point in the history
x86_64+elf: do not pass hardcoded memory addresses in prep for build-obj
  • Loading branch information
kubkon committed Oct 28, 2023
2 parents d817a3c + 12b5c81 commit 13c7aa5
Show file tree
Hide file tree
Showing 18 changed files with 853 additions and 629 deletions.
2 changes: 0 additions & 2 deletions lib/compiler_rt/tan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ test "tan32" {
}

test "tan64" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

const epsilon = 0.000001;

try expect(math.approxEqAbs(f64, tan(0.0), 0.0, epsilon));
Expand Down
2 changes: 0 additions & 2 deletions lib/std/atomic/Atomic.zig
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ const atomic_rmw_orderings = [_]Ordering{
};

test "Atomic.swap" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

inline for (atomic_rmw_orderings) |ordering| {
var x = Atomic(usize).init(5);
try testing.expectEqual(x.swap(10, ordering), 5);
Expand Down
2 changes: 0 additions & 2 deletions lib/std/debug.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2513,8 +2513,6 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
}

test "manage resources correctly" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

if (builtin.os.tag == .wasi) return error.SkipZigTest;

if (builtin.os.tag == .windows) {
Expand Down
13 changes: 1 addition & 12 deletions lib/std/fmt/parse_float.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;
pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;

const std = @import("std");
const builtin = @import("builtin");
const math = std.math;
const testing = std.testing;
const expect = testing.expect;
Expand All @@ -14,8 +13,6 @@ const epsilon = 1e-7;
// See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data.

test "fmt.parseFloat" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

inline for ([_]type{ f16, f32, f64, f128 }) |T| {
try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
Expand Down Expand Up @@ -72,8 +69,6 @@ test "fmt.parseFloat" {
}

test "fmt.parseFloat nan and inf" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

inline for ([_]type{ f16, f32, f64, f128 }) |T| {
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);

Expand All @@ -88,16 +83,14 @@ test "fmt.parseFloat #11169" {
}

test "fmt.parseFloat hex.special" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;

try testing.expect(math.isNan(try parseFloat(f32, "nAn")));
try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf")));
try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf")));
try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf")));
}
test "fmt.parseFloat hex.zero" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0"));
try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0"));
try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42"));
Expand All @@ -106,8 +99,6 @@ test "fmt.parseFloat hex.zero" {
}

test "fmt.parseFloat hex.f16" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0);
try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5);
try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0);
Expand All @@ -124,8 +115,6 @@ test "fmt.parseFloat hex.f16" {
}

test "fmt.parseFloat hex.f32" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x"));
try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0);
try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5);
Expand Down
2 changes: 0 additions & 2 deletions lib/std/json/static_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,6 @@ test "max_value_len" {
}

test "parse into vector" {
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;

const T = struct {
vec_i32: @Vector(4, i32),
vec_f32: @Vector(2, f32),
Expand Down
6 changes: 1 addition & 5 deletions src/arch/aarch64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4012,7 +4012,6 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type
.got => .load_memory_ptr_got,
.direct => .load_memory_ptr_direct,
.import => unreachable,
.extern_got => unreachable,
};
const atom_index = switch (self.bin_file.tag) {
.macho => blk: {
Expand Down Expand Up @@ -5532,7 +5531,6 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
.got => .load_memory_ptr_got,
.direct => .load_memory_ptr_direct,
.import => unreachable,
.extern_got => unreachable,
};
const atom_index = switch (self.bin_file.tag) {
.macho => blk: {
Expand Down Expand Up @@ -5654,7 +5652,6 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
.got => .load_memory_got,
.direct => .load_memory_direct,
.import => .load_memory_import,
.extern_got => unreachable,
};
const atom_index = switch (self.bin_file.tag) {
.macho => blk: {
Expand Down Expand Up @@ -5852,7 +5849,6 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
.got => .load_memory_ptr_got,
.direct => .load_memory_ptr_direct,
.import => unreachable,
.extern_got => unreachable,
};
const atom_index = switch (self.bin_file.tag) {
.macho => blk: {
Expand Down Expand Up @@ -6180,7 +6176,7 @@ fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue {
.memory => |addr| .{ .memory = addr },
.load_got => |sym_index| .{ .linker_load = .{ .type = .got, .sym_index = sym_index } },
.load_direct => |sym_index| .{ .linker_load = .{ .type = .direct, .sym_index = sym_index } },
.load_extern_got, .load_tlv => unreachable, // TODO
.load_symbol, .load_tlv => unreachable, // TODO
},
.fail => |msg| {
self.err_msg = msg;
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6135,7 +6135,7 @@ fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue {
.mcv => |mcv| switch (mcv) {
.none => .none,
.undef => .undef,
.load_got, .load_extern_got, .load_direct, .load_tlv => unreachable, // TODO
.load_got, .load_symbol, .load_direct, .load_tlv => unreachable, // TODO
.immediate => |imm| .{ .immediate = @as(u32, @truncate(imm)) },
.memory => |addr| .{ .memory = addr },
},
Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,7 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue {
.mcv => |mcv| switch (mcv) {
.none => .none,
.undef => .undef,
.load_got, .load_extern_got, .load_direct, .load_tlv => unreachable, // TODO
.load_got, .load_symbol, .load_direct, .load_tlv => unreachable, // TODO
.immediate => |imm| .{ .immediate = imm },
.memory => |addr| .{ .memory = addr },
},
Expand Down
2 changes: 1 addition & 1 deletion src/arch/sparc64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4137,7 +4137,7 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue {
.mcv => |mcv| switch (mcv) {
.none => .none,
.undef => .undef,
.load_got, .load_extern_got, .load_direct, .load_tlv => unreachable, // TODO
.load_got, .load_symbol, .load_direct, .load_tlv => unreachable, // TODO
.immediate => |imm| .{ .immediate = imm },
.memory => |addr| .{ .memory = addr },
},
Expand Down

0 comments on commit 13c7aa5

Please sign in to comment.