| author | |
| committer | |
| log | e1ce81eb546e10ae505b411b6882266d1834fce1 |
| tree | 373df001de7f20af02de0d675087fd5071ca7675 |
| parent | a9423234a6a4eb5bad25e12829b5a1a09ba9ca96 |
3 files changed, 11 insertions(+), 2 deletions(-)
src/link/Elf/ZigObject.zig+1-1| ... | @@ -1386,7 +1386,7 @@ fn updateNavCode( | ... | @@ -1386,7 +1386,7 @@ fn updateNavCode( |
| 1386 | .none => switch (mod.optimize_mode) { | 1386 | .none => switch (mod.optimize_mode) { |
| 1387 | .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target), | 1387 | .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target), |
| 1388 | .ReleaseSmall => target_util.minFunctionAlignment(target), | 1388 | .ReleaseSmall => target_util.minFunctionAlignment(target), |
| 1389 | }, | 1389 | }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)), |
| 1390 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), | 1390 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
| 1391 | }; | 1391 | }; |
| 1392 | 1392 |
src/link/Elf2.zig+1-1| ... | @@ -2863,7 +2863,7 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Node.NavM | ... | @@ -2863,7 +2863,7 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Node.NavM |
| 2863 | .ReleaseFast, | 2863 | .ReleaseFast, |
| 2864 | => target_util.defaultFunctionAlignment(target), | 2864 | => target_util.defaultFunctionAlignment(target), |
| 2865 | .ReleaseSmall => min, | 2865 | .ReleaseSmall => min, |
| 2866 | }, | 2866 | }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)), |
| 2867 | }; | 2867 | }; |
| 2868 | }, | 2868 | }, |
| 2869 | else => switch (nav.resolved.?.@"align") { | 2869 | else => switch (nav.resolved.?.@"align") { |
test/behavior/align.zig+9| ... | @@ -15,6 +15,15 @@ test "global variable alignment" { | ... | @@ -15,6 +15,15 @@ test "global variable alignment" { |
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | test "large abi alignment of global" { | ||
| 19 | const S = struct { | ||
| 20 | var global: @This() = undefined; | ||
| 21 | x: u64 align(64), | ||
| 22 | }; | ||
| 23 | |||
| 24 | try std.testing.expect(@ctz(@intFromPtr(&S.global)) >= 6); | ||
| 25 | } | ||
| 26 | |||
| 18 | test "large alignment of local constant" { | 27 | test "large alignment of local constant" { |
| 19 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 28 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 20 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // flaky | 29 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // flaky |