mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-16 08:50:26 +03:00
Toolchain: Upgrade to GCC 12.1.0
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.
This commit is contained in:
parent
fd3e3d5e28
commit
6cf260c7af
Notes:
sideshowbarker
2024-07-17 11:59:51 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/6cf260c7af Pull-request: https://github.com/SerenityOS/serenity/pull/13954 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/EWouters Reviewed-by: https://github.com/timschumi ✅
@ -17,7 +17,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "SerenityOS")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check for toolchain mismatch, user might need to rebuild toolchain
|
# Check for toolchain mismatch, user might need to rebuild toolchain
|
||||||
set(GCC_VERSION "11.2.0")
|
set(GCC_VERSION "12.1.0")
|
||||||
set(LLVM_VERSION "14.0.1")
|
set(LLVM_VERSION "14.0.1")
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(EXPECTED_COMPILER_VERSION "${GCC_VERSION}")
|
set(EXPECTED_COMPILER_VERSION "${GCC_VERSION}")
|
||||||
|
@ -85,8 +85,8 @@ GDB_BASE_URL="https://ftp.gnu.org/gnu/gdb"
|
|||||||
|
|
||||||
# Note: If you bump the gcc version, you also have to update the matching
|
# Note: If you bump the gcc version, you also have to update the matching
|
||||||
# GCC_VERSION variable in the project's root CMakeLists.txt
|
# GCC_VERSION variable in the project's root CMakeLists.txt
|
||||||
GCC_VERSION="11.2.0"
|
GCC_VERSION="12.1.0"
|
||||||
GCC_MD5SUM="dc6886bd44bb49e2d3d662aed9729278"
|
GCC_MD5SUM="7854cdccc3a7988aa37fb0d0038b8096"
|
||||||
GCC_NAME="gcc-$GCC_VERSION"
|
GCC_NAME="gcc-$GCC_VERSION"
|
||||||
GCC_PKG="${GCC_NAME}.tar.gz"
|
GCC_PKG="${GCC_NAME}.tar.gz"
|
||||||
GCC_BASE_URL="https://ftp.gnu.org/gnu/gcc"
|
GCC_BASE_URL="https://ftp.gnu.org/gnu/gcc"
|
||||||
@ -271,13 +271,11 @@ pushd "$DIR/Tarballs"
|
|||||||
git init > /dev/null
|
git init > /dev/null
|
||||||
git add . > /dev/null
|
git add . > /dev/null
|
||||||
git commit -am "BASE" > /dev/null
|
git commit -am "BASE" > /dev/null
|
||||||
git am "$DIR"/Patches/gcc-support-mold-linker.patch > /dev/null
|
|
||||||
git apply "$DIR"/Patches/gcc.patch > /dev/null
|
git apply "$DIR"/Patches/gcc.patch > /dev/null
|
||||||
else
|
else
|
||||||
patch -p1 < "$DIR/Patches/gcc-support-mold-linker.patch" > /dev/null
|
|
||||||
patch -p1 < "$DIR/Patches/gcc.patch" > /dev/null
|
patch -p1 < "$DIR/Patches/gcc.patch" > /dev/null
|
||||||
fi
|
fi
|
||||||
$MD5SUM "$DIR/Patches/gcc.patch" "$DIR/Patches/gcc-support-mold-linker.patch" > .patch.applied
|
$MD5SUM "$DIR/Patches/gcc.patch" > .patch.applied
|
||||||
popd
|
popd
|
||||||
|
|
||||||
if [ "$SYSTEM_NAME" = "Darwin" ]; then
|
if [ "$SYSTEM_NAME" = "Darwin" ]; then
|
||||||
@ -323,7 +321,7 @@ pushd "$DIR/Build/$ARCH"
|
|||||||
--with-mpfr="$(brew --prefix mpfr)" \
|
--with-mpfr="$(brew --prefix mpfr)" \
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
${TRY_USE_LOCAL_TOOLCHAIN:+"--quiet"} || exit 1
|
${TRY_USE_LOCAL_TOOLCHAIN:+"--quiet"} || exit 1
|
||||||
else
|
else
|
||||||
buildstep "gdb/configure" "$DIR"/Tarballs/$GDB_NAME/configure --prefix="$PREFIX" \
|
buildstep "gdb/configure" "$DIR"/Tarballs/$GDB_NAME/configure --prefix="$PREFIX" \
|
||||||
--target="$TARGET" \
|
--target="$TARGET" \
|
||||||
--with-sysroot="$SYSROOT" \
|
--with-sysroot="$SYSROOT" \
|
||||||
@ -332,7 +330,6 @@ pushd "$DIR/Build/$ARCH"
|
|||||||
${TRY_USE_LOCAL_TOOLCHAIN:+"--quiet"} || exit 1
|
${TRY_USE_LOCAL_TOOLCHAIN:+"--quiet"} || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "XXX build gdb"
|
echo "XXX build gdb"
|
||||||
buildstep "gdb/build" "$MAKE" -j "$MAKEJOBS" || exit 1
|
buildstep "gdb/build" "$MAKE" -j "$MAKEJOBS" || exit 1
|
||||||
buildstep "gdb/install" "$MAKE" install || exit 1
|
buildstep "gdb/install" "$MAKE" install || exit 1
|
||||||
@ -364,7 +361,7 @@ pushd "$DIR/Build/$ARCH"
|
|||||||
buildstep "binutils/install" "$MAKE" install || exit 1
|
buildstep "binutils/install" "$MAKE" install || exit 1
|
||||||
popd
|
popd
|
||||||
|
|
||||||
echo "XXX serenity libc, libm and libpthread headers"
|
echo "XXX serenity libc, libdl, libm and libpthread headers"
|
||||||
mkdir -p "$BUILD"
|
mkdir -p "$BUILD"
|
||||||
pushd "$BUILD"
|
pushd "$BUILD"
|
||||||
mkdir -p Root/usr/include/
|
mkdir -p Root/usr/include/
|
||||||
@ -374,6 +371,7 @@ pushd "$DIR/Build/$ARCH"
|
|||||||
"$SRC_ROOT"/Kernel/API \
|
"$SRC_ROOT"/Kernel/API \
|
||||||
"$SRC_ROOT"/Kernel/Arch \
|
"$SRC_ROOT"/Kernel/Arch \
|
||||||
"$SRC_ROOT"/Userland/Libraries/LibC \
|
"$SRC_ROOT"/Userland/Libraries/LibC \
|
||||||
|
"$SRC_ROOT"/Userland/Libraries/LibDl \
|
||||||
"$SRC_ROOT"/Userland/Libraries/LibM \
|
"$SRC_ROOT"/Userland/Libraries/LibM \
|
||||||
"$SRC_ROOT"/Userland/Libraries/LibPthread \
|
"$SRC_ROOT"/Userland/Libraries/LibPthread \
|
||||||
-name '*.h' -print)
|
-name '*.h' -print)
|
||||||
@ -381,6 +379,7 @@ pushd "$DIR/Build/$ARCH"
|
|||||||
target=$(echo "$header" | sed \
|
target=$(echo "$header" | sed \
|
||||||
-e "s@$SRC_ROOT/AK/@AK/@" \
|
-e "s@$SRC_ROOT/AK/@AK/@" \
|
||||||
-e "s@$SRC_ROOT/Userland/Libraries/LibC@@" \
|
-e "s@$SRC_ROOT/Userland/Libraries/LibC@@" \
|
||||||
|
-e "s@$SRC_ROOT/Userland/Libraries/LibDl@@" \
|
||||||
-e "s@$SRC_ROOT/Userland/Libraries/LibM@@" \
|
-e "s@$SRC_ROOT/Userland/Libraries/LibM@@" \
|
||||||
-e "s@$SRC_ROOT/Userland/Libraries/LibPthread@@" \
|
-e "s@$SRC_ROOT/Userland/Libraries/LibPthread@@" \
|
||||||
-e "s@$SRC_ROOT/Kernel/@Kernel/@")
|
-e "s@$SRC_ROOT/Kernel/@Kernel/@")
|
||||||
@ -406,7 +405,6 @@ pushd "$DIR/Build/$ARCH"
|
|||||||
--target="$TARGET" \
|
--target="$TARGET" \
|
||||||
--with-sysroot="$SYSROOT" \
|
--with-sysroot="$SYSROOT" \
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
--with-newlib \
|
|
||||||
--enable-shared \
|
--enable-shared \
|
||||||
--enable-languages=c,c++ \
|
--enable-languages=c,c++ \
|
||||||
--enable-default-pie \
|
--enable-default-pie \
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
From 37f6a0c24bb07efb29a2222d984e4d793c165aef Mon Sep 17 00:00:00 2001
|
|
||||||
From: Martin Liska <mliska@suse.cz>
|
|
||||||
Date: Tue, 21 Dec 2021 17:43:55 +0100
|
|
||||||
Subject: [PATCH] Support ld.mold linker.
|
|
||||||
|
|
||||||
gcc/ChangeLog:
|
|
||||||
|
|
||||||
* collect2.c (main): Add ld.mold.
|
|
||||||
* common.opt: Add -fuse-ld=mold.
|
|
||||||
* doc/invoke.texi: Document it.
|
|
||||||
* gcc.c (driver_handle_option): Handle -fuse-ld=mold.
|
|
||||||
* opts.c (common_handle_option): Likewise.
|
|
||||||
---
|
|
||||||
gcc/collect2.c | 10 +++++++---
|
|
||||||
gcc/common.opt | 4 ++++
|
|
||||||
gcc/doc/invoke.texi | 4 ++++
|
|
||||||
gcc/gcc.c | 4 ++++
|
|
||||||
gcc/opts.c | 1 +
|
|
||||||
5 files changed, 20 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/gcc/collect2.c b/gcc/collect2.c
|
|
||||||
index 0c8af2987..6bb5cf9a4 100644
|
|
||||||
--- a/gcc/collect2.c
|
|
||||||
+++ b/gcc/collect2.c
|
|
||||||
@@ -785,6 +785,7 @@ main (int argc, char **argv)
|
|
||||||
USE_GOLD_LD,
|
|
||||||
USE_BFD_LD,
|
|
||||||
USE_LLD_LD,
|
|
||||||
+ USE_MOLD_LD,
|
|
||||||
USE_LD_MAX
|
|
||||||
} selected_linker = USE_DEFAULT_LD;
|
|
||||||
static const char *const ld_suffixes[USE_LD_MAX] =
|
|
||||||
@@ -793,7 +794,8 @@ main (int argc, char **argv)
|
|
||||||
PLUGIN_LD_SUFFIX,
|
|
||||||
"ld.gold",
|
|
||||||
"ld.bfd",
|
|
||||||
- "ld.lld"
|
|
||||||
+ "ld.lld",
|
|
||||||
+ "ld.mold"
|
|
||||||
};
|
|
||||||
static const char *const real_ld_suffix = "real-ld";
|
|
||||||
static const char *const collect_ld_suffix = "collect-ld";
|
|
||||||
@@ -970,6 +972,8 @@ main (int argc, char **argv)
|
|
||||||
selected_linker = USE_GOLD_LD;
|
|
||||||
else if (strcmp (argv[i], "-fuse-ld=lld") == 0)
|
|
||||||
selected_linker = USE_LLD_LD;
|
|
||||||
+ else if (strcmp (argv[i], "-fuse-ld=mold") == 0)
|
|
||||||
+ selected_linker = USE_MOLD_LD;
|
|
||||||
else if (strncmp (argv[i], "-o", 2) == 0)
|
|
||||||
{
|
|
||||||
/* Parse the output filename if it's given so that we can make
|
|
||||||
@@ -1082,7 +1086,7 @@ main (int argc, char **argv)
|
|
||||||
ld_file_name = 0;
|
|
||||||
#ifdef DEFAULT_LINKER
|
|
||||||
if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD ||
|
|
||||||
- selected_linker == USE_LLD_LD)
|
|
||||||
+ selected_linker == USE_LLD_LD || selected_linker == USE_MOLD_LD)
|
|
||||||
{
|
|
||||||
char *linker_name;
|
|
||||||
# ifdef HOST_EXECUTABLE_SUFFIX
|
|
||||||
@@ -1317,7 +1321,7 @@ main (int argc, char **argv)
|
|
||||||
else if (!use_collect_ld
|
|
||||||
&& strncmp (arg, "-fuse-ld=", 9) == 0)
|
|
||||||
{
|
|
||||||
- /* Do not pass -fuse-ld={bfd|gold|lld} to the linker. */
|
|
||||||
+ /* Do not pass -fuse-ld={bfd|gold|lld|mold} to the linker. */
|
|
||||||
ld1--;
|
|
||||||
ld2--;
|
|
||||||
}
|
|
||||||
diff --git a/gcc/common.opt b/gcc/common.opt
|
|
||||||
index 6fab7c3ca..8617124f9 100644
|
|
||||||
--- a/gcc/common.opt
|
|
||||||
+++ b/gcc/common.opt
|
|
||||||
@@ -2967,6 +2967,10 @@ fuse-ld=lld
|
|
||||||
Common Driver Negative(fuse-ld=lld)
|
|
||||||
Use the lld LLVM linker instead of the default linker.
|
|
||||||
|
|
||||||
+fuse-ld=mold
|
|
||||||
+Common Driver Negative(fuse-ld=mold)
|
|
||||||
+Use the Modern linker (MOLD) linker instead of the default linker.
|
|
||||||
+
|
|
||||||
fuse-linker-plugin
|
|
||||||
Common Undocumented Var(flag_use_linker_plugin)
|
|
||||||
|
|
||||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
|
||||||
index 7f13ffb79..31932cf2c 100644
|
|
||||||
--- a/gcc/doc/invoke.texi
|
|
||||||
+++ b/gcc/doc/invoke.texi
|
|
||||||
@@ -15601,6 +15601,10 @@ Use the @command{gold} linker instead of the default linker.
|
|
||||||
@opindex fuse-ld=lld
|
|
||||||
Use the LLVM @command{lld} linker instead of the default linker.
|
|
||||||
|
|
||||||
+@item -fuse-ld=mold
|
|
||||||
+@opindex fuse-ld=mold
|
|
||||||
+Use the Modern Linker (@command{mold}) instead of the default linker.
|
|
||||||
+
|
|
||||||
@cindex Libraries
|
|
||||||
@item -l@var{library}
|
|
||||||
@itemx -l @var{library}
|
|
||||||
diff --git a/gcc/gcc.c b/gcc/gcc.c
|
|
||||||
index 4d790f9dd..ce6366946 100644
|
|
||||||
--- a/gcc/gcc.c
|
|
||||||
+++ b/gcc/gcc.c
|
|
||||||
@@ -4189,6 +4189,10 @@ driver_handle_option (struct gcc_options *opts,
|
|
||||||
use_ld = ".gold";
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case OPT_fuse_ld_mold:
|
|
||||||
+ use_ld = ".mold";
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
case OPT_fcompare_debug_second:
|
|
||||||
compare_debug_second = 1;
|
|
||||||
break;
|
|
||||||
diff --git a/gcc/opts.c b/gcc/opts.c
|
|
||||||
index 24bb64198..9192ca757 100644
|
|
||||||
--- a/gcc/opts.c
|
|
||||||
+++ b/gcc/opts.c
|
|
||||||
@@ -2875,6 +2875,7 @@ common_handle_option (struct gcc_options *opts,
|
|
||||||
case OPT_fuse_ld_bfd:
|
|
||||||
case OPT_fuse_ld_gold:
|
|
||||||
case OPT_fuse_ld_lld:
|
|
||||||
+ case OPT_fuse_ld_mold:
|
|
||||||
case OPT_fuse_linker_plugin:
|
|
||||||
/* No-op. Used by the driver and passed to us because it starts with f.*/
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
2.34.1
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user