aboutsummaryrefslogtreecommitdiff

    musl libc

musl, pronounced like the word "mussel", is an MIT-licensed
implementation of the standard C library targetting the Linux syscall
API, suitable for use in a wide range of deployment environments. musl
offers efficient static and dynamic linking support, lightweight code
and low runtime overhead, strong fail-safe guarantees under correct
usage, and correctness in the sense of standards conformance and
safety. musl is built on the principle that these goals are best
achieved through simple code that is easy to understand and maintain.

The 1.1 release series for musl features coverage for all interfaces
defined in ISO C99 and POSIX 2008 base, along with a number of
non-standardized interfaces for compatibility with Linux, BSD, and
glibc functionality.

For basic installation instructions, see the included INSTALL file.
Information on full musl-targeted compiler toolchains, system
bootstrapping, and Linux distributions built on musl can be found on
the project website:

    http://www.musl-libc.org/

Quick Installation Guide for musl libc
======================================

There are many different ways to install musl depending on your usage
case. This document covers only the build and installation of musl by
itself, which is useful for upgrading an existing musl-based system or
compiler toolchain, or for using the provided musl-gcc wrapper with an
existing non-musl-based compiler.

Building complete native or cross-compiler toolchains is outside the
scope of this INSTALL file. More information can be found on the musl
website and community wiki.


Build Prerequisites
-------------------

The only build-time prerequisites for musl are GNU Make and a
freestanding C99 compiler toolchain targeting the desired instruction
set architecture and ABI, with support for a minimal subset of "GNU C"
extensions consisting mainly of gcc-style inline assembly, weak
aliases, hidden visibility, and stand-alone assembly source files.

GCC, LLVM/clang, Firm/cparser, and PCC have all successfully built
musl, but GCC is the most widely used/tested. Recent compiler (and
binutils) versions should be used if possible since some older
versions have bugs which affect musl.

The system used to build musl does not need to be Linux-based, nor do
the Linux kernel headers need to be available.



Supported Targets
-----------------

musl can be built for the following CPU instruction set architecture
and ABI combinations:

* i386
    * Minimum CPU model is actually 80486 unless kernel emulation of
      the `cmpxchg` instruction is added

* x86_64
    * ILP32 ABI (x32) is available as a separate arch but is still
      experimental

* ARM
    * EABI, standard or hard-float VFP variant
    * Little-endian default; big-endian variants also supported
    * Compiler toolchains only support armv4t and later

* AArch64
    * Little-endian default; big-endian variants also supported

* MIPS
    * ABI is o32, fp32/fpxx (except on r6 which is fp64)
    * Big-endian default; little-endian variants also supported
    * Default ABI variant uses FPU registers; alternate soft-float ABI
      that does not use FPU registers or instructions is available
    * MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
      is required
    * MIPS32r6, an incompatible ISA, is supported as a variant "mipsr6"

* MIPS64
    * ABI is n64 (LP64) or n32 (ILP32)
    * Big-endian default; little-endian variants also supported
    * Default ABI variant uses FPU registers; alternate soft-float ABI
      that does not use FPU registers or instructions is available

* PowerPC
    * Compiler toolchain must provide 64-bit long double, not IBM
      double-double or IEEE quad
    * For dynamic linking, compiler toolchain must be configured for
      "secure PLT" variant

* PowerPC64
    * Both little and big endian variants are supported
    * Compiler toolchain must provide 64-bit long double, not IBM
      double-double or IEEE quad
    * Compiler toolchain must use the new (ELFv2) ABI regardless of
      whether it is for little or big endian

* S390X (64-bit S390)

* SuperH (SH)
    * Standard ELF ABI or FDPIC ABI (shared-text without MMU)
    * Little-endian by default; big-endian variant also supported
    * Full FPU ABI or soft-float ABI is supported, but the
      single-precision-only FPU ABI is not

* Microblaze
    * Big-endian default; little-endian variants also supported
    * Soft-float
    * Requires support for lwx/swx instructions

* OpenRISC 1000 (or1k)

* RISC-V 64
    * Little endian
    * Hard, soft, and hard-single/soft-double floating point ABIs
    * Standard ELF; no shared-text NOMMU support