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

Add atomic_shim to support platforms where 64-bit atomics are not available #23

Merged
merged 3 commits into from
Jul 20, 2020
Merged

Add atomic_shim to support platforms where 64-bit atomics are not available #23

merged 3 commits into from
Jul 20, 2020

Conversation

nazar554
Copy link
Contributor

@nazar554 nazar554 commented Jul 18, 2020

Add atomic_shim to support platforms where 64-bit atomics are not available. Closes #22

atomic-shim does target detection, so it is using std::atomic where possible.

@nazar554 nazar554 marked this pull request as draft July 18, 2020 13:43
@nazar554
Copy link
Contributor Author

nazar554 commented Jul 18, 2020

Seems that it will need lazy_static on MIPS or something like that:

error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
  --> /cargo/git/checkouts/quanta-6fa06bec5aded43c/26e996a/src/lib.rs:66:35
   |
66 | static GLOBAL_RECENT: AtomicU64 = AtomicU64::new(0);
   |                                   ^^^^^^^^^^^^^^^^^

ctor works as well with #[ctor] attribute (on 0.3 branch)

0.6 doesn't build on MIPS yet because of

error[E0433]: failed to resolve: could not find `arch` in `self`
  --> /cargo/registry/src/github.com-1ecc6299db9ec823/raw-cpuid-8.1.1/src/lib.rs:50:37
   |
50 |         let result = unsafe { self::arch::__cpuid_count(a, c) };
   |                                     ^^^^ could not find `arch` in `self`

…ilable

Signed-off-by: Nazar Mishturak <nazarmx@gmail.com>
@tobz
Copy link
Member

tobz commented Jul 19, 2020

@nazar554 Can you port the #[ctor] change from your feature branch into this one so we can keep constness?

Signed-off-by: Nazar Mishturak <nazarmx@gmail.com>
Signed-off-by: Nazar Mishturak <nazarmx@gmail.com>
@nazar554 nazar554 marked this pull request as ready for review July 19, 2020 18:01
@nazar554
Copy link
Contributor Author

@tobz Done, I also added #[cfg] checks around raw-cpuid so it actually builds on MIPS with cross

Copy link
Member

@tobz tobz left a comment

Choose a reason for hiding this comment

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

One small issue then I think we're good to merge.

Cargo.toml Show resolved Hide resolved
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.

does not build on MIPS
2 participants