Commit graph

15 commits

Author SHA1 Message Date
Daniel Bertalan b3dbf204fc Toolchain: Don't use GNU objcopy in the LLVM toolchain
Our build of LLVM's objcopy now supports the single missing feature
(--update-section) that previously forced us to use the one from GNU
Binutils. This means that there is no reason anymore to build Binutils
alongside LLVM's tools.
2022-01-10 09:55:45 +03:30
Daniel Bertalan b19cc3cdcb Toolchain: Backport --update-section support to llvm-objcopy
This commit backports the LLVM commit that adds support for the
`--update-section` flag to llvm-objcopy. We use this feature of GNU
objcopy to embed the symbol map in the kernel.

The corresponding LLVM Phabricator Differential Revision can be found
here: https://reviews.llvm.org/D112116

This patch is identical to the upstream commit, except for two hunks
that had to be changed as they didn't apply cleanly.
2022-01-10 09:55:45 +03:30
Jean-Paul Balabanian 913511249b Toolchain: Add support for Clang on MacOS
This commit adds Darwin as a possible host for building the toolchain
with Clang.
2022-01-04 00:40:11 +03:30
Andrew Kaster c5898806d2 Toolchain: Use Platform/SerenityOS.cmake in LLVM toolchain build
By setting CMAKE_MODULE_PATH in the LLVM initial cache scripts, we can
make the "SerenityOS" CMAKE_SYSTEM_NAME usable in the builds of
compiler-rt, libunwind, libcxxabi and libcxx.

This simplifies some toolchain patches and brings the cross-compiler
patches closer to the Port's patches, and closer to something
upstreamable.
2022-01-03 11:08:45 +00:00
Daniel Bertalan 06fc64be13 Toolchain+Meta: Update LLVM version to 13.0.0
This commit updates the Clang toolchain's version to 13.0.0, which comes
with better C++20 support and improved handling of new features by
clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our
Clang binaries will only be 2-4% slower than if we dynamically linked
them, but we save hundreds of megabytes of disk space.

The `BuildClang.sh` script has been reworked to build the entire
toolchain in just three steps: one for the compiler, one for GNU
binutils, and one for the runtime libraries. This reduces the complexity
of the build script, and will allow us to modify the CI configuration to
only rebuild the libraries when our libc headers change.

Most of the compile flags have been moved out to a separate CMake cache
file, similarly to how the Android and Fuchsia toolchains are
implemented within the LLVM repo. This provides a nicer interface than
the heaps of command-line arguments.

We no longer build separate toolchains for each architecture, as the
same Clang binary can compile code for multiple targets.

The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in
this commit. Clang happily accepts an `i686-pc-serenity` target triple,
which matches what our GCC toolchain accepts.
2021-10-17 17:09:58 +01:00
Timothy Flynn 5a2f41fff0 Toolchain: Add --ci option to BuildClang to enable ccache 2021-09-21 15:39:17 +03:00
Nico Weber 17ab44e7d7 Meta: Make BuildClang.sh produce less output when running in a TTY
Ninja disables its fancy output mode when it's not writing to a TTY.
So don't pipe its output into something else, so that it writes to
a TTY if the invoking terminal is a TTY.
2021-09-07 20:29:22 +01:00
Nico Weber eb7b8a7bbe Meta: Don't pass LLVM_LLVM_BUILD_LLVM_DYLIB to cmake
`LLVM_LLVM_BUILD_LLVM_DYLIB` does not exist, so passing this does
nothing but make CMake warn.

However, since we pass `LLVM_LINK_LLVM_DYLIB`, `LLVM_BUILD_LLVM_DYLIB`
(the correct spelling) defaults to true anyways.  So let's pass fewer
flags.

No behavior change, but fixes a CMake warning.
2021-09-07 20:29:22 +01:00
Nico Weber 1ed1a57707 Meta: Make serenity.sh rebuild-toolchain aarch64 clang work 2021-09-07 20:29:22 +01:00
Tom 77953a937d Meta: Add the ability to specify clang with serenity.sh
This enables maintaining gcc and clang builds side-by-side.
2021-09-03 23:12:17 +02:00
Timothy Flynn 7ea55c883b Toolchain: Make Kernel/API headers available to Clang toolchain build
Copied from 9b79867909.
2021-08-17 13:31:43 +01:00
Daniel Bertalan 657fbc1e6c Toolchain: Remove static LLVM libraries
We link against these dynamically anyways, so having them around is not
useful. Removing them frees precious storage space on CI.
2021-08-08 23:54:00 +02:00
Daniel Bertalan d3595477d8 Toolchain: Build libLLVM as a dynamic library
This library is used by virtually all executables in the Clang
toolchain. By default, it is linked statically, which leads to huge
file sizes and us running out of artifact storage disk space on CI.
2021-08-08 23:54:00 +02:00
Daniel Bertalan 9809e685c1 Toolchain: Add caching to BuildClang.sh for CI 2021-08-08 10:55:36 +02:00
Daniel Bertalan 15e217ea68 Toolchain: Add LLVM patch and script for building it
This contains all the bits and pieces necessary to build a Clang binary
that will correctly compile SerenityOS.

I had some trouble with getting LLVM building with a single command, so
for now, I decided to build each LLVM component in a separate command
invocation. In the future, we can also make the main llvm build step
architecture-independent, but that would come with extra work to make
library and include paths work.

The binutils build invocation and related boilerplate is duplicated
because we only use `objdump` from GNU binutils in the Clang toolchain,
so most features can be disabled.
2021-08-08 10:55:36 +02:00