-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More ABI size and alignment fixes #12145
Conversation
Hmm, here's the dilemma: This branch makes i128 ABI size and alignment agree with LLVM (8), which I think is an OK decision. However the previous value agreed with Clang (16), which made the alignment of extern structs and 128-bit integers correct for --- a/lib/std/target.zig
+++ b/lib/std/target.zig
@@ -9,6 +9,7 @@ pub const Target = struct {
cpu: Cpu,
os: Os,
abi: Abi,
+ ofmt: ObjectFormat,
pub const Os = struct {
tag: Tag, So those are the two choices we have:
|
I think we'd have to oversize any Edit: We'll need some layout fix-ups, too. For example, the lowered type for an What about FFI implications? Even Clang doesn't seem to be compliant with the SysV ABI on x86-64 for i128 arguments (rust-lang/rust#54341 (comment)). However, on platforms like AArch64 it looks like the 16-byte alignment is expected by the system ABI, and clang/gcc respect it. |
There's another problem with i128 on x86: LLVM will lower libcalls for us with the wrong calling convention (https://bugs.llvm.org/show_bug.cgi?id=50198) So even if we manage to enforce The right outcome really seems like it would be a fix upstream in LLVM (either to update the alignment of i128 to match the system ABI, or else a hack to lower the libcalls correctly, similar to what was done for Windows in https://reviews.llvm.org/D110413) |
on x86_64 and similar targets.
There still more instances of this check being tripped during behavior tests that we need to fix before we can enable this.
* riscv64: adjust alignment and size of 128-bit integers. * take ofmt=c into account for ABI alignment of 128-bit integers and structs. * Type: make packed struct support intInfo * fix f80 alignment for i386-windows-msvc
According to rust-lang/rust#116672, LLVM 18 will incerase u128 alignment to 16 |
Continuation of #12127. After this branch, there are no more instances of disagreements between LLVM ABI size and Zig ABI size when building stage3. However, it did not solve #11450.
The remaining ABI size mismatches that happen during behavior tests are: