All Projects → dslm4515 → CMLFS

dslm4515 / CMLFS

Licence: MIT license
Clang-Built Musl Linux From Scratch

Programming Languages

shell
77523 projects
c
50402 projects - #5 most used programming language
Roff
2310 projects
Vim Script
2826 projects

Projects that are alternatives of or similar to CMLFS

clangbuilder
Building Clang ♡ Utility and Environment
Stars: ✭ 101 (+98.04%)
Mutual labels:  llvm, clang
musl-wiki
A community-maintained wiki documenting the musl libc.
Stars: ✭ 61 (+19.61%)
Mutual labels:  musl, musl-libc
vuo
A realtime visual programming language for interactive media.
Stars: ✭ 103 (+101.96%)
Mutual labels:  llvm, clang
codebrowser
Woboq CodeBrowser
Stars: ✭ 985 (+1831.37%)
Mutual labels:  llvm, clang
sycl
SYCL for Vitis: Experimental fusion of triSYCL with Intel SYCL oneAPI DPC++ up-streaming effort into Clang/LLVM
Stars: ✭ 80 (+56.86%)
Mutual labels:  llvm, clang
TON-Compiler
Clang compiler for Free TON Virtual Machine
Stars: ✭ 56 (+9.8%)
Mutual labels:  llvm, clang
Chromium Clang
Chromium browser compiled with the Clang/LLVM compiler.
Stars: ✭ 77 (+50.98%)
Mutual labels:  llvm, clang
Constexpr Everything
Rewrite C++ code to automatically apply `constexpr` where possible
Stars: ✭ 178 (+249.02%)
Mutual labels:  llvm, clang
flextool
C++ compile-time programming (serialization, reflection, code modification, enum to string, better enum, enum to json, extend or parse language, etc.)
Stars: ✭ 32 (-37.25%)
Mutual labels:  llvm, clang
dumb-obfuscator
Tutorial on how to write the dumbest obfuscator I could think of.
Stars: ✭ 147 (+188.24%)
Mutual labels:  llvm, clang
Checkedc
Checked C is an extension to C that lets programmers write C code that is guaranteed by the compiler to be type-safe. The goal is to let people easily make their existing C code type-safe and eliminate entire classes of errors. Checked C does not address use-after-free errors. This repo has a wiki for Checked C, sample code, the specification, a…
Stars: ✭ 2,692 (+5178.43%)
Mutual labels:  llvm, clang
adorad
Fast, Expressive, & High-Performance Programming Language for those who dare
Stars: ✭ 54 (+5.88%)
Mutual labels:  llvm, clang
Cmake Scripts
A selection of useful scripts for use in CMake projects, include code coverage, sanitizers, and dependency graph generation.
Stars: ✭ 202 (+296.08%)
Mutual labels:  llvm, clang
linux
Linux kernel source tree
Stars: ✭ 234 (+358.82%)
Mutual labels:  llvm, clang
Clang Expand
🐉 A clang tool for happy refactoring without source-code gymnastics
Stars: ✭ 182 (+256.86%)
Mutual labels:  llvm, clang
EmbedSanitizer
EmbedSantizer is a runtime race detection tool which extends ThreadSanitizer to detect data races in 32-bit ARM applications.
Stars: ✭ 16 (-68.63%)
Mutual labels:  llvm, clang
Webassembly Examples
From Simple To Complex. A complete collection of webassembly examples.
Stars: ✭ 177 (+247.06%)
Mutual labels:  llvm, clang
Dstep
A tool for converting C and Objective-C headers to D modules
Stars: ✭ 177 (+247.06%)
Mutual labels:  llvm, clang
MetaCG
MetaCG offers an annotated whole program call-graph tool for Clang/LLVM.
Stars: ✭ 21 (-58.82%)
Mutual labels:  llvm, clang
FPChecker
A dynamic analysis tool to detect floating-point errors in HPC applications.
Stars: ✭ 26 (-49.02%)
Mutual labels:  llvm, clang

CMLFS - Clang Musl Linux From Scratch

CMLFS can either mean "Clang-built Musl Linux from Scratch" or "Clang MLFS". It started as a hobby to see if a Linux system can be built with clang as primary toolchain and GCC as secondary (for packages that cannot be built with clang). This is based on Linux From Scratch (www.linuxfromscratch.org) and my previous work MLFS (https://github.com/dslm4515/Musl-LFS).

Specification

  • C Runtime Library (system libc): Musl
  • Default C Compiler: clang (LLVM)
  • Default C++ compiler: clang++ (LLVM)
  • Default linker: lld (LLVM)
  • Default binary tools: (LLVM)
  • Secondary C Compiler: GCC
  • Secondary C++ compiler: GCC
  • Secondary binary tools: GNU Binutils
  • Secondary linker(s): bfd, gold
  • C++ standard library: libcxx (LLVM)
  • C++ ABI library: libcxxabi (LLVM)
  • Unwinding Library: libunwind (LLVM)
  • Init system: skarnet's S6 & S6-rc
  • Device manager: Udev
  • TLS Implementaion: LibreSSL
  • System Shell: Bash
  • System Gettext: gettext-tiny

Supported Architectures

  • AMD64/x86_64: Toolchains and final system build sucessfully (musl & glibc hosts) .
  • i686: Pending
  • AARCH64/ARM64: Pending
  • ARMV7L: Pending

Goals

  • Build a toolchain (llvmtools) with LLVM+stage1_clang but without GCC
  • Build final root filesystem with LLVM
  • Set default linker as lld(LLVM)
  • Set default C++ standard library as libcxx(LLVM)
  • Set default C++ ABI library as libcxxabi(LLVM)
  • Set default stack unwinding library as libunwind(LLVM)
  • Eliminate dependacy on GCC's libgcc_s
  • Build GCC as a secondary systen compiler.
  • Build toolchain (llvmtools) with GCC as secondary compiler
  • Merge cross-tools build with cgnutools
  • Build successfully on a Glibc host
  • Reduce LLVM size & build time for cgnutools and llvmtools
  • Build on aarch64

Host System Requirements

  • CMake
  • Ninja/Samurai
  • wget/cURL

Required Base Development tools (may refer to LFS)

  • bash 3.2 (/bin/sh should be a symbolic or hard link to bash)
  • binutils 2.25
  • bison 2.7 (/usr/bin/yacc should be a link to bison or small script that executes bison)
  • bzip2 1.0.4
  • coreutils 6.9
  • diffutils 2.8.1
  • findutils 4.2.31
  • gawk 4.0.1 (/usr/bin/awk should be a link to gawk)
  • GCC 6.2 *including the C++ compiler, g++
  • Glibc 2.11 / Musl Libc 1.20
  • Grep 2.5.1a
  • gzip 1.3.12
  • linux kernel 3.2 (not sure if it matters, as most distros are running 4.x/5.x kernels
  • m4 1.4.10
  • make 4.0
  • patch 2.5.4
  • Python 3.4
  • sed 4.1.5
  • tar 1.22
  • texinfo 4.7
  • xz 5.0.0
* (if hostdistro is MLFS/LFS, then all development packages are installed)

Current Method

Build or use 'cross-tools' from Musl-LFS to cross-compile stage0 clang. This stage0 clang will still link to libgcc_s but will later be used to build a stage1 clang free of libbgcc_s. The goal is to build clang+friends with clang and not GCC.

  1. Build `cgnutools` with host's GCC
  2. Build a stage0 clang with GCC libraries with `cgnutools`: build clang via llvm source with clang+lld unpacked in `llvm/tools` and libunwind, libcxxabi & libcxx in `lvm/projects`.
  3. Build individually in LLVM source tree libunwind, libcxxabi and libcxx with stage0 clang and install in `llvmtools`.
  4. Build a new stage1 clang with stage0 clang. This new stage1 clang will not have GCC libraries. This will install in `llvmtools`.
  5. Using stage1 clang, build toolchain (llvmtools) for use in chroot
  6. Build final root filesystem in chroot with stage1 clang and toolchain (llvmtools)

Issues

  • Clang requires `execinfo.h` - Added libexecinfo to build
  • Diskboot.img of grub is not correctly built with clang. Grub requires GCC and patching.
  • Cannot build cgnutools with host's LLVM/Clang. Has to be complied with Host's GCC or previously built cross-tools toolchain.

Change log

  • 2.0.0: Upgraded to LLVM-12.0.0. Upgraded GCC to 10.3.1-x Replace ninja with samurai. Replace zlib with zlib-ng. Patched elfutils to build libelf under clang. No longer using /llvmtools/gnu and /opt/gnu.
  • 1.2.0: Incomplete: LLVM=11.0.0, Install GCC & Binutils in /llvmtools & /usr instead of /llvmtools/gnu and /opt/gnu
  • 1.1.0: Sucessfully merged cross-tools and cgnutools to include GCC & binutils.
  • 1.0.0: Sucessfully built on x86_64. GCC built as secondary compiler in /opt/gnu
  • 0.1.3: Configure Stage1 clang correctly with x86_64-pc-linux-musl.cfg.
  • 0.1.2: Use stage0 to build a stage1 clang...Stage1 clang will be used in chroot. Stage1 clang fails to compile
  • 0.1.1: Build stage0 clang by building clang, lld, compiler-rt, libunwind, libcxxabi, libcxx together in llvm source tree. Stage0 builds binaries with host's dynamic linker in /lib
  • 0.1.0: Build cross-tools with GCC to build stage 1 clang... first build libunwind, libcxxabi & libcxx - stage1 Clang broken
  • 0.0.0: First attempt, modeled afer Genshen's repo: Stage 2 clang fails to build.

Projects of Interest

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].