summaryrefslogtreecommitdiff
path: root/Toolchain
AgeCommit message (Collapse)Author
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.
2021-08-08Toolchain: Build libLLVM as a dynamic libraryDaniel Bertalan
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-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 caching to BuildClang.sh for CIDaniel Bertalan
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-08-03Ports: Change Python's auth_type to sha256Linus Groh
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-10Toolchain: Use correct variable when deleting the QEMU tarballGunnar Beutner
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-07-03Meta: Change the QEMU binary directory to Toolchain/Local/qemuGunnar Beutner
Previously we'd place the QEMU binaries into the architecture-specific toolchain directory. This is a problem because the BuildIt.sh script clears those directories which also removes the QEMU binaries users may have built earlier. Also, the QEMU binaries are not specific to the target architecture.