summaryrefslogtreecommitdiff
path: root/Toolchain/Patches
AgeCommit message (Collapse)Author
2023-05-15Toolchain: Enable RELRO support for AArch64Daniel Bertalan
The BFD linker requires the `COMMONPAGESIZE` emulation parameter to be set in order to enable RELRO support for AArch64. As we are adding a custom `emulparams` file anyways, let's also tell LD that our ELF interpreter is called `/usr/lib/Loader.so`. This commit also removes some vestigial references to i686 SerenityOS. The one in `gas/configure.tgt` is still needed, as it also handles x86_64.
2023-05-15Toolchain+Ports: Update GCC to 13.1.0Daniel Bertalan
This is a mostly straight-forward rebase of our patches on top of 13.1.0. The spec files needed a change, as GCC no longer supports STABS debug information, but we were building GCC with support for it. Highlights of this release include static `operator()`, The Equality Operator You Are Looking For and extended `constexpr` support.
2023-04-29Toolchain: Patch QEMU to support reading kernel cmdline via RPI MailboxDaniel Bertalan
This commit backports my upstream QEMU patch to implement this functionality, which is currently waiting for review. It was submitted here: https://lists.nongnu.org/archive/html/qemu-arm/2023-04/msg00549
2023-04-14Ports/llvm: Increase the default stack size for LLVM executablesTim Schumacher
2023-04-02Toolchain: Allow many patches for gdb and add clang workaroundAndrew Kaster
This ports https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae61525fcf456ab395d55c45492a106d1275873a from upstream binutils, which enables building with the newest host clang versions.
2023-03-27Ports/binutils: Update binutils to version 2.40Cameron Youell
2023-03-01Toolchain: Don't abuse crt{begin,end}.o for shared or PIE binariesTim Schumacher
aarch64 required this to successfully build, but the actual fix to that is to just make sure that crtbeginS and crtendS get built as a part of the toolchain. This partially reverts commit c18c84dbfdc18effe5f8c5ffb56b2f5549e6bf90.
2023-01-25Toolchain: Ensure aarch64 libgcc_s.so.1 includes DT_SONAME tagTimon Kruiper
Without this tag, executables that link libgcc_s.so.1, which is every executable, end up with the host path to libgcc_s.so.1 as the path for the dynamic dependency (DT_NEEDED) of the executable. By making sure that the libgcc_s.so.1 shared object includes the DT_SONAME tag, the path to libgcc_s.so.1 dynamic dependency will only contain the basename, instead of the absolute host path.
2022-12-28Meta: Remove i686 targetLiav A
2022-10-27Toolchain: Update BuildQemu.sh to qemu-7.1Kenneth Myhra
QEMU 7.1 was released on August 30th. Release Notes: https://wiki.qemu.org/ChangeLog/7.1 The patch 'Toolchain/Patches/qemu-cf-protection-none.patch' (or similar) has been upstreamed so it can be safely removed.
2022-10-21Toolchain: Keep LLVM from using `shm_open` and friendsTim Schumacher
I originally missed this while handling the upgrade to LLVM 15 (as it only affects the on-serenity port), so the patch gets to be here with a bit of a delay. Co-Authored-By: sin-ack <sin-ack@users.noreply.github.com>
2022-10-14Toolchain: Fix building libgcc for AARCH64Gunnar Beutner
There was a typo in one of the spec files which resulted in us not building softfp support for libgcc. Additionally we were missing flags to build libgcc_s. This patch also makes sure we're not trying to link against crtbeginS.o and crtendS.o. This is part of a larger effort to at least get the userland to build at all.
2022-10-14Toolchain: Add SerenityOS to the LLVM config.guessTim Schumacher
2022-10-01Toolchain: Move the binutils patch into its own folderTim Schumacher
This makes binutils compatible with `./package.sh dev`, so that we can regenerate patches more easily, and neatly stack (temporary) patches on top.
2022-09-18Toolchain: Regenerate patches using the latest format rulesTim Schumacher
2022-09-16Toolchain: Remove references to `-lm`Tim Schumacher
2022-09-16Toolchain: Update to LLVM 15.0.0Tim Schumacher
2022-09-05Toolchain: Remove references to `-ldl`Tim Schumacher
2022-07-19Toolchain: Don't pass `-lpthread` when pthreads are requestedTim Schumacher
This is essentially a no-op since we have our replacement linker script, but if we can skip over that entirely, why not?
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.