summaryrefslogtreecommitdiff
path: root/Toolchain
AgeCommit message (Collapse)Author
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-06-19Toolchain: Update mold to 1.0.3kleines Filmröllchen
2022-06-11Toolchain: Add $arch-pc-serenity-clang symlinkDaniel Bertalan
This will allow us to build ports that don't allow the --target and --sysroot compiler arguments to be specified in $CC/$CXX.
2022-05-20Toolchain: Fix shellcheck warningDaniel Bertalan
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-08Toolchain: Allow BuildQemu.sh to resume downloadsLucas CHOLLET
Use -C option for curl to resume if a partially downloaded file already exists.
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-25Toolchain: Explicitly install llvm-config and FileCheckAndrew Kaster
Also disable the "toolchain only build" to ensure we install llvm headers for when we want to build host tools that link against llvm.
2022-04-23Toolchain: Update BuildQemu.sh to qemu-7.0EWouters
QEMU 7.0 was released on April 19th. Release Notes: https://wiki.qemu.org/ChangeLog/7.0
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-04-01Toolchain: Fix the gdb build for aarch64 target on macOS hostJames Mintram
2022-03-31Toolchain: Add a gcc patch to fix linker error on M1 hostJames Mintram
2022-03-29Toolchain: Fix serenity.nixjd
* x11 package name has changed to xlibsWrapper. * texinfo is necessary for Makeinfo. * e2fsprogs was recenty fixed on nicpkgs to include fuse2fs to mount serenity images without root access but it needed some configuration.
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-03-08Toolchain: Move nix script from Documentation into ToolchainJonathan Marler
Moves the nix script to setup the build environment from Documentation into the Toolchain as a callable script. I also modified the script to accept a "pkgs" argument to make it easy to override the nixpkgs version from the command-line when calling the script.
2022-03-04Kernel: Add support for SA_SIGINFOAli Mohammad Pur
We currently don't really populate most of the fields, but that can wait :^)
2022-02-19Toolchain: Set CMAKE_NM for Clang and GNU toolchain filesAndrew Kaster
Make sure that we set CMAKE_NM, it's possible that some version of CMake could choose a host nm binary instead of the ones we just built. It's unlikely that host nm will understand our .dyn.relr segments unless it's from binutils 2.38 or higher, so it might complain.
2022-02-14Toolchain: Update Dockerfile to use gcc 11 and add texinfo packageAndrew Kaster
Missed this in the gcc 11 version update, but if anyone is using this then they'll need gcc 11 to build Lagom.
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: Add support for building the userland with the mold linkerDaniel Bertalan
This commit adds support for building the SerenityOS userland with the new [mold linker]. This is not enabled by default yet; to link using mold, run the `Toolchain/BuildMold.sh` script to build the latest release of mold, and set the `ENABLE_MOLD_LINKER` CMake variable to ON. This option relies on toolchain support that has been added just recently, so you might need to rebuild your toolchain for mold to work. [mold linker]: https://github.com/rui314/mold
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-24Toolchain+Ports: Use the GNU hash format by defaultDaniel Bertalan
This hash format offers faster symbol lookup than the System V hash. We've been using it in all our shared libraries for a long time, but did not have it enabled by default in our toolchain, so ports couldn't make use of it.
2022-01-24Kernel+Toolchain: Use `.init_array` section for global constructorsDaniel Bertalan
Before this change, our dynamic linker's global constructor handler relied on the GNU linker implicitly including the content of `.ctors` section inside `.init_array`. The mold linker does not do this, so global constructors would fail to be called in the mold-built userland. There is no point in sticking to `.ctors`, as most other systems already use the superior `.init_array` scheme. This commit changes the kernel linker script to not discard this new section, and enables it by default in our toolchain.
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.