FreeBSD Tool Chain. Ed Maste BSDCan 2017

Similar documents
How to cross compile with LLVM based tools. Peter Smith, Linaro

Embedded Systems Programming

LLVM in the FreeBSD Toolchain

lld: A Fast, Simple and Portable Linker Rui Ueyama LLVM Developers' Meeting 2017

Porting FreeBSD to AArch64

Cross Compiling. Real Time Operating Systems and Middleware. Luca Abeni

Debugging for production systems

LPC17 - Supporting newer toolchains in the kernel. Bernhard Bero Rosenkränzer

2012 LLVM Euro - Michael Spencer. lld. Friday, April 13, The LLVM Linker

Retargetable Binary Utilities

CS631 - Advanced Programming in the UNIX Environment. UNIX development tools

Rethinking the core OS in 2015

Rethinking the core OS in 2015

KOTLIN/NATIVE + CLANG, TRAVEL NOTES NIKOLAY IGOTTI, JETBRAINS

Hello, my name is Petr Hosek

A Plan 9 C Compiler for RISC-V

MutekH embedded operating system. January 10, 2013

Introducing LLDB for Linux on Arm and AArch64. Omair Javaid

Kai Nacke DConf 2016

Yocto Project & Embedded Linux

Introduction p. 1 Why Linux? p. 2 Embedded Linux Today p. 3 Open Source and the GPL p. 3 Free Versus Freedom p. 4 Standards and Relevant Bodies p.

RED HAT DEVELOPER TOOLSET: Build, Run, & Analyze Applications On Multiple Versions of Red Hat Enterprise Linux

GCC and LLVM collaboration

ebpf Debugging Infrastructure Current Techniques and Additional Proposals

New features in AddressSanitizer. LLVM developer meeting Nov 7, 2013 Alexey Samsonov, Kostya Serebryany

Gold. Ian Lance Taylor Google. What? Why? How? Gold. Performance. Features. Future. Ian Lance Taylor Google. Who? June 17, 2008

Apple Llvm 5.1 Error Exit Code 1.0

FreeBSD/RISC-V project

ECE/ME/EMA/CS 759 High Performance Computing for Engineering Applications

A tale of ELFs and DWARFs

Using the Go Programming Language in Practice

BUD Introduction to LLVM Projects, Components, Integration, Internals Renato Golin, Diana Picus Peter Smith, Omair Javaid Adhemerval Zanella

Red Hat Developer Tools

Updating the Compiler?

RELEASE NOTES. GNU Toolchain for Atmel AVR8 Embedded Processors. Introduction

C03c: Linkers and Loaders

Introduction to RISC-V

INSTALLING INSTALLING INSTALLING

Efficient and Large Scale Program Flow Tracing in Linux. Alexander Shishkin, Intel

Embedded Linux Architecture

Technical Committee Update

RELEASE NOTES: GNURL78 v KPIT Technologies Limited is releasing the GNURL78 v15.02, a cross compiler tool for Renesas RL78 micro-controllers.

LLDB for your hardware: Remote Debugging the Hexagon DSP

GNUPro Toolkit User s Guide for Altera for ARM and ARM/ Thumb Development

Red Hat Developer Tools

Systems Programming. Fatih Kesgin &Yusuf Yaslan Istanbul Technical University Computer Engineering Department 18/10/2005

Installation Guide for OS/161

Computer Systems Architecture I. CSE 560M Lecture 3 Prof. Patrick Crowley

CNIT 127: Exploit Development. Ch 3: Shellcode. Updated

Building EPICS for RTEMS / Cexpsh T.S., 9/2007

Introduction to LLVM. UG3 Compiling Techniques Autumn 2018

ThinLTO. A Fine-Grained Demand-Driven Infrastructure. Teresa Johnson, Xinliang David Li

BCC User's Manual BCC. Bare-C Cross-Compiler User's Manual. The most important thing we build is trust

Intel Parallel Studio XE 2015 Composer Edition for Linux* Installation Guide and Release Notes

What s New in the LLVM Compiler. Chris Lattner LLVM Chief Architect

Experience with GNU, LINUX, and other Open Source on ARC Processors

The gnu Binary Utilities

RED HAT DEVELOPER TOOLSET Build, Run, & Analyze Applications On Multiple Versions of Red Hat Enterprise Linux

Department of Computer Science and Engineering Yonghong Yan

High Performance Microprocessor Emulation for Software Validation Facilities and Operational Simulators. Dr. Mattias Holm

CSE 4/521 Introduction to Operating Systems

Description. October Rev 4 1/10

ECE 3210 Laboratory 1: Develop an Assembly Program

UFCETW-20-2 Examination Answer all questions in Section A (60 marks) and 2 questions from Section B (40 marks)

State of the Port to x86_64 July 2017

What s New in Platform Builder 7

IRIX is moving in the n32 direction, and n32 is now the default, but the toolchain still supports o32. When we started supporting native mode o32 was

Build issues for Screamer V4.2.6 Mac OS X High Sierra, Windows 10, and Ubuntu LINUX

ECE 471 Embedded Systems Lecture 4

LDC: A Dragon on Mars. David Nadlinger DConf 2013

Red Hat Developer Toolset 2.x 2.0 Release Notes

Porting OpenVMS to x Update

The gnu Binary Utilities

ELF (1A) Young Won Lim 10/22/14

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Khem Raj Embedded Linux Conference 2014, San Jose, CA

Evolving HPCToolkit John Mellor-Crummey Department of Computer Science Rice University Scalable Tools Workshop 7 August 2017

LDC: The LLVM-based D Compiler

LLVM, Clang and Embedded Linux Systems. Bruno Cardoso Lopes University of Campinas

CS2141 Software Development using C/C++ Libraries

RISC-V. Palmer Dabbelt, SiFive COPYRIGHT 2018 SIFIVE. ALL RIGHTS RESERVED.

Android Kernel Security

trisycl Open Source C++17 & OpenMP-based OpenCL SYCL prototype Ronan Keryell 05/12/2015 IWOCL 2015 SYCL Tutorial Khronos OpenCL SYCL committee

Supporting the new IBM z13 mainframe and its SIMD vector unit

INSTALLING INSTALLING INSTALLING

OUTLINE. STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and Pipelining Cortex-M0 Programming Model Toolchain and Project Structure

LLVM An Introduction. Linux Collaboration Summit, April 7, 2011 David Kipping, Qualcomm Incorporated

Gcc Get Current Instruction Pointer

Intel Parallel Studio XE 2017 Composer Edition BETA C++ - Debug Solutions Release Notes

Chapter 2: Operating-System Structures

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network

Intro to Segmentation Fault Handling in Linux. By Khanh Ngo-Duy

CheriBSD: a research fork of FreeBSD

Porting LLDB. Hafiz Abid Qadeer. mentor.com/embedded

ECE 471 Embedded Systems Lecture 4

White paper. Embedded development using the GNU toolchain for ARM processors

Tools of the Trade The C Language Laboration 04. Outline. 1 Tools of the Trade. 2 The C Language. 3 Laboration 04

Linux Kernel Architecture

State of the Port to x86_64 April 2017

Improving Linux Development with better tools. Andi Kleen. Oct 2013 Intel Corporation

Transcription:

FreeBSD Tool Chain Ed Maste BSDCan 2017

GNU Tool Chain

GNU Tool Chain...

GNU Tool Chain

Architecture Dependency Debugger Arch 9.x 10.0 10.x 11.0 11.x Soon Later i386 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 7.12 LLDB 5+ GDB 8 amd64 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 LLDB 3.8.0 LLDB 4.0.0 LLDB 4.0.0 LLDB 5 GDB 6.1.1 GDB 6.1.1 GDB 7.12 GDB 8 armv6 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 LLDB 5 GDB 8 arm64 - - - LLDB 3.8.0 LLDB 4.0.0 LLDB 4.0.0 LLDB 5 GDB 8 mips GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 7.12 LLDB 5 GDB 8 powerpc GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 7.12 LLDB 5 GDB 8 sparc64 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 8 riscv64 - - - - - In-tree GNU GDB In-tree LLDB Ports GNU GDB? LLDB 6+ GDB 8+ Binary Utilities Arch 9.x 10.0 10.x 11.0 11.x Soon Later i386 BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC amd64 BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC armv6 BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC arm64 - - - ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC mips BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC powerpc BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC sparc64 BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC 3520 ElfTC riscv64 - - - - - ElfTC 3520 ElfTC In-tree GNU Binutils In-tree ELF Tool Chain

In-tree Outdated Tools In-tree Maintained Tools Ports Tools

C/C++ Compiler C/C++ Compiler Arch 9.x 10.0 10.x 11.0 11.x Soon Later i386 GCC 4.2.1 Clang 3.3 Clang 3.4.1 Clang 3.8.0 Clang 4.0.0 Clang 5 Clang amd64 GCC 4.2.1 Clang 3.3 Clang 3.4.1 Clang 3.8.0 Clang 4.0.0 Clang 5 Clang armv6 GCC 4.2.1 Clang 3.3 Clang 3.4.1 Clang 3.8.0 Clang 4.0.0 Clang 5 Clang arm64 - - - Clang 3.8.0 Clang 4.0.0 Clang 5 Clang mips GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 6.x Clang 6+ powerpc GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 6.x Clang 6+ sparc64 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 4.2.1 GCC 6.x GCC riscv64 - - - - - GCC 6.x Clang 6+ In-tree GCC In-tree Clang Ports GCC

Clang Upgrades Upgrade through each new version from 3.3 to 4.0, with 5.0 now in progress. New compilers bring new warnings Lower tolerance over time for broken source clang###-import project branches used for staging imports

Clang Upgrades - Ports exp-run test build of the ports tree against src import branch PR219139 exp-run for projects/clang500-import New failures on amd64: + {"origin"=>"archivers/xmill", "phase"=>"build", "errortype"=>"clang"} + {"origin"=>"audio/mac", "phase"=>"build", "errortype"=>"clang"} + {"origin"=>"audio/mous", "phase"=>"build", "errortype"=>"clang"} + {"origin"=>"cad/openvsp", "phase"=>"build", "errortype"=>"bad_c++_code"} + {"origin"=>"devel/codeblocks", "phase"=>"build", "errortype"=>"bad_c++_code"} + {"origin"=>"devel/cpprestsdk", "phase"=>"build", "errortype"=>"clang_werror"}...

Clang Upgrades - Ports In file included from src/mongo/db/db.cpp:47: src/mongo/db/client.h:263:59: error: ordered comparison between pointer and zero ('mongo::client *' and 'int') inline bool haveclient() { return currentclient.get() > 0; } ~~~~~~~~~~~~~~~~~~~ ^ ~

Clang Upgrades - Ports Assertion failed: (isa<x>(val) && "cast<ty>() argument of incompatible type!"), function cast, file /poudriere/jails/headamd64pr219139/usr/src/contrib/llvm/include/ll vm/support/casting.h, line 254. cc: error: unable to execute command: Abort trap (core dumped) cc: error: clang frontend command failed due to signal (use -v to see invocation) FreeBSD clang version 5.0.0 (trunk 303291) (based on LLVM 5.0.0svn) Target: x86_64-unknown-freebsd12.0 Thread model: posix InstalledDir: /usr/bin cc: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.

Clang in Ports 30000 25000 20000 15000 10000 5000 2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 Ports Makefiles % USE_GCC 0 2010 2011 2012 2013 2014 2015 2016 2017 Jun 2017 0

Assembler Assembler Arch 9.x 10.0 10.x 11.0 11.x Soon Later i386 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 Clang 5 Clang amd64 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 Clang 5 Clang armv6 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 Clang 5 Clang arm64 - - - gas 2.25 Clang 4.0.0 Clang 5 Clang mips gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.27 Clang 5+ powerpc gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.27 Clang 5+ sparc64 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.17.50 gas 2.27 gas riscv64 - - - - - gas 2.27 Clang 6+ In-tree GNU as In-tree Clang Integrated as Ports Binutils GNU as

GNU Assembler Very little actually requires /usr/bin/as PR205250 exp-run with no as amd64 world + kernel built fine 11 new port failures (and 200 skipped)

GNU Assembler.macro complicates GNU as replacement e.g. sys/crypto/skein/amd64/skein_block_asm.s # # Input: reg # Output: <reg> <<< RC_BlkSize_roundNum_mixNum, BlkSize=256/512/1024 #.macro RotL64 reg,blk_size,round_num,mix_num _RCNT_ = RC_\BLK_SIZE&_\ROUND_NUM&_\MIX_NUM.if _RCNT_ #is there anything to do? rolq $_RCNT_,%\reg.endif.endm 750.S, 45.s, one case of.macro

Linker Linker Arch 9.x 10.0 10.x 11.0 11.x Soon Later i386 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 LLD 5+ LLD 5+ amd64 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 LLD 5 LLD armv6 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 LLD 5+ arm64 - - - BFD 2.25 LLD 4.0.0 LLD 5 LLD mips BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.27 LLD 5+ powerpc BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.27 LLD 5+ sparc64 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.17.50 BFD 2.27 BFD 2.27 riscv64 - - - - - BFD 2.27 LLD 6+ In-tree GNU BFD ld In-tree LLD Ports GNU BFD ld

LLVM s LLD Linker Progress May 2015: start new COFF implementation July 2015: new ELF End 2015: LLD could form part of self-hosting FreeBSD/amd64 toolchain (build Clang/LLVM/LLD with Clang/LLVM/LLD)

LLD 2016 Progress FreeBSD work: Rui Ueyama, Rafael Espindola, George Rimar, Davide Italiano, Ed Maste Relocatable output Library search paths Linker scripts (arithmetic expressions) Symbol versioning Misc commandline options

LLD PR214864 exp-run with LLD as /usr/bin/ld 270 total port failures (not all new), 965 skipped 25290 successfully built ELF protected symbol preemption main outstanding issue

Real Link Time, Clang Release Build 45 40 40.7 35 30 25 Seconds 20 15 10 5 0 3.7 1.4 0.6 0.5 BFD 2.17.50 (base) BFD 2.27_5,1 (ports) Gold 2.27_5,1 (ports) LLD no threads LLD threads

Real Link Time, Clang Debug Build 350 300 292.3 250 200 Seconds 150 100 91.4 50 36.0 18.9 11.6 0 BFD 2.17.50 (base) BFD 2.27_5,1 (ports) Gold 2.27_5,1 (ports) LLD no threads LLD threads

Real & CPU Link Time, Clang Debug Build 40 35 30 Real Time CPU Time 25 Seconds 20 15 10 5 0 Gold 2.27_5,1 (ports) LLD no threads LLD threads

Linker Next Steps Enable build-id Incorporate LTO build infrastructure Ports binutils override Switch amd64 to LLD Fix arm and i386 buildworld / buildkernel Fix ports

Binary Utilities Binary Utilities (other than elfdump, ar, ld) Arch 9.x 10.0 10.x 11.0 11.x Soon Later All except below BU 2.17.50 BU 2.17.50 BU 2.17.50 ElfTC 3477 ElfTC 3520 ElfTC ElfTC/LLVM arm64 - - - ElfTC 3477 bfd 2.25 riscv64 - - - - - ElfTC 3520 ElfTC ElfTC/LLVM ElfTC bfd 2.27 ElfTC/LLVM In-tree GNU Binutils In-tree ELF Tool Chain Ports Binutils

ELF Tool Chain: POSIX/Native Tools Tool ELF TC FreeBSD ar Released Bespoke as Planning BFD brandelf Released Bespoke c++filt Released ELF Tool Chain elfdump Released Bespoke isa Devel N/A ld Alpha BFD / LLD nm Released ELF Tool Chain mcs Released N/A ranlib Released Bespoke size Released ELF Tool Chain strings Released ELF Tool Chain strip Released ELF Tool Chain

ELF Tool Chain: GNU Tools Tool ELF TC FreeBSD addr2line Released ELF Tool Chain elfcopy Released ELF Tool Chain findtextrel Released N/A objdump Planning GNU readelf Released ELF Tool Chain

ELF Tool Chain: Libraries Library ELF TC FreeBSD libdwarf Released ELF Tool Chain libelf Released ELF Tool Chain libelftc Released ELF Tool Chain libmc Planning N/A libpe Alpha ELF Tool Chain

Binary Utilities Bespoke ar/ranlib, brandelf, elfdump ELF Tool Chain??? addr2line, c++filt, elfcopy/objcopy, nm, size, strings, strip, readelf objdump

Device Tree Compiler Device Tree Source files (.dts) compiled to Device Tree Blob (.dtb) libfdt is dual GPL/BSD licensed, dtc is GPL David Chisnall s bespoke C++11 implementation at https://svn.freebsd.org/base/head/usr.bin/dtc

Debugger Debugger Arch 9.x 10.0 10.x 11.0 11.x Soon Later i386 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 7.12 LLDB 5+ GDB 8 amd64 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 LLDB 3.8.0 LLDB 4.0.0 LLDB 4.0.0 LLDB 5 GDB 6.1.1 GDB 6.1.1 GDB 7.12 GDB 8 armv6 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 LLDB 5 GDB 8 arm64 - - - LLDB 3.8.0 LLDB 4.0.0 LLDB 4.0.0 LLDB 5 GDB 8 mips GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 7.12 LLDB 5 GDB 8 powerpc GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 7.12 LLDB 5 GDB 8 sparc64 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 6.1.1 GDB 8 riscv64 - - - - -? LLDB 6+ GDB 8+ In-tree GNU GDB In-tree LLDB Ports GNU GDB

Debugger Next Steps Add amd64 AVX register support Implement debugserver Use debugserver locally (as other archs) Kernel core dump + live /dev/mem support Implement fork following Flesh out architecture support i386 mips powerpc

DTrace & CTF tools ctfconvert + ctfmerge convert debug data to CTF data merge several CTF data sections into one OpenBSD combined tool

Runtime Libraries Compiler runtime support C standard library C++ low-level runtime C++ standard library Exception unwinding Clang sanitizers OpenMP

Compiler runtime libgcc, compiler_rt Compiler support, optimized arithmetic routines r215127 Replace libgcc.a by libcompiler_rt.a Nov 11, 2010 r307230 Introduce lib/libgcc_eh and lib/libgcc_s for LLVM's implementation Oct 13, 2016

C Standard Library (libc) Core component of the OS Updated for C11 per-thread locale atomic types generic expressions

C++ low-level runtime libsupc++, libcxxrt Support routines for C++ exceptions typeinfo unwind support C++ demangling

C++ standard library libstdc++, libc++ libstdc++ provided by GCC 4.2.1, ~2007 libc++ imported ~2011

Exception Unwinding libgcc_eh, LLVM libunwind libgcc_eh / libgcc_s from GCC 4.2.1 Apple-provided llvm-libunwind

Sanitizer Runtimes AddressSanitizer ThreadSanitizer MemorySanitizer UndefinedBehaviourSanitizer DataFlowSanitizer LeakSanitizer SanitizerCoverage

OpenMP shared memory parallel programming API

OpenMP GNU libgomp r282973 Build libgomp only if we're also building base system GCC May 15, 2015 Intel libiomp LLVM libomp devel/openmp base system

Cast Andrew Turner andrew@ all things arm64 Antoine Brodin antoine@ - ports exp-runs Dimitry Andric dim@ Clang/LLVM, Binutils, compiler-rt Ed Schouten ed@ compiler-rt Ed Maste emaste@ LLD, LLDB, ELF Tool Chain John Baldwin jhb@ GDB ports Justin Hibbits jhibbits@ all things powerpc Marius Strobl marius@ sparc64 Pedro Giffuni pfg@ misc Binutils and GCC Roman Divacky rdivacky@ - early Clang work David Chisnall theraven@ C++ runtimes

Questions?

Acknowledgements Crystal Clear icon set from Everaldo Coelho (http://www.iconarchive.com/show/crystal-clear-icons-by-everaldo.html)