Skip to content

tools/generate_linux_syscalls.zig could be cleaned up to be table-driven #20801

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

Closed
alexrp opened this issue Jul 26, 2024 · 8 comments · Fixed by #20895
Closed

tools/generate_linux_syscalls.zig could be cleaned up to be table-driven #20801

alexrp opened this issue Jul 26, 2024 · 8 comments · Fixed by #20895
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@alexrp
Copy link
Member

alexrp commented Jul 26, 2024

As I'm adding more architectures to this, it's starting to become a bit much to just copy/paste all the code for the old syscall table approach and the new C preprocessor approach.

If anyone feels like it, it should be fairly easy to clean this tool up to be table-driven, with only a few lines of special-casing for some architectures.

@andrewrk andrewrk added this to the unplanned milestone Jul 26, 2024
@kubkon kubkon added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels Jul 28, 2024
@ippsav
Copy link
Contributor

ippsav commented Jul 28, 2024

I ll give this a go

@alexrp
Copy link
Member Author

alexrp commented Jul 28, 2024

@ippsav thank you! Can you base your work on the version of the script in my linux-syscalls branch? I won't be able to upstream it until #20389 is merged, but we can at least avoid merge conflicts this way.

@ippsav
Copy link
Contributor

ippsav commented Jul 28, 2024

@alexrp lemme know what you think about this and if there is any changes you would like to add
https://github.com/ippsav/zig/blob/ippsav/rewrite-generate-linux-syscalls/tools/generate_linux_syscalls.zig

It is based on the changes you've added.

Though i need to spin up a linux vm to test it's behavior compared to the old one, or can i just do it directly from a mac ?

@alexrp
Copy link
Member Author

alexrp commented Jul 28, 2024

This looks like a good direction to me so far.

You should be able to run it on macOS provided you have a clone of the Linux 6.7 tree to point it to. git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux && cd linux && git checkout v6.7 will get you that.

@ippsav
Copy link
Contributor

ippsav commented Jul 29, 2024

@alexrp I've pushed some changes, tested it, works properly.

The only issue is with hexagon arch throws an error invalid target generic

@alexrp
Copy link
Member Author

alexrp commented Jul 29, 2024

Yeah, the Hexagon support depends on #20798, so that's expected.

Will let you know once #20389 and my linux-syscalls branch are upstreamed so you can open a pull request w/o merge conflicts. Thanks for working on this!

@ippsav
Copy link
Contributor

ippsav commented Jul 29, 2024

Thanks !

@alexrp
Copy link
Member Author

alexrp commented Aug 1, 2024

@ippsav #20869 is merged, so you can go ahead and rebase your work on master and submit a PR. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants