1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

Toolchain+Ports: Update LLVM to 14.0.1

Besides a version bump, the following changes have been made to our
toolchain infrastructure:
- LLVM/Clang is now built with -march=native if the host compiler
  supports it. An exception to this is CI, as the toolchain cache is
  shared among many different machines there.
- The LLVM tarball is not re-extracted if the hash of the applied
  patches doesn't differ.
- The patches have been split up into atomic chunks.
- Port-specific patches have been integrated into the main patches,
  which will aid in the work towards self-hosting.
- <sysroot>/usr/local/lib is now appended to the linker's search path by
  default.
- --pack-dyn-relocs=relr is appended to the linker command line by
  default, meaning ports take advantage of RELR relocations without any
  patches or additional compiler flags.

The formatting of LLVM port's package.sh has been bothering me, so I
also indented the arguments to the CMake invocation.
This commit is contained in:
Daniel Bertalan 2022-04-08 23:28:25 +02:00 committed by Brian Gianforcaro
parent 9a898df1cd
commit 01b31d9858
22 changed files with 664 additions and 1007 deletions

View file

@ -0,0 +1,78 @@
# Patches for llvm on SerenityOS
## `0001-Support-Add-support-for-building-LLVM-on-SerenityOS.patch`
Add support for building LLVM on SerenityOS
Adds SerenityOS `#ifdef`s for platform-specific code.
We stub out wait4, as SerenityOS doesn't support querying a child
process's resource usage information.
## `0002-Triple-Add-triple-for-SerenityOS.patch`
Add triple for SerenityOS
## `0003-Driver-Add-support-for-SerenityOS.patch`
Add support for SerenityOS
Adds support for the `$arch-pc-serenity` target to the Clang front end.
This makes the compiler look for libraries and headers in the right
places, and enables some security mitigations like stack-smashing
protection and position-independent code by default.
## `0004-Driver-Default-to-ftls-model-initial-exec-on-Serenit.patch`
Default to -ftls-model=initial-exec on SerenityOS
This is a hack to make Clang use the initial-exec TLS model instead of
the default local-exec when building code for Serenity.
This patch should be removed when we implement proper TLS support.
## `0005-libc-Add-support-for-SerenityOS.patch`
Add support for SerenityOS
This commit teaches libc++ about what features are available in our
LibC, namely:
* We do not have locale support, so no-op shims should be used in place
of the C locale API.
* The number of errno constants defined by us is given by the value of
the `ELAST` macro.
* Multithreading is implemented though the pthread library.
* Aligned memory allocation is provided by the MSVCRT-like
`_aligned_{malloc,free}` functions.
Adds a hack for a header not found error when including
`<initializer_list>` inside the SerenityOS kernel.
Makes libc++ use its builtin character type table instead of the one
provided by LibC as it is incomplete.
## `0006-compiler-rt-Build-crtbegin.o-crtend.o-for-SerenityOS.patch`
Build crtbegin.o/crtend.o for SerenityOS
## `0007-cmake-Allow-undefined-symbols-on-SerenityOS.patch`
Allow undefined symbols on SerenityOS
Allow undefined symbols in LLVM libraries, which is needed because only
stubs are available for SerenityOS libraries when libc++ and libunwind
are built.
## `0008-cmake-Support-building-shared-libLLVM-and-libClang-f.patch`
Support building shared libLLVM and libClang for SerenityOS
This patch tells CMake that the --whole-archive linker option should be
used for specifying the archives whose members will constitute these
shared libraries.
Symbol versioning is disabled, as the SerenityOS loader doesn't support
it, and the ELF sections that store version data would just waste space.