Skip to content

feat: add support for sparc32#23381

Closed
thepabloaguilar wants to merge 1 commit intoziglang:masterfrom
thepabloaguilar:issue-23081
Closed

feat: add support for sparc32#23381
thepabloaguilar wants to merge 1 commit intoziglang:masterfrom
thepabloaguilar:issue-23081

Conversation

@thepabloaguilar
Copy link
Copy Markdown

@thepabloaguilar thepabloaguilar commented Mar 27, 2025

Hi, this is an attempt to give support for SPARC32! As I noticed Zig has already support for SPARC64 I've copied and pasted the code changing the syscall instruction from t 0x6d to t 0x10 as this manpage highlight: syscall(2) — Linux manual page.

Also, I didn't find the references in fork call for the 32bit but I think it'll the same as 64bit where the result is two values.

Note

I really want to get into contributing to Zig, so if you think this is not a good start issue or something like that let me know where I can improve and study more. Thanks.

ref #23081

@alexrp
Copy link
Copy Markdown
Member

alexrp commented Mar 27, 2025

As I noticed Zig has already support for SPARC64 I've copied and pasted the code changing the syscall instruction from t 0x6d to t 0x10 as this manpage highlight: syscall(2) — Linux manual page.

You also need to verify that all the types are correct for 32-bit. In general, for SPARC, the best references are going to be the Linux kernel and glibc source trees.

Just be mindful that the types that glibc exposes publicly don't always have the same layout as the types the kernel exposes in the syscall interface, and std.os.linux is primarily concerned with the syscall interface.

Also, I didn't find the references in fork call for the 32bit but I think it'll the same as 64bit where the result is two values.

Similarly, you can check what glibc is doing.

closes #23081

It'll actually take a lot more to get sparc-linux to Tier 1; this is just one step on the way. 🙂 I need to get around to updating all the Tier System issues to properly lay out the new requirements.

Comment thread lib/std/os/linux.zig
.hexagon => @import("linux/hexagon.zig"),
.riscv32 => @import("linux/riscv32.zig"),
.riscv64 => @import("linux/riscv64.zig"),
.sparc => @import("linux/sparc32.zig"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file name should just be sparc.zig to match the target triple spelling.

@alexrp alexrp self-assigned this May 17, 2025
@andrewrk
Copy link
Copy Markdown
Member

This pull request is not ready for review because:

  • It has conflicts that must be resolved via rebasing against latest origin/master.
  • It is not passing the CI tests.

Since we have moved development to Codeberg, please open your pull request there if you would like to continue these efforts.

@andrewrk andrewrk closed this Nov 27, 2025
@alexrp alexrp removed their assignment Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants