|
|
Log in / Subscribe / Register

LLVM += new architecture

LLVM += new architecture

Posted Feb 11, 2021 1:56 UTC (Thu) by marcH (subscriber, #57642)
In reply to: Python cryptography, Rust, and Gentoo by sthibaul
Parent article: Python cryptography, Rust, and Gentoo

> Basically you have to go over all your libc headers and describe them structure by structure, bit by bit to rust.

"All your libc headers" are not all architecture-specific, are they? Can you elaborate?

> > fringe platforms which can't even run a Rust compiler.

I can't wait the next LWN article on the real issue: how much effort is this really. Plural starts at two so LLVM must have some solid architecture abstractions, no?

> > The LLVM developers have been somewhat leery of taking on new architectures, unless they can be convinced there will be long-term support for them, which is understandable, but makes the problem even worse.

This could/should start in an unofficial branch. Don't distributions routinely tweak toolchains already? This caused most C portability issues across Linux distributions I've met. I understand rebasing such a branch would be more work (how much more?) than merely "tweaking" a toolchain but at least the tooling and workflow should be there already.

You may consider Rust "exotic" but LLVM is of course not.


to post comments

LLVM += new architecture

Posted Feb 11, 2021 10:58 UTC (Thu) by sthibaul (✭ supporter ✭, #54477) [Link] (1 responses)

> "All your libc headers" are not all architecture-specific, are they? Can you elaborate?

For a given OS, not all headers are arch-specific, but a large part of them is. Think about dirent structure, poll structure, fenv details, pthread structures, signal structures, stat structures, time structures, etc. ad nauseam.

And for a different OS, it's basically all the headers that need to be ported. Making basic free software libraries depend on rust basically means excluding from the free software game any non-Linux OS unless somebody takes up the daunting task of explaining the libc headers to Rust, while Rust could simply act like all other such languages (perl, python, haskell) do: just interpret the libc headers at configure time.

LLVM += new architecture

Posted Feb 26, 2021 13:48 UTC (Fri) by Gaelan (guest, #145108) [Link]

For what it's worth, there's bindgen, which automates the process of converting C headers to a Rust interface. It looks like the Rust people aren't using it for libc at the moment, but if you needed it to support a new architecture/libc, you could write a version of the libc crate that used bindgen, or just use bindgen's output as a starting point to add to the hand-written definitions in the libc crate.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds