Skip to content

Add C-implementation for builds on stable rust#24

Open
bossmc wants to merge 2 commits into
japaric:masterfrom
bossmc:stable-support
Open

Add C-implementation for builds on stable rust#24
bossmc wants to merge 2 commits into
japaric:masterfrom
bossmc:stable-support

Conversation

@bossmc

@bossmc bossmc commented Jun 30, 2019

Copy link
Copy Markdown

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

nicbn commented Apr 20, 2022

Copy link
Copy Markdown

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