# mstorsjo/llvm-mingw architecture

> Architecture diagram of the GitHub repository mstorsjo/llvm-mingw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mstorsjo/llvm-mingw
- Repository: https://github.com/mstorsjo/llvm-mingw

## Overview

LLVM MinGW is a reproducible build recipe for an LLVM/Clang/LLD-based MinGW cross- and native-toolchain. The documented source workflow starts with `build-all.sh`, which builds individual toolchain components into a target directory; Docker builds are another documented route. The resulting toolchain offers multi-architecture Windows compilation, CRT choices, runtimes and LLVM utilities, with wrapper programs adapting command names and arguments. Build-script internals were not sampled, so component-level build dependencies are not asserted; wrapper dispatch is shown where source excerpts establish it.

Main entry points: [`build-all.sh`](https://github.com/mstorsjo/llvm-mingw/blob/master/build-all.sh) (Build Orchestrator), [`wrappers/native-wrapper.h`](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/native-wrapper.h) (Native Wrapper Support), [`wrappers/clang-target-wrapper.c`](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/clang-target-wrapper.c) (Target Compiler), [`wrappers/clang-scan-deps-wrapper.c`](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/clang-scan-deps-wrapper.c) (Dependency Scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Toolchain Build"]
  node_build_all["Build Orchestrator<br/>[build-all.sh]"]
end

subgraph group_components["Toolchain Components"]
  node_llvm_build["LLVM Build<br/>[build-llvm.sh]"]
  node_compiler_rt["Compiler Runtime"]
  node_mingw["MinGW Target<br/>[build-mingw-w64.sh]"]
  node_libcxx["C++ Runtime<br/>[build-libcxx.sh]"]
  node_openmp["OpenMP Runtime<br/>[build-openmp.sh]"]
  node_lldb["LLDB MI<br/>[build-lldb-mi.sh]"]
  node_busybox["BusyBox Tools<br/>[build-busybox.sh]"]
end

subgraph group_wrappers["Command Wrappers"]
  node_target_wrapper["Target Compiler"]
  node_scan_wrapper["Dependency Scanner"]
  node_llvm_wrapper["LLVM Utility Wrapper<br/>[llvm-wrapper.c]"]
  node_busybox_wrapper["BusyBox Wrapper<br/>[busybox-wrapper.c]"]
  node_applet_list["Applet Listing"]
  node_native_support["Native Wrapper Support<br/>[native-wrapper.h]"]
end

subgraph group_outputs["Toolchain Outputs"]
  node_install["Installed Toolchain"]
  node_clang["Clang Driver"]
  node_scan_deps["Clang Scan Deps"]
  node_llvm_tools["LLVM Utilities"]
  node_busybox_bin["BusyBox Binary"]
end

node_engineer(("Toolchain Builder"))

node_engineer -->|"runs"| node_build_all
node_build_all -.->|"builds component"| node_llvm_build
node_build_all -.->|"builds component"| node_compiler_rt
node_build_all -.->|"builds component"| node_mingw
node_build_all -.->|"builds component"| node_libcxx
node_build_all -.->|"builds component"| node_openmp
node_build_all -.->|"builds component"| node_lldb
node_build_all -.->|"builds component"| node_busybox
node_build_all -->|"installs into"| node_install
node_target_wrapper -->|"uses"| node_native_support
node_target_wrapper -->|"executes"| node_clang
node_scan_wrapper -->|"uses"| node_native_support
node_scan_wrapper -->|"executes"| node_scan_deps
node_llvm_wrapper -->|"uses"| node_native_support
node_llvm_wrapper -->|"executes"| node_llvm_tools
node_busybox_wrapper -->|"uses"| node_native_support
node_busybox_wrapper -->|"executes"| node_busybox_bin

click node_build_all "https://github.com/mstorsjo/llvm-mingw/blob/master/build-all.sh"
click node_llvm_build "https://github.com/mstorsjo/llvm-mingw/blob/master/build-llvm.sh"
click node_compiler_rt "https://github.com/mstorsjo/llvm-mingw/blob/master/build-compiler-rt.sh"
click node_mingw "https://github.com/mstorsjo/llvm-mingw/blob/master/build-mingw-w64.sh"
click node_libcxx "https://github.com/mstorsjo/llvm-mingw/blob/master/build-libcxx.sh"
click node_openmp "https://github.com/mstorsjo/llvm-mingw/blob/master/build-openmp.sh"
click node_lldb "https://github.com/mstorsjo/llvm-mingw/blob/master/build-lldb-mi.sh"
click node_busybox "https://github.com/mstorsjo/llvm-mingw/blob/master/build-busybox.sh"
click node_target_wrapper "https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/clang-target-wrapper.c"
click node_scan_wrapper "https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/clang-scan-deps-wrapper.c"
click node_llvm_wrapper "https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/llvm-wrapper.c"
click node_busybox_wrapper "https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/busybox-wrapper.c"
click node_applet_list "https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/busybox-list-applets.c"
click node_native_support "https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/native-wrapper.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_build_all toneBlue
class node_llvm_build,node_compiler_rt,node_mingw,node_libcxx,node_openmp,node_lldb,node_busybox toneAmber
class node_target_wrapper,node_scan_wrapper,node_llvm_wrapper,node_busybox_wrapper,node_applet_list,node_native_support toneMint
class node_install,node_clang,node_scan_deps,node_llvm_tools,node_busybox_bin toneRose
class node_engineer toneIndigo
```

## Components

### Toolchain Build

- [Build Orchestrator](https://github.com/mstorsjo/llvm-mingw/blob/master/build-all.sh): `build-all.sh`

### Toolchain Components

- [LLVM Build](https://github.com/mstorsjo/llvm-mingw/blob/master/build-llvm.sh): `build-llvm.sh`
- [Compiler Runtime](https://github.com/mstorsjo/llvm-mingw/blob/master/build-compiler-rt.sh): `build-compiler-rt.sh`
- [MinGW Target](https://github.com/mstorsjo/llvm-mingw/blob/master/build-mingw-w64.sh): `build-mingw-w64.sh`
- [C++ Runtime](https://github.com/mstorsjo/llvm-mingw/blob/master/build-libcxx.sh): `build-libcxx.sh`
- [OpenMP Runtime](https://github.com/mstorsjo/llvm-mingw/blob/master/build-openmp.sh): `build-openmp.sh`
- [LLDB MI](https://github.com/mstorsjo/llvm-mingw/blob/master/build-lldb-mi.sh): `build-lldb-mi.sh`
- [BusyBox Tools](https://github.com/mstorsjo/llvm-mingw/blob/master/build-busybox.sh): `build-busybox.sh`

### Command Wrappers

- [Target Compiler](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/clang-target-wrapper.c): `wrappers/clang-target-wrapper.c`
- [Dependency Scanner](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/clang-scan-deps-wrapper.c): `wrappers/clang-scan-deps-wrapper.c`
- [LLVM Utility Wrapper](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/llvm-wrapper.c): `wrappers/llvm-wrapper.c`
- [BusyBox Wrapper](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/busybox-wrapper.c): `wrappers/busybox-wrapper.c`
- [Applet Listing](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/busybox-list-applets.c): `wrappers/busybox-list-applets.c`
- [Native Wrapper Support](https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/native-wrapper.h): `wrappers/native-wrapper.h`

### Toolchain Outputs

- **Installed Toolchain**
- **Clang Driver**
- **Clang Scan Deps**
- **LLVM Utilities**
- **BusyBox Binary**

### Other components

- **Toolchain Builder**

## Connections

- Toolchain Builder → Build Orchestrator: runs (evidence: `README.md`)
- Build Orchestrator → LLVM Build: builds component
- Build Orchestrator → Compiler Runtime: builds component
- Build Orchestrator → MinGW Target: builds component
- Build Orchestrator → C++ Runtime: builds component
- Build Orchestrator → OpenMP Runtime: builds component
- Build Orchestrator → LLDB MI: builds component
- Build Orchestrator → BusyBox Tools: builds component
- Build Orchestrator → Installed Toolchain: installs into (evidence: `README.md`)
- Target Compiler → Native Wrapper Support: uses (evidence: `wrappers/clang-target-wrapper.c`)
- Target Compiler → Clang Driver: executes (evidence: `wrappers/clang-target-wrapper.c`)
- Dependency Scanner → Native Wrapper Support: uses (evidence: `wrappers/clang-scan-deps-wrapper.c`)
- Dependency Scanner → Clang Scan Deps: executes (evidence: `wrappers/clang-scan-deps-wrapper.c`)
- LLVM Utility Wrapper → Native Wrapper Support: uses (evidence: `wrappers/llvm-wrapper.c`)
- LLVM Utility Wrapper → LLVM Utilities: executes (evidence: `wrappers/llvm-wrapper.c`)
- BusyBox Wrapper → Native Wrapper Support: uses (evidence: `wrappers/busybox-wrapper.c`)
- BusyBox Wrapper → BusyBox Binary: executes (evidence: `wrappers/busybox-wrapper.c`)
