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

Replace legacy sync* builtins with modern atomic* builtins: fixes build on 32-bit platforms #253

Open
barracuda156 opened this issue Oct 3, 2024 · 3 comments

Comments

@barracuda156
Copy link

@rakshasa Could you please take a look?

The issue is that old sync* builtins require 8-byte atomics support in hardware. That leaves 32-bit platforms (arm, ppc, mips) broken. What will work for both 64- and 32-bit platforms alike is usage of modern atomic* builtins. 32-bit archs will just need an explicit linking to libatomic.

This a patch which is confirmed to fix compilation on ppc, but maybe you can suggest a better solution or verify/improve upon this one?

https://github.com/macports/macports-ports/blob/4ac3291874cad2051b9cc1ba08cadd62643f92f5/net/libtorrent-devel/files/0001-Fix-atomics-for-modern-gcc.patch

@stickz
Copy link
Contributor

stickz commented Oct 10, 2024

@barracuda156 Could you submit a pull request for this patch? I'd like to take responsibility for testing this change and getting it incorporated into the project. I'll request a review from @rakshasa when the time is right and get it merged for you.

@rakshasa
Copy link
Owner

I'd rather replace them with std::atomic, as that will avoid any compiler dependency.

@barracuda156
Copy link
Author

@stickz Sorry, I am away from the testing hardware at the moment, so can’t do much until I am back.

@rakshasa If you can handle this, it will be much better, since I am not too sure that my fix is the right one.

(FWIW, we will still depend on libatomic on some 32-bit archs, AFAIU, as long as 8-byte atomics is needed in some form.)

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

No branches or pull requests

3 participants