summaryrefslogtreecommitdiff
path: root/Toolchain/Patches
AgeCommit message (Collapse)Author
2022-06-30Toolchain: Remove workarounds for initializer_list and _aligned_allocAndrew Kaster
These are no longer required to use libc++ on Serenity
2022-06-30Toolchain: Create separate serenity xlocale support fileAndrew Kaster
2022-06-30Toolchain: Format llvm patches per new patch formatAndrew Kaster
This removes the patch series 1/N comments, git version at the bottom of the patch, and zeros out the original commit hash.
2022-06-30Toolchain: Set '/' as default division character for binutilsTim Schumacher
While we are at it, regenerate the patch and remove some outdated parts of the description.
2022-06-21Revert "Toolchain: Load x64 executables at a higher address"Tim Schumacher
Now that the lower pages can be unmapped and more of the virtual address range is available to us, we can actually use the default mapping address of x86_64 again. This reverts commit 292398b5857d0104f7c33fdb5d79f45fe8b395dd.
2022-05-19Toolchain+Ports: Split the GCC patchesDaniel Bertalan
This shouldn't cause any breaking changes, so a toolchain rebuild is not required. As per Hendiadyoin's request, math errno is disabled by default, which should enable some extra compiler optimizations in LibGL and LibSoftGPU code that uses math functions heavily. Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2022-05-12Toolchain: Upgrade to GCC 12.1.0Daniel Bertalan
This release brings support for various C++23 constructs like `if consteval` and multidimensional subscript operators. Vectorization is now enabled for O2 too, and `-ftrivial-auto-var-init` has been added which can help us find and prevent security issues coming from uninitialized variables. Toolchain/Patches/gcc.patch is now significanly smaller as some unused, autoconf-generated code has been removed.
2022-05-02Toolchain: Enable LLVM Profile instrumentationAndrew Kaster
Add a patch to let llvm's InstrProfiling modules know serenity supports all the Unix-y features required to make -fprofile-instr-generate and -fcoverage-mapping work properly on target.
2022-04-23Toolchain+Ports: Update LLVM to 14.0.1Daniel Bertalan
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.
2022-03-31Toolchain: Add a gcc patch to fix linker error on M1 hostJames Mintram
2022-03-24Toolchain: Update gdb to 11.2Daniel Bertalan
2022-03-19Toolchain: Make wint_t unsigned for ClangTim Schumacher
2022-03-19Toolchain: Enable IFUNC support for GCCTim Schumacher
2022-03-19Toolchain: Enforce correct sizes for size_t and ptrdiff_tTim Schumacher
2022-02-13Toolchain: Fix QEMU build with latest gcc by disabling `-fcf-protection`Brian Gianforcaro
I noticed after upgrading my machine that the QEMU is no longer building due to GCC enabling `-fcf-protection` by default, even for targets that don't support it. The included patch came from the QEMU development list, but hasn't be included in any patch releases at the time of writing. https://lore.kernel.org/all/20220208211937.79580-1-vineetg@rivosinc.com/ Until QEMU patches, lets fix it on our end by patching before we build.
2022-02-11Toolchain: Update binutils to version 2.38Daniel Bertalan
This version comes with general fixes and, more importantly, introduces support for the packed RELR relocation format.
2022-01-24Toolchain: Backport support for the mold linkerDaniel Bertalan
The `-fuse-ld=mold` flag was only added in the not-yet-released GCC 12. Cherry-picked from the following upstream commit: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ad964f7eaef9c03ce68a01cfdd7fde9d56524868
2022-01-12Toolchain: Enable the `-rdynamic` flag in the gcc driverDaniel Bertalan
Although we handle it in the linker spec file, gcc will actually reject this argument unless it's also enabled in the option file. CMake adds this flag if the minimum required version is 3.3 or less (see CMP0065), so old projects would fail to compile because of this unrecognized option.
2022-01-10Toolchain: Backport `--update-section` support to llvm-objcopyDaniel Bertalan
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-09Toolchain: Fix macOS build failure due to a malformed patchDaniel Bertalan
Discord user aesophor pointed out that the GCC toolchain fails to build on macOS, and traced the issue back to 41ea37f2, which is the latest change to `gcc.patch`. Similarly, when I tried to run BuildIt.sh in the `--dev` mode, `git apply` complained about the patch being malformed. I regenerated the patch by manually applying the changes of 41ea37f2 on top of a known good GCC source tree, and I sent the new file to them. They reported that this fixed the build issue they were having.
2022-01-07Toolchain/GCC: Declare we don't have memalignMartin Bříza
I'm not even sure if this is a hack. However, we don't implement memalign so it's necessary to tell GCC so it doesn't go looking for it in their implementation of `new`
2022-01-04Toolchain: Fix building the aarch64 toolchainDaniel Bertalan
The `aarch64/t-aarch64` makefile fragment needs to be included for the aarch64-specific parts of GCC to be built. Before 738e52da5, this was done implicitly, but now it is not. This caused the following error when building the toolchain: "aarch64-builtins.o: No such file or directory".
2022-01-03Toolchain: Use Platform/SerenityOS.cmake in LLVM toolchain buildAndrew Kaster
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.
2021-12-16Toolchain: Link libgcc_s on an as-needed basisDaniel Bertalan
If we pass `-lgcc_s` explicitly to the linker, it will be added as a dependency even if no functions are used from it. This behavior is not consistent with other systems. GCC can already handle passing the correct flags, so let's rely on that instead. As an added benefit, we now get support for the `-static-libgcc` flag; and `-static-pie` will no longer mistakenly link us against the dynamic version of libgcc. No toolchain rebuild is required.
2021-11-28Toolchain/Clang: Support using `libstdc++` as the C++ standard libraryDaniel Bertalan
This will come in handy if we want to use the LLVM port with a GNU host compiler. As of version 13, libc++ uses `__attribute__((using_if_exists))` to import global LibC functions into the `std` namespace, which allows some symbols to be absent. GCC does not support this attribute, so it fails to build libc++ due to some obscure `wchar.h` functions. This means that cross-compiling libc++ is not possible; and on-target builds would be tedious, so we'll be better off using the toolchain's `libstdc++`.
2021-11-28Toolchain/Clang: Allow setting a default unwind libraryDaniel Bertalan
This will let us use `libgcc` for unwinding when we build the LLVM port with the GNU toolchain.
2021-11-28Toolchain/Clang: Pick up includes when running inside SerenityDaniel Bertalan
The toolchain should work without setting `--sysroot` when we build inside SerenityOS.
2021-11-28Toolchain/Clang: Add support for -static-libstdc++Daniel Bertalan
This option is already used by our GNU toolchain to avoid creating a circular dependency between LibC and `lib(std)c++`.
2021-11-14Toolchain: Load x64 executables at a higher addressTim Schumacher
Serenity defines a protected range of memory that must not be mmapped, and is apparently reserved for kernel tasks. In this case, the protected range is anything below 0x800000. However, in its default setting, binutils chooses the memory address 0x400000 as the mapping address for executables that do not have PIE enabled, resulting in mmap being unable to map the file unless the load address has been overwritten at link time or if it's a PIE. To mitigate this, move the default base address somewhere outside of that range (and preferably not anywhere close near the beginning of the useable virtual memory space, to avoid running into it during sequential allocations).
2021-11-14Toolchain: Add aligned allocation support to libc++Daniel Bertalan
Now that we have `_aligned_malloc` and `_aligned_free`, we can finally enable C++17 aligned allocation support.
2021-10-17Toolchain+Meta: Update LLVM version to 13.0.0Daniel Bertalan
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-09-17Toolchain: Remove breaking mbstate_t define from clangTim Schumacher
2021-09-07Meta: Make `serenity.sh rebuild-toolchain aarch64 clang` workNico Weber
2021-09-07Toolchain: Build aarch64-gdb for cross-debugging on x86Idan Horowitz
2021-08-28Toolchain: Enough to make `rebuild-toolchain aarch64` workNico Weber
The gcc patch might not be completely correct, but at least the toolchain completes building.
2021-08-28Toolchain: Regenerate binutils.patch and gcc.patchNico Weber
I locally modified Meta/serenity.sh to pass `--dev` to BuildIt.sh in build_toolchain(). Then I ran `Meta/serenity.sh rebuild-toolchain`, cd'd into Toolchain/Tarballs/binutils-2.37, `git add`ed unadded files in `git status`, and then ran `git diff > ../../Patches/binutils.patch`. Then I did the same for Toolchain/Tarballs/gcc-11.2.0 (and was careful not to `git add` serenity-kernel.h, since that's created by Toolchain/BuildIt.sh). No behavior change. This just rewrites the patch like git writes it.
2021-08-08Toolchain+Ports: Let -nostdlib make us not link against libgcc_sGunnar Beutner
For now this is not a mandatory toolchain rebuild.
2021-08-08Toolchain: Add LLVM patch and script for building itDaniel Bertalan
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-07-28Toolchain+Ports: Fix building ports on x86_64Gunnar Beutner
Fixes #8377.
2021-07-28Toolchain: Update GCC to version 11.2.0Gunnar Beutner
2021-07-28Toolchain: Update binutils to version 2.37Gunnar Beutner
2021-07-24Toolchain+Ports: Ignore -arch on macOS M1 hostsGunnar Beutner
CMake specifies -arch arm64 for our toolchain. Unfortunately that's an option GCC only understands when built for macOS. This causes the build to fail. I haven't been able to get CMake to not specify that option so this adds a dummy option to GCC.
2021-07-08Toolchain: Fix building toolchain on arm64 macsmodmuss50
This patch is based off: https://github.com/osx-cross/homebrew-avr/pull/248 and https://github.com/riscv/riscv-gnu-toolchain/issues/800
2021-07-06Kernel+Toolchain: Remove the kernel-specific toolchainGunnar Beutner
This is no longer necessary now that the kernel doesn't use libsupc++ anymore.
2021-06-07Toolchain+Ports: Fix building binutils on FreeBSDGunnar Beutner
This imports the upstream patch from https://sourceware.org/bugzilla/show_bug.cgi?id=27382 Fixes #7407.
2021-05-09Toolchain+Ports: Skip link tests for libstdc++v3Gunnar Beutner
This makes stdlib.h and stdio.h functions available in the std namespace for C++. libstdc++v3's link tests can fail if you don't have an up-to-date build directory, for example: 1. Have libc with missing _Exit symbol because you haven't done a build since that was added. 2. Run toolchain rebuild. libstdc++v3's configure script will realize that it can do link tests in general but will fail later on when it tries to link a program that tests for _Exit. Even though this is a toolchain patch this does not necessarily require rebuilding the toolchain right away. This is only required once we start using any of these new members in the std namespace, e.g. for ports.
2021-05-07Toolchain: Make -nodefaultlibs not link against libgcc_sGunnar Beutner
This fixes the -nodefaultlibs flag for gcc which previously linked against libgcc_s anyway. Even though this is a toolchain patch we don't need to rebuild the toolchain right away.
2021-05-03Toolchain: Enable building all code with -fPICGunnar Beutner
Ordinarily this would force the compiler to not inline certain symbols and call them via the PLT instead. To counteract this I've also added -fno-semantic-interposition which disables ELF symbol interposition. Our dynamic loader doesn't support this anyway and we might even consider not implementing this at all. Even though this is a toolchain change this doesn't require rebuilding the toolchain unless you're planning to build for the x86_64 arch.
2021-04-29Toolchain: Update the binutils patch file to match the portGunnar Beutner
Previously the toolchain's binutils would not have been able to build binaries on 32-bit host systems (not that this would be much of an issue nowadays) because one of the #ifdefs was in the wrong place. I moved the #ifdef in the port's patch and this now updates the toolchain's patch file to match the port's patch.
2021-04-29Toolchain+Ports: Update GCC to version 11.1.0Gunnar Beutner