Skip to content

tracking: Towards full LLVM (no gnu toolchain) builds #19642

@kaspar030

Description

@kaspar030

Description

Currently, RIOT has limited LLVM support - it allows compiling with LLVM. Linking is still using the gnu toolchain.
Also, our libcs (newlib, picolibc) are gcc compiles, and thus depend on libgcc.

Those dependencies have several drawbacks:

  1. LLVM+LTO doesn't work (as GNU ld doesn't understand clang's bitcode)
  2. LLVM+LTO can't do LTO between libc/libgcc and RIOT code
  3. There's a GCC toolchain per architecture, those are maintenance heavy and fragmented. Pure LLVM would reduce this to a single toolchain for most architectures (well, maybe xtensa would still need another build...). With pure-LLVM support, we could have a (possibly alternative) much thinner riotdocker image.
  4. Rust code (incl. RIOT-rs) is built using LLVM, the gcc linker prevents cross-language LTO

This is issue will track work necessary for LLVM-only builds.

  • make linker scripts compatible with lld
  • provide llvm-built libcs
    • picolibc allows building using llvm -> provide builds
    • while LLVM / clang usually support compiling for all architectures, they generate code that requires compiler-rt. -> provide builds of that
    • gcc has a working multilib mechanism to select the correct libc for a (sub-)architecture when linking. llvm doesn't, so this needs to be worked around
    • lld doesn't support spec files. directly select the correct libs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: toolchainArea: toolchains; everything related to compilation, libc, linking, …Type: trackingThe issue tracks and organizes the sub-tasks of a larger effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions