Download presentation
Presentation is loading. Please wait.
1
ELC-E - October 2010 - crosstool-NG
A (cross-)toolchain generator Yann E. MORIN To the attendance : if you can read this, then something is wrong! ;-) (C) 2010 Yann E. MORIN
2
ELC-E - October 2010 - crosstool-NG
History : cleanup-pass proposal : cleanup-pass ended in rewrite : first public release : 0.0.1 : first stable release : 1.0.0 : Mercurial repository -> starting with original crosstool -> add uClibc ---> not added upstream ---> port patch forward heavy-duty . -> cleanup proposal ---> existing patches ---> deemed to complex -> rewrite ---> as proof of concept of new feats ---> as a test-bed to push back 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 (C) 2010 Yann E. MORIN
3
ELC-E - October 2010 - crosstool-NG
Purpose Build toolchains Only build toolchains Goals -> toolchain not belong to system builders ---> think large devs teams ---> no need to build one toolchain each ---> many targets == many toolchains . -> Easy to use Easy to maintain Easy to enhance Act as a tutorial (C) 2010 Yann E. MORIN
4
ELC-E - October 2010 - crosstool-NG
Make it easy to use : standard behavior Standard package ./configure make make install Toolchain configuration menuconfig samples Toolchain build step by step simplified log -> do not confuse configuration ---> package ---> toolchain (C) 2010 Yann E. MORIN
5
ELC-E - October 2010 - crosstool-NG
[INFO ] ============================================================= [INFO ] Installing shared core C compiler [EXTRA] Configuring shared core C compiler [EXTRA] Building shared core C compiler [EXTRA] Installing shared core C compiler [INFO ] Installing shared core C compiler: done in s (at 06:43) [INFO ] Installing C library [EXTRA] Copying sources to build dir [EXTRA] Applying configuration [EXTRA] Building C library [EXTRA] Installing C library [INFO ] Installing C library: done in 39.96s (at 07:23) [INFO ] Installing final compiler [EXTRA] Configuring final compiler [EXTRA] Building final compiler [EXTRA] Installing final compiler [INFO ] Installing final compiler: done in s (at 09:48) [INFO ] Cleaning-up the toolchain's directory [INFO ] Stripping all toolchain executables [EXTRA] Installing the populate helper [EXTRA] Installing a cross-ldd helper [EXTRA] Creating toolchain aliases [EXTRA] Removing access to the build system tools [EXTRA] Removing installed documentation [INFO ] Cleaning-up the toolchain's directory: done in 1.88s (at 09:49) [INFO ] Build completed at [INFO ] (elapsed: 9:49.65) [INFO ] Finishing installation (may take a few seconds)... (C) 2010 Yann E. MORIN
6
ELC-E - October 2010 - crosstool-NG
Easy to maintain & enhance : modular design Isolated components One config file One build script One patchset API Generic: get, extract and patch Component-specific C library: headers & start-files, full Compiler: bootstrap 1 & 2, final Alternatives Architectures C libraries Kernels ... Maintain, enhance -> basically same thing ---> maintain == fix existing stuff ---> enhance == add new stuff . Know what breaks, where it breaks Know where to add new stuff API -> env vars --> arch name, endianness, bitness... -> hooks ---> helpers for generic hooks ---> Automatic inclusion to menuconfig (C) 2010 Yann E. MORIN
7
ELC-E - October 2010 - crosstool-NG
ARCH description config file config/arch/arm.in # ARM specific configuration file config ARCH_arm select ARCH_SUPPORTS_32 select ARCH_DEFAULT_32 select ARCH_SUPPORTS_BOTH_MMU select ARCH_DEFAULT_HAS_MMU select ARCH_SUPPORTS_BOTH_ENDIAN select ARCH_DEFAULT_LE select ARCH_SUPPORT_ARCH select ARCH_SUPPORT_CPU select ARCH_SUPPORT_TUNE select ARCH_SUPPORT_FPU help The ARM architecture, as defined by: # ARM specific configuration file choice bool prompt "Default instruction set mode" default ARCH_ARM_MODE_ARM config ARCH_ARM_MODE_ARM prompt "arm" help Defaults to emitting instructions in the ARM mode. config ARCH_ARM_MODE_THUMB prompt "thumb (EXPERIMENTAL)" depends on EXPERIMENTAL Defaults to emitting instructions in the THUMB mode. endchoice config ARCH_ARM_MODE string default "arm" if ARCH_ARM_MODE_ARM default "thumb" if ARCH_ARM_MODE_THUMB config ARCH_ARM_INTERWORKING prompt "Use Thumb-interworking" default n config ARCH_ARM_EABI prompt "Use EABI" default y Set up the toolchain so that it generates EABI-compliant binaries. config ARCH_ARM_ABI_OK depends on ! ARCH_ARM_EABI select ARCH_SUPPORT_ABI ARCH-specific options config file config/arch/arm.in.2 # Compute ARM-specific values CT_DoArchTupleValues() { # The architecture part of the tuple: CT_TARGET_ARCH="${CT_ARCH}${target_endian_eb}" # The system part of the tuple: case "${CT_LIBC},${CT_ARCH_ARM_EABI}" in *glibc,y) CT_TARGET_SYS=gnueabi;; uClibc,y) CT_TARGET_SYS=uclibcgnueabi;; *,y) CT_TARGET_SYS=eabi;; esac # Set the default instruction set mode case "${CT_ARCH_ARM_MODE}" in arm) ;; thumb) CT_ARCH_CC_CORE_EXTRA_CONFIG="--with-mode=thumb" CT_ARCH_CC_EXTRA_CONFIG="--with-mode=thumb" # CT_ARCH_TARGET_CFLAGS="-mthumb" ;; if [ "${CT_ARCH_ARM_INTERWORKING}" = "y" ]; then CT_ARCH_TARGET_CFLAGS+=" -mthumb-interwork" fi } ARCH settings script scripts/build/arch/arm.sh Same goes for all components . Maybe build procedure is complex, but adding to crosstool-NG is easy! (C) 2010 Yann E. MORIN
8
ELC-E - October 2010 - crosstool-NG
Goodies Companion libraries gmp, mpfr, ppl, CLooG/ppl, mpc, libelf Companion tools auto-stuff et al. Debug tools gdb ltrace, strace dmalloc, D.U.M.A Pre-configured sample toolchains gmp, mpfr ---> mandatory, gcc >= 4.3, all frontends ---> mandatory, all gcc, fortran frontend . mpc ---> mandatory, gcc >= 4.5, all frontends ppl, cloog ---> optional, gcc >= 4.4, Graphite libelf ---> optional, gcc >= 4.5, LTO auto-stuff ---> either disapear, or make mandatory gdb ---> cross, native & gdbserver, all static or shared (C) 2010 Yann E. MORIN
9
ELC-E - October 2010 - crosstool-NG
Toolchain types Different systems involved build system that builds the toolchain host system that runs the toolchain target system the toolchain generates code for Native build == host == target Cross build == host != target Cross-native build != host == target Canadian build != host != target build, host, target _SYSTEMS_ !!! . Define _sytem_ (C) 2010 Yann E. MORIN
10
ELC-E - October 2010 - crosstool-NG
Steps : 23 libc_check_config kernel_headers gmp mpfr ppl cloog mpc libelf binutils elf2flt sstrip cc_core_pass_1 libc_headers libc_start_files cc_core_pass_2 libc cc libc_finish libelf_target binutils_target debug test_suite finish (C) 2010 Yann E. MORIN
11
ELC-E - October 2010 - crosstool-NG
Pros Your choice of components versions Optimised for your processor Known patchset (if any) Same sources for all targets Upstream fixes easy to apply Reproducible Fits your build-system (C) 2010 Yann E. MORIN
12
ELC-E - October 2010 - crosstool-NG
Status : what's already in? 11 Archs 5 C libraries 2 binary utilities 2 kernels 1 compiler patchset required by many components to build controversy Arch: ---> alpha, arm, avr32, blackfin, ia64, ---> m68k, mips, ppc, s390, sh, x86 . C libs: ---> newlib, uClibc, eglibc, glibc, mingw ---> none ! binutils: ---> binutils, elf2flt Kernels: ---> linux, mingw32 ---> bare-metal ! Compiler: ---> gcc (C) 2010 Yann E. MORIN
13
ELC-E - October 2010 - crosstool-NG
Future : short- and long-term plans Add latest component versions gcc, Linux, C libraries... Consolidate backend-mode currently used by buildroot Consolidate canadian-crosses needed before cross-native, and native Look at LLVM / Clang see how it all fits together multi-lib mingw32 & cygwin build, host & target ... (C) 2010 Yann E. MORIN
14
ELC-E - October 2010 - crosstool-NG
Thank you! Yann E. MORIN License for this paper: Creative Commons BY-SA 3.0 Source for this paper: (C) 2010 Yann E. MORIN
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.