-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
stage1 C ABI compatibility #1481
Comments
Update: I just merged a branch into master which does the following things:
const ASmallUnion = extern union {
r: u8,
};
extern fn foo(x: ASmallUnion) void;
pub fn main() void {
const x = ASmallUnion{ .r = 0x12 };
foo(col);
}
|
also panic instead of emitting bad code for returning small structs See #1481
Zig will now either panic or emit a compile error when C ABI compatibility is required that it doesn't support yet. Therefore this issue is now an enhancement in order to provide additional C ABI compatibility and not a bug. For those who find this issue from the compile error, leave a comment detailing your specific needs and I'll see if I can code those up for you to unblock you, so you don't have to wait for this issue to be 100% solved. |
Running into this issue when trying to work with the godot native headers. |
Running into this when bringing up the BGFX rendering library on 64-bit Linux. My code calls the following function:
Error message:
The macro evaluates to the following struct definition:
This seems to correspond to "x86_64: struct & union return values <= 16 bytes," above. Please advise on how to get unblocked. 😃 Thanks much for your hard work! |
I'm using BGFX as well - not sure if @DavidYKay 's issue will affect me as well, but it will most likely end up blocking me too. Trying to use the CSFML Network API -
I'm using the CSFML library - csfml: stable 2.4 (bottled), HEAD I installed via homebrew on macOS High Sierra 10.13.6 (17G65) Here is the related header file(s) - https://github.com/SFML/CSFML/blob/master/include/SFML/Network/TcpListener.h Here's the offending function signature written in Zig - And the error -
And here's the above example, without using
|
Trying to run @sizeof builtin on packed structs from 2 bytes to 8 bytes, compiler emits the following: error: TODO: support C ABI for more targets. #1481 This is the relevant code (from x86_64.zig):
From kzig.zig:
|
I'm trying to use XCB, translating this hello world program into Zig. Here's what I have so far:
And the error message:
Referring to the type of Also, I am a newcomer to Zig, so it's possible I'm doing something wrong. Thank you for your time! |
trying to use https://github.com/cimgui/cimgui struct ImVec2
{
float x, y;
}; |
Vector ABI depends on the compiler flags on x86_64, and current the c_abi tests have the compiler flags mixed up so that the zig version expects arguments to be passed in registers (such as %ymm0 and %zmm0 that don't exist on earlier CPUs, which only have %xmm0 et cetera) and the c version expects things to be passed on the stack. But clearly the C can also pass on the stack with certain arguments https://godbolt.org/z/RCPb2c , we are passing -march=native so I don't know what we get the stack behavior https://godbolt.org/z/DzE_Px |
when will these goals be achieved? |
when stage2/0.10.0 is released |
Getting this using zig-imgui (project code here):
Where:
Builds on Windows but not on Linux, both running Zig 0.10.0-dev.3559+d2342370f. Edit Working around this circumstance with |
No longer relevant, test coverage in |
Hey @Vexu , I didn't get why you've closed this issue, is the stage1 fully compatible now? I'm especially interested in the |
Stage1 no longer exists. |
😳 |
@andrewrk |
All but complex number tests are passing for arm, if you find some case that doesn't work report it as a new bug. |
Ok |
You are talking about the |
Most of the ABI improvements should have already landed in 0.10.0 (for self-hosted). |
What about tasks?
They are unchecked in @andrewrk's post. |
This issue is to track C ABI compatibility support in the stage1 compiler.
Here's what support looks like currently:
For those who find this issue from the compile error, leave a comment detailing your specific needs and I'll see if I can code those up for you to unblock you, so you don't have to wait for this issue to be 100% solved.
The text was updated successfully, but these errors were encountered: