Skip to content

Architecture: Implemented SPARC.#2

Open
Muz-dev wants to merge 14 commits into
FWGS:masterfrom
Muz-dev:master
Open

Architecture: Implemented SPARC.#2
Muz-dev wants to merge 14 commits into
FWGS:masterfrom
Muz-dev:master

Conversation

@Muz-dev
Copy link
Copy Markdown

@Muz-dev Muz-dev commented May 9, 2026

I have added SPARC support into this library and plan to implement it for the rest of xash. If you could point out any other info that I should use to port over to SPARC that would be great!
As you can also see from the commit titles, I made some files executable.

Comment thread include/build.h Outdated
Comment thread src/library_suffix.c Outdated
case ARCHITECTURE_WASM:
return is64 ? "wasm64" : "wasm32";
case ARCHITECTURE_SPARC:
return "sparc";
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.

Do sparc binaries are backwards compatible? As far as I know, there is at least 32-bit and 64-bit sparcs.

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.

I mean something like this is64 ? "sparc64" : "sparc".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I believe you can run 32 bit sparc on 64 bit sparc. If you want I can seperate sparc64 anyways.

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.

Yes, but I doubt you can load 32-bit libraries in 64-bit process. The same problem that exists on both x86 and ARM.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

So you would like me to separate sparc and sparc64 like done with mips?

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.

Yes, but you're the author of the patch. I just don't think SPARC is any special from every other architecture that over the history supported both 32-bit and 64-bit long addressing.

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.

Also, yes, if you would do that, also update the test. It exists there just so we can sure we never broken the naming.

The naming is important because that's what engine will pick up when loading game's DLLs.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I believe this has been update.

Comment thread tests/wscript
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.

Drop the mode changes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fix.

@Muz-dev
Copy link
Copy Markdown
Author

Muz-dev commented May 10, 2026

I was also wondering, where can I find help with porting to SPARC. I have build but am getting very early segfault and am not sure what is wrong.

@a1batross
Copy link
Copy Markdown
Member

I was also wondering, where can I find help with porting to SPARC. I have build but am getting very early segfault and am not sure what is wrong.

There is an engine porting guide in the engine's documentation. It has been written long ago, but still applies. I would recommend at least getting dedicated server up and running, it reduces the scope.

@Muz-dev
Copy link
Copy Markdown
Author

Muz-dev commented May 10, 2026

Thanks, I'll take a look.

Comment thread include/build.h Outdated
#define XASH_WASM 1
#elif defined __sparc__
#define XASH_SPARC 1
#define __arch64__
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.

Are you sure about that? Why do you define __arch64__?

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.

Also use tabs here too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Tab's fixed.

Also, oops! define was supposed to be if defined, clearly wasn't paying attention!

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.

Now you're missing #endif ^^

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

Comment thread include/buildenums.h Outdated
#elif XASH_WASM
#define XASH_ARCHITECTURE ARCHITECTURE_WASM
#elif XASH_SPARC
#define XASH_ARCHITECTURE ARCHITECTURE_SPARC
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.

Use tabs.

Comment thread src/library_suffix.c Outdated
case ARCHITECTURE_WASM:
return is64 ? "wasm64" : "wasm32";
case ARCHITECTURE_SPARC:
return is64 ? "sparc64" : "sparc";
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.

Use tabs.

Alex Larbe added 2 commits May 10, 2026 20:29
@Muz-dev
Copy link
Copy Markdown
Author

Muz-dev commented May 10, 2026

All tabs resolved.

Comment thread src/library_suffix.c Outdated
case ARCHITECTURE_WASM:
return is64 ? "wasm64" : "wasm32";
case ARCHITECTURE_SPARC:
return is64 ? "sparc64" : "sparc";
Copy link
Copy Markdown
Member

@a1batross a1batross May 10, 2026

Choose a reason for hiding this comment

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

Still spaces here. Please reconfigure or uninstall your text editor.

Suggested change
return is64 ? "sparc64" : "sparc";
return is64 ? "sparc64" : "sparc";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think this is reconfigured correctly.

Comment thread include/build.h
//================================================================
//
// PLATFORM DETECTION CODE
// PLATFORM DETECTION CODE
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.

Useless change.

Really, just uninstall your code editor.

Comment thread include/buildenums.h
#define PLATFORM_APPLE 5
#define PLATFORM_NETBSD 6
#define PLATFORM_OPENBSD 7
#define PLATFORM_WIN32 1
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.

Yep, it's much worse now. Revert all of this. Only keep your own SPARC related changes.

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.

2 participants