Skip to content

Add C-implementation for builds on stable rust #24

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bossmc
Copy link

@bossmc bossmc commented Jun 30, 2019

asm! is still a way from being stabilised, but it would be really useful to use this crate on stable (though unsafe) rust.

This PR adds a build.rs which detects if you're on stable/beta vs nightly and uses GCC to compile the syscall<n> functions from small C snippets (using __asm__). The C code is, well should be, equivalent to the rust code, though I've not been able to test on any platform other than x86_64 linux.

A minor disadvantage, the C functions can't easily be inlined (though I suspect LTO might be able to).

Platform support (compared to the rust implementations):

  • linux-x86
  • linux-x86_64
  • linux-powerpc
  • linux-powerpc64
  • linux-armeabi
  • freebsd-x86_64
  • linux-sparc64
  • linux-mips
  • linux-mips64
  • linux-aarch64
  • macos-x86_64

@nicbn
Copy link

nicbn commented Apr 20, 2022

asm is now stable.

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