summaryrefslogtreecommitdiff
path: root/Toolchain
AgeCommit message (Collapse)Author
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-12Toolchain: Enable std::filesystem support in libc++Daniel Bertalan
Now that the last missing function (`fchmodat(2)`) has been added to LibC, libc++ compiles successfully with std::filesystem support enabled.
2022-01-10Toolchain+CI: Link LLVM with LLD if availableDaniel Bertalan
According to most benchmarks, LLD is faster than GNU ld and the macOS linker, so let's use it if possible in order to speed up the toolchain build.
2022-01-10Toolchain: Do not overwrite libraries with stubs when rebuilding LLVMDaniel Bertalan
We erroneously appended ".so" after the base name for the library, so we ended up checking for the existence of e.g. `libc.so.so`, which obviously didn't exist, so we overwrote the existing libraries when we rebuilt the toolchain.
2022-01-10Toolchain: Don't use GNU objcopy in the LLVM toolchainDaniel Bertalan
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-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-04Toolchain: Add support for Clang on MacOSJean-Paul Balabanian
This commit adds Darwin as a possible host for building the toolchain with Clang.
2022-01-03Toolchain: Add CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME to PlatformAndrew Kaster
This property tells CMake that if a library is missing a SONAME field, the link editor(s) we use will insert the full path to the library into the binary. This is the behaivor of GNU ld compatible linkers, so let's avoid that possiblity by telling CMake that it really doesn't want to let the linker embed the full path to the lib. This is especially important when cross-compiling things for ports and such, as the full path to the lib will have absolutely nothing to do with the runtime path
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-29Build: Remove gzip -k usage in PCI/USB ID files and crypt for OpenBSDtuftedocelot
OpenBSD gzip does not have the -k flag to keep the original after extraction. Work around this by copying the original gzip to the dest and then extracting. A bit of a hack, but only needs to be done for the first-time or rebuilds OpenBSD provides crypt in libc, not libcrypt. Adjust if/else to check for either and proceed accordingly Remove outdated OpenBSD checks when building the toolchain
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-12-16Toolchain: Update BuildQemu.sh to qemu-6.2Brian Gianforcaro
QEMU 6.2 was released on December 14th. Release Notes: https://wiki.qemu.org/ChangeLog/6.2
2021-11-28Toolchain/Clang: Fix CMake using utilities from the LLVM portDaniel Bertalan
If we have the LLVM port installed, CMake might pick up some of the tools installed as part of it (`llvm-ar`, `llvm-strip`, etc.) instead of the ones belonging to the host toolchain. These, of course, can't be run on the host platform, so builds would eventually fail. This made it impossible to rebuild the LLVM toolchain. We now set these variables explicitly when compiling the LLVM runtime libraries in order to avoid this issue.
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-20Toolchain: Remove `git clone` of project from DockerfileJelle Raaijmakers
The goal of these more recent additions to the Dockerfile is to provide a working copy of SerenityOS with the toolchain prebuilt. To me, these additions feel misplaced: - The toolchain is built assuming the i686 architecture, which may not be what you want. - You get a shallow clone of the project limiting you in your abilities to navigate through the project's history or bisect. - There's this awkward directory structure of `/serenity/serenity-git` and `/serenity/out`. The Dockerfile is immensely useful for building SerenityOS in a containerized environment, separate from the host's environment. If we want to automate builds, we can always use CI or extend this image to do so. For now, let's remove the `git clone` and associated actions. Fixes #9310.
2021-11-20Toolchain: Remove unused gettext package from DockerfileJelle Raaijmakers
It is no longer used to build the git port, it seems.
2021-11-20Toolchain: Remove unused wget package from DockerfileJelle Raaijmakers
2021-11-20Toolchain: Add Qemu build dependencies to DockerfileJelle Raaijmakers
Also add `libsdl2-dev` as a required dependency and reorder the list of packages passed to `apt-get`.
2021-11-20Toolchain: Update Dockerfile to ubuntu:21.10Jelle Raaijmakers
2021-11-14Toolchain: Enable clang-tools-extra for LLVMAndrew Kaster
If we want to use clang-tidy on the codebase, we'll need to build clang-tidy from an LLVM that has been patched and built with Serenity cross-compilation support.
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-11-07CMake: Assume working compiler instead of using static linkingTim Schumacher
We were previously using TRY_COMPILE_TARGET_TYPE to bypass the compiler check at the beginning of the CMake build, since we don't have LibC available and therefore can't link at that point. However, this breaks a lot of assumptions in try_compile when it comes to library checks. While this was the main idea behind our usage of the flag, it also has some really nasty side effects when software wants to find out what library a symbol is in. Instead, just manually tell CMake that our compiler works as intended and keep the target type setting at its default.
2021-10-31Toolchain: Use dynamic paths for cross-compile CMake toolchainsTim Schumacher
`CMAKE_INSTALL_PREFIX` is supposed to be the in-system installation path. The sysroot path on the host doesn't belong there, since other applications will duplicate that path when applying their respective sysroot.
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-10-17Toolchain: Introduce stubs for core system librariesDaniel Bertalan
This allows the linker to link against these dynamic libraries when compiling libc++/libunwind, without having to do a separate bootstrapping LibC build. Without this change, libc++ would fail to pick up the need to link to `LibPthread` if no prior builds of it existed. Because of this, we'd immediately have an assertion failure in SystemServer, as mutexes are used for the safe construction of function-local static variables.
2021-10-05Everywhere: Change from http to https where feasibleBen Wiederhake
I used "git grep -FIn http://" to find all occurrences, and looked at each one. If an occurrence was really just a link, and if a https version exists, and if our Browser can access it at least as well as the http version, then I changed the occurrence to https. I'm happy to report that I didn't run into a single site where Browser can't deal with the https version.
2021-09-24Ports: Add Ruby 3.0.2Eric Seifert
2021-09-21Toolchain: Add --ci option to BuildClang to enable ccacheTimothy Flynn
2021-09-17Toolchain: Remove breaking mbstate_t define from clangTim Schumacher
2021-09-15Meta+Toolchain: Rename CMAKE_CXXFILT to SERENITY_CXXFILTAndrew Kaster
The "CMAKE_<foo>" variable namespace is reserved, and CXXFILT is not currently a variable known to upstream CMake.
2021-09-15Meta: Switch to a SuperBuild that splits host and target buildsAndrew Kaster
Replace the old logic where we would start with a host build, and swap all the CMake compiler and target variables underneath it to trick CMake into building for Serenity after we configured and built the Lagom code generators. The SuperBuild creates two ExternalProjects, one for Lagom and one for Serenity. The Serenity project depends on the install stage for the Lagom build. The SuperBuild also generates a CMakeToolchain file for the Serenity build to use that replaces the old toolchain file that was only used for Ports. To ensure that code generators are rebuilt when core libraries such as AK and LibCore are modified, developers will need to direct their manual `ninja` invocations to the SuperBuild's binary directory instead of the Serenity binary directory. This commit includes warning coalescing and option style cleanup for the affected CMakeLists in the Kernel, top level, and runtime support libraries. A large part of the cleanup is replacing USE_CLANG_TOOLCHAIN with the proper CMAKE_CXX_COMPILER_ID variable, which will no longer be confused by a host clang compiler.
2021-09-07Meta: Make BuildClang.sh produce less output when running in a TTYNico Weber
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-07Meta: Don't pass LLVM_LLVM_BUILD_LLVM_DYLIB to cmakeNico Weber
`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-07Meta: Make `serenity.sh rebuild-toolchain aarch64 clang` workNico Weber
2021-09-07Toolchain: Build aarch64-gdb for cross-debugging on x86Idan Horowitz
2021-09-03Meta: Add the ability to specify clang with serenity.shTom
This enables maintaining gcc and clang builds side-by-side.
2021-08-28Toolchain: Also build aarch64-softmmu in BuildQemu.shNico Weber
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-25Toolchain: Update BuildQemu.sh to latest 6.1.0Brian Gianforcaro
Change Log: https://wiki.qemu.org/ChangeLog/6.1
2021-08-17Toolchain: Make Kernel/API headers available to Clang toolchain buildTimothy Flynn
Copied from 9b7986790900a3a81edd879ea31583670977496f.
2021-08-14Toolchain: Make Kernel/API/ headers available during toolchain buildAndreas Kling
2021-08-08Toolchain: Remove static LLVM librariesDaniel Bertalan
We link against these dynamically anyways, so having them around is not useful. Removing them frees precious storage space on CI.