mirror of
https://github.com/ziglang/zig.git
synced 2026-02-16 06:18:32 +00:00
target: use 16 byte alignment for 128-bit types on x86 and ofmt .c
This commit is contained in:
parent
0d249e558a
commit
4a330ab811
@ -1821,7 +1821,7 @@ pub const Target = struct {
|
||||
.wasm64,
|
||||
=> 8,
|
||||
|
||||
.x86 => return switch (target.os.tag) {
|
||||
.x86 => if (target.ofmt == .c) 16 else return switch (target.os.tag) {
|
||||
.windows, .uefi => 8,
|
||||
else => 4,
|
||||
},
|
||||
|
||||
@ -65,9 +65,6 @@ test "alignment and size of structs with 128-bit fields" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
|
||||
// https://github.com/ziglang/zig/issues/14371
|
||||
if (builtin.zig_backend == .stage2_c and builtin.target.cpu.arch == .x86) return error.SkipZigTest;
|
||||
|
||||
const A = struct {
|
||||
x: u128,
|
||||
};
|
||||
@ -107,7 +104,18 @@ test "alignment and size of structs with 128-bit fields" {
|
||||
.u129_size = 24,
|
||||
},
|
||||
|
||||
.x86 => switch (builtin.os.tag) {
|
||||
.x86 => if (builtin.object_format == .c) .{
|
||||
.a_align = 16,
|
||||
.a_size = 16,
|
||||
|
||||
.b_align = 16,
|
||||
.b_size = 32,
|
||||
|
||||
.u128_align = 16,
|
||||
.u128_size = 16,
|
||||
.u129_align = 16,
|
||||
.u129_size = 32,
|
||||
} else switch (builtin.os.tag) {
|
||||
.windows => .{
|
||||
.a_align = 8,
|
||||
.a_size = 16,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user