Factory.ai

Open-Source Wikis

/

LLVM

/

Subprojects

/

llvm-libgcc

llvm/llvm-project

llvm-libgcc

llvm-libgcc/ is a small, mostly-CMake subproject that builds an libgcc_s-compatible shared library out of the LLVM-supplied builtins and unwinder. It is not a full reimplementation of GCC's libgcc; it is a glue layer.

Purpose

GCC's libgcc_s is the runtime that ships alongside the GCC toolchain. It provides compiler builtins, exception unwinding, and a set of versioned symbols that many Linux distributions assume exist. When building a toolchain that uses Clang as the system compiler but still needs to satisfy libgcc_s.so.1-named dependencies, llvm-libgcc combines the LLVM equivalents:

  • builtins from compiler-rt's lib/builtins/
  • stack unwinder from libunwind
  • a versioned symbol script to expose them under the names downstream consumers expect

into a drop-in replacement library.

Directory layout

llvm-libgcc/
├── CMakeLists.txt
├── docs/
├── gcc_s.ver.in              # Versioned symbol list (input to the generator script)
└── generate_version_script.py # Generator for the linker script

The subproject contains only four files in the working tree at this snapshot. Everything substantive happens in CMake — it pulls in the right artifacts from compiler-rt and libunwind and links them into a single shared object with the appropriate version map.

Build

llvm-libgcc is a runtime, configured via LLVM_ENABLE_RUNTIMES. Most distributions don't need this layer (they ship gcc's libgcc alongside an LLVM toolchain), but full LLVM-only toolchains do. The subproject's docs (under llvm-libgcc/docs/) describe what to enable.

Integration points

  • compiler-rt (compiler-rt) — supplies the actual builtin implementations.
  • libunwind (libunwind) — supplies the unwinder.
  • GCC toolchains are the implicit reference point — the version script mirrors theirs.

Reference

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

llvm-libgcc – LLVM wiki | Factory