Skip to content
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

translate-c: implement translation of GCC inline assembly #18537

Open
Ivan-Velickovic opened this issue Jan 13, 2024 · 3 comments
Open

translate-c: implement translation of GCC inline assembly #18537

Ivan-Velickovic opened this issue Jan 13, 2024 · 3 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. translate-c C to Zig source translation feature (@cImport)
Milestone

Comments

@Ivan-Velickovic
Copy link
Contributor

Zig's translate-c command/functionality is currently unable to translate inline assembly, resulting in the following message when attempting to do so: TODO implement translation of stmt class GCCAsmStmtClass.

I think it's okay to make these TODOs as tracking issues on GitHub, please close the issue if I am wrong.

For context, I want this functionality so I can translate the seL4 microkernel's C API for use from Zig code. The current process for getting it working is somewhat manual and so being able to have the API auto-translated would be great.

@silver-signal
Copy link
Contributor

Thanks for the tracking issue. I've actually been thinking about adding this, but I'm not sure how difficult it is. I'll take a look over the next week or so.

@Vexu Vexu added enhancement Solving this issue will likely involve adding new logic or components to the codebase. translate-c C to Zig source translation feature (@cImport) labels Jan 13, 2024
@Vexu Vexu added this to the 0.14.0 milestone Jan 13, 2024
@silver-signal
Copy link
Contributor

The main problem with handling this in translate-c is that asm isn't well supported by the language right now. Intel syntax isn't supported due to buggy behaviour in LLVM, and input/output constraints are considered unstable (according to the current docs).

It probably makes more sense to pursue this functionality when asm statements are at a happier place in zig.

Related issue #215.

@Ivan-Velickovic
Copy link
Contributor Author

Ivan-Velickovic commented Jan 19, 2024

Fair enough. Probably a good idea to wait than to have a partially working implementation in the mean-time.

Thanks for looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. translate-c C to Zig source translation feature (@cImport)
Projects
None yet
Development

No branches or pull requests

3 participants