Update toolchain to binutils-2.33.1 gcc-9.2.0

Toolchain build makes git repo out of toolchain to allow patching
Fix Makefiles to use new libstdc++
Parameterize BuildIt with default TARGET of i686 but arm is experimental
This commit is contained in:
Philip Herron 2019-12-17 21:42:42 +00:00 committed by Andreas Kling
parent 1c9742a4a5
commit c73aa662bb
Notes: sideshowbarker 2024-07-19 10:48:37 +09:00
5 changed files with 298 additions and 162 deletions

View File

@ -109,8 +109,8 @@ OBJS = $(CXX_OBJS) Arch/i386/Boot/boot.ao
KERNEL = kernel KERNEL = kernel
CXXFLAGS += -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables CXXFLAGS += -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables
CXXFLAGS += -nostdlib -nostdinc -nostdinc++ CXXFLAGS += -nostdlib -nostdinc -nostdinc++
CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/8.3.0/ CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/
CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/8.3.0/i686-pc-serenity/ CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/i686-pc-serenity/
DEFINES += -DKERNEL DEFINES += -DKERNEL
LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib

View File

@ -1,6 +1,6 @@
ARCH_FLAGS = ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -Wno-sized-deallocation -fno-sized-deallocation STANDARD_FLAGS = -std=c++17 -Wno-sized-deallocation -fno-sized-deallocation
WARNING_FLAGS = -Werror -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-expansion-to-defined WARNING_FLAGS = -Werror -Wextra -Wall -Wno-nonnull-compare -Wno-deprecated-copy -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-expansion-to-defined
FLAVOR_FLAGS = -fno-exceptions -fno-rtti FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os OPTIMIZATION_FLAGS = -Os

View File

@ -7,7 +7,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "$DIR" echo "$DIR"
TARGET=i686-pc-serenity ARCH=${ARCH:-"i686"}
TARGET="$ARCH-pc-serenity"
PREFIX="$DIR/Local" PREFIX="$DIR/Local"
SYSROOT="$DIR/../Root" SYSROOT="$DIR/../Root"
@ -15,45 +16,62 @@ echo PREFIX is "$PREFIX"
echo SYSROOT is "$SYSROOT" echo SYSROOT is "$SYSROOT"
mkdir -p "$DIR/Tarballs" mkdir -p "$DIR/Tarballs"
source "$DIR/UseIt.sh" source "$DIR/UseIt.sh"
BINUTILS_VERSION="2.33.1"
BINUTILS_MD5SUM="d1119c93fc0ed3007be4a84dd186af5"
BINUTILS_NAME="binutils-$BINUTILS_VERSION"
BINUTILS_PKG="${BINUTILS_NAME}.tar.gz"
BINUTILS_BASE_URL="http://ftp.gnu.org/gnu/binutils"
GCC_VERSION="9.2.0"
GCC_MD5SUM="e03739b042a14376d727ddcfd05a9bc3"
GCC_NAME="gcc-$GCC_VERSION"
GCC_PKG="${GCC_NAME}.tar.gz"
GCC_BASE_URL="http://ftp.gnu.org/gnu/gcc"
pushd "$DIR/Tarballs" pushd "$DIR/Tarballs"
md5="$(md5sum binutils-2.32.tar.gz | cut -f1 -d' ')" md5="$(md5sum $BINUTILS_PKG | cut -f1 -d' ')"
echo "bu md5='$md5'" echo "bu md5='$md5'"
if [ ! -e "binutils-2.32.tar.gz" ] || [ "$md5" != "d1119c93fc0ed3007be4a84dd186af55" ] ; then if [ ! -e $BINUTILS_PKG ] || [ "$md5" != ${BINUTILS_MD5SUM} ] ; then
rm -f binutils-2.32.tar.gz rm -f $BINUTILS_PKG
curl -O "http://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.gz" wget "$BINUTILS_BASE_URL/$BINUTILS_PKG"
else else
echo "Skipped downloading binutils" echo "Skipped downloading binutils"
fi fi
md5="$(md5sum gcc-8.3.0.tar.gz | cut -f1 -d' ')" md5="$(md5sum ${GCC_PKG} | cut -f1 -d' ')"
echo "gc md5='$md5'" echo "gc md5='$md5'"
if [ ! -e "gcc-8.3.0.tar.gz" ] || [ "$md5" != "9972f8c24c02ebcb5a342c1b30de69ff" ] ; then if [ ! -e $GCC_PKG ] || [ "$md5" != ${GCC_MD5SUM} ] ; then
rm -f gcc-8.3.0.tar.gz rm -f $GCC_PKG
curl -O "http://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz" wget "$GCC_BASE_URL/$GCC_NAME/$GCC_PKG"
else else
echo "Skipped downloading gcc" echo "Skipped downloading gcc"
fi fi
if [ ! -d "binutils-2.32" ]; then if [ ! -d ${BINUTILS_NAME} ]; then
echo "Extracting binutils..." echo "Extracting binutils..."
tar -xf "binutils-2.32.tar.gz" tar -xf ${BINUTILS_PKG}
pushd "binutils-2.32" pushd ${BINUTILS_NAME}
patch -p1 < "$DIR"/Patches/binutils.patch > /dev/null git init
git add .
git commit -am "BASE"
git apply "$DIR"/Patches/binutils.patch
popd popd
else else
echo "Skipped extracting binutils" echo "Skipped extracting binutils"
fi fi
if [ ! -d "gcc-8.3.0" ]; then if [ ! -d $GCC_NAME ]; then
echo "Extracting gcc..." echo "Extracting gcc..."
tar -xf "gcc-8.3.0.tar.gz" tar -xf $GCC_PKG
pushd "gcc-8.3.0" pushd $GCC_NAME
patch -p1 < "$DIR"/Patches/gcc.patch > /dev/null git init
git add .
git commit -am "BASE"
git apply "$DIR"/Patches/gcc.patch
popd popd
else else
echo "Skipped extracting gcc" echo "Skipped extracting gcc"
@ -73,7 +91,7 @@ pushd "$DIR/Build/"
unset PKG_CONFIG_LIBDIR # Just in case unset PKG_CONFIG_LIBDIR # Just in case
pushd binutils pushd binutils
"$DIR"/Tarballs/binutils-2.32/configure --prefix="$PREFIX" \ "$DIR"/Tarballs/binutils-2.33.1/configure --prefix="$PREFIX" \
--target="$TARGET" \ --target="$TARGET" \
--with-sysroot="$SYSROOT" \ --with-sysroot="$SYSROOT" \
--disable-nls || exit 1 --disable-nls || exit 1
@ -82,7 +100,7 @@ pushd "$DIR/Build/"
popd popd
pushd gcc pushd gcc
"$DIR"/Tarballs/gcc-8.3.0/configure --prefix="$PREFIX" \ "$DIR"/Tarballs/gcc-9.2.0/configure --prefix="$PREFIX" \
--target="$TARGET" \ --target="$TARGET" \
--with-sysroot="$SYSROOT" \ --with-sysroot="$SYSROOT" \
--disable-nls \ --disable-nls \

View File

@ -1,10 +1,11 @@
diff -Nru ../binutils-2.32/bfd/config.bfd binutils-2.32-serenity/bfd/config.bfd diff --git a/bfd/config.bfd b/bfd/config.bfd
--- ../binutils-2.32/bfd/config.bfd 2019-01-19 17:01:32.000000000 +0100 index 13d678e1..782ad689 100644
+++ binutils-2.32-serenity/bfd/config.bfd 2019-04-04 17:41:07.000000000 +0200 --- a/bfd/config.bfd
@@ -223,6 +223,20 @@ +++ b/bfd/config.bfd
;; @@ -220,6 +220,26 @@ esac
case "${targ}" in
# START OF targmatch.h # START OF targmatch.h
#ifdef BFD64
+ +
+ i[3-7]86-*-serenity*) + i[3-7]86-*-serenity*)
+ targ_defvec=i386_elf32_vec + targ_defvec=i386_elf32_vec
@ -19,13 +20,20 @@ diff -Nru ../binutils-2.32/bfd/config.bfd binutils-2.32-serenity/bfd/config.bfd
+ ;; + ;;
+#endif +#endif
+ +
#ifdef BFD64 + arm-*-serenity*)
+ targ_defvec=arm_elf32_le_vec
+ targ_selvecs=
+ targ64_selvecs=
+ ;;
+
aarch64-*-darwin*) aarch64-*-darwin*)
targ_defvec=aarch64_mach_o_vec targ_defvec=aarch64_mach_o_vec
diff -Nru ../binutils-2.32/config.sub binutils-2.32-serenity/config.sub targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
--- ../binutils-2.32/config.sub 2019-01-19 17:01:33.000000000 +0100 diff --git a/config.sub b/config.sub
+++ binutils-2.32-serenity/config.sub 2019-04-04 17:39:29.000000000 +0200 index 5b158ac4..49f05c37 100755
@@ -1337,6 +1337,7 @@ --- a/config.sub
+++ b/config.sub
@@ -1342,6 +1342,7 @@ case $os in
# Each alternative MUST end in a * to match a version number. # Each alternative MUST end in a * to match a version number.
# sysv* is not here because it comes later, after sysvr4. # sysv* is not here because it comes later, after sysvr4.
gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
@ -33,71 +41,64 @@ diff -Nru ../binutils-2.32/config.sub binutils-2.32-serenity/config.sub
| *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | kopensolaris* | plan9* \ | sym* | kopensolaris* | plan9* \
diff -Nru ../binutils-2.32/gas/configure.tgt binutils-2.32-serenity/gas/configure.tgt diff --git a/gas/configure.tgt b/gas/configure.tgt
--- ../binutils-2.32/gas/configure.tgt 2019-01-19 17:01:33.000000000 +0100 index a4828c4c..4d75ca56 100644
+++ binutils-2.32-serenity/gas/configure.tgt 2019-04-04 17:41:40.000000000 +0200 --- a/gas/configure.tgt
@@ -121,6 +121,7 @@ +++ b/gas/configure.tgt
@@ -121,6 +121,8 @@ esac
generic_target=${cpu_type}-$vendor-$os generic_target=${cpu_type}-$vendor-$os
# Note: This table is alpha-sorted, please try to keep it that way. # Note: This table is alpha-sorted, please try to keep it that way.
case ${generic_target} in case ${generic_target} in
+ i386-*-serenity*) fmt=elf;; + i386-*-serenity*) fmt=elf;;
+ arm-*-serenity*) fmt=elf;;
aarch64*-*-elf*) fmt=elf;; aarch64*-*-elf*) fmt=elf;;
aarch64*-*-fuchsia*) fmt=elf;; aarch64*-*-fuchsia*) fmt=elf;;
aarch64*-*-linux*) fmt=elf em=linux aarch64*-*-linux*) fmt=elf em=linux
diff -Nru ../binutils-2.32/ld/Makefile.am binutils-2.32-serenity/ld/Makefile.am diff --git a/ld/Makefile.am b/ld/Makefile.am
--- ../binutils-2.32/ld/Makefile.am 2019-01-19 17:01:33.000000000 +0100 index 0509c2e5..b1adc7c6 100644
+++ binutils-2.32-serenity/ld/Makefile.am 2019-04-04 17:50:13.000000000 +0200 --- a/ld/Makefile.am
@@ -1289,6 +1289,10 @@ +++ b/ld/Makefile.am
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ @@ -178,6 +178,7 @@ ALL_EMULATION_SOURCES = \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} earmelf_nbsd.c \
earmelf_phoenix.c \
+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \ earmelf_vxworks.c \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + earmelf_serenity.c \
+ ${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)" earmelfb.c \
+ earmelfb_fbsd.c \
eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \ earmelfb_fuchsia.c \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} diff --git a/ld/Makefile.in b/ld/Makefile.in
index 9898392a..9357b539 100644
@@ -1849,6 +1853,10 @@ --- a/ld/Makefile.in
eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \ +++ b/ld/Makefile.in
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} @@ -665,6 +665,7 @@ ALL_EMULATION_SOURCES = \
earmelf_nbsd.c \
+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \ earmelf_phoenix.c \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} earmelf_vxworks.c \
+ ${GENSCRIPTS} elf_x86_64_serenity "$(tdir_elf_x86_64_serenity)" + earmelf_serenity.c \
+ earmelfb.c \
eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \ earmelfb_fbsd.c \
$(srcdir)/emulparams/elf_x86_64.sh \ earmelfb_fuchsia.c \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} @@ -779,6 +780,7 @@ ALL_EMULATION_SOURCES = \
diff -Nru ../binutils-2.32/ld/Makefile.in binutils-2.32-serenity/ld/Makefile.in eelf_i386_vxworks.c \
--- ../binutils-2.32/ld/Makefile.in 2019-02-02 16:54:43.000000000 +0100 eelf_iamcu.c \
+++ binutils-2.32-serenity/ld/Makefile.in 2019-04-04 17:50:55.000000000 +0200 eelf_s390.c \
@@ -2893,6 +2893,10 @@ + eelf_i386_serenity.c \
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ eh8300elf.c \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} eh8300elf_linux.c \
eh8300helf.c \
+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \ @@ -945,6 +947,7 @@ ALL_64_EMULATION_SOURCES = \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} eelf_x86_64_fbsd.c \
+ ${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)" eelf_x86_64_nacl.c \
+ eelf_x86_64_sol2.c \
eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \ + eelf_x86_64_serenity.c \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ehppa64linux.c \
ei386pep.c \
@@ -3453,6 +3457,10 @@ emmo.c
eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \ diff --git a/ld/configure.tgt b/ld/configure.tgt
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} index c81bc8a7..a93a04c6 100644
--- a/ld/configure.tgt
+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \ +++ b/ld/configure.tgt
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} @@ -45,6 +45,19 @@ targ64_extra_libpath=
+ ${GENSCRIPTS} elf_x86_64_serenity "$(tdir_elf_x86_64_serenity)"
+
eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff -Nru ../binutils-2.32/ld/configure.tgt binutils-2.32-serenity/ld/configure.tgt
--- ../binutils-2.32/ld/configure.tgt 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/ld/configure.tgt 2019-04-04 17:42:40.000000000 +0200
@@ -45,6 +45,15 @@
# architecture variants should be kept together even if their names # architecture variants should be kept together even if their names
# break the alpha sorting. # break the alpha sorting.
case "${targ}" in case "${targ}" in
@ -109,19 +110,40 @@ diff -Nru ../binutils-2.32/ld/configure.tgt binutils-2.32-serenity/ld/configure.
+x86_64-*-serenity*) +x86_64-*-serenity*)
+ targ_emul=elf_x86_64_serenity + targ_emul=elf_x86_64_serenity
+ targ_extra_emuls="elf_i386_serenity elf_x86_64 elf_i386" + targ_extra_emuls="elf_i386_serenity elf_x86_64 elf_i386"
+ ;;
+arm-*-serenity*)
+ targ_emul=armelf_serenity
+ targ_extra_emuls="armelf_serenity armelf"
+ ;; + ;;
aarch64_be-*-elf) targ_emul=aarch64elfb aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;; targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
aarch64-*-elf | aarch64-*-rtems*) aarch64-*-elf | aarch64-*-rtems*)
diff -Nru ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh diff --git a/ld/emulparams/armelf_serenity.sh b/ld/emulparams/armelf_serenity.sh
--- ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh 1970-01-01 01:00:00.000000000 +0100 new file mode 100644
+++ binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh 2019-04-04 17:43:12.000000000 +0200 index 00000000..517cd626
--- /dev/null
+++ b/ld/emulparams/armelf_serenity.sh
@@ -0,0 +1,7 @@
+. ${srcdir}/emulparams/armelf.sh
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+TEXT_START_ADDR=0x00008000
+TARGET2_TYPE=got-rel
+
+unset STACK_ADDR
+unset EMBEDDED
diff --git a/ld/emulparams/elf_i386_serenity.sh b/ld/emulparams/elf_i386_serenity.sh
new file mode 100644
index 00000000..342d5298
--- /dev/null
+++ b/ld/emulparams/elf_i386_serenity.sh
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
+. ${srcdir}/emulparams/elf_i386.sh +. ${srcdir}/emulparams/elf_i386.sh
+GENERATE_SHLIB_SCRIPT=yes +GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes
diff -Nru ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh diff --git a/ld/emulparams/elf_x86_64_serenity.sh b/ld/emulparams/elf_x86_64_serenity.sh
--- ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh 1970-01-01 01:00:00.000000000 +0100 new file mode 100644
+++ binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh 2019-04-04 17:43:34.000000000 +0200 index 00000000..a2af90a6
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_serenity.sh
@@ -0,0 +1 @@ @@ -0,0 +1 @@
+. ${srcdir}/emulparams/elf_x86_64.sh +. ${srcdir}/emulparams/elf_x86_64.sh

View File

@ -1,18 +1,30 @@
diff -Nru ../gcc-8.3.0/config.sub gcc-8.3.0-serenity/config.sub diff --git a/config.sub b/config.sub
--- ../gcc-8.3.0/config.sub 2018-01-03 05:25:18.000000000 +0100 index 75bb6a313..da281fb48 100755
+++ gcc-8.3.0-serenity/config.sub 2019-04-04 19:51:43.000000000 +0200 --- a/config.sub
@@ -1391,6 +1391,7 @@ +++ b/config.sub
# Each alternative MUST end in a * to match a version number. @@ -2,7 +2,7 @@
# -sysv* is not here because it comes later, after sysvr4. # Configuration validation subroutine script.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ # Copyright 1992-2019 Free Software Foundation, Inc.
+ | -serenity* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ -timestamp='2019-01-01'
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ +timestamp='2019-12-17'
| -sym* | -kopensolaris* | -plan9* \
diff -Nru ../gcc-8.3.0/fixincludes/mkfixinc.sh gcc-8.3.0-serenity/fixincludes/mkfixinc.sh # This file is free software; you can redistribute it and/or modify it
--- ../gcc-8.3.0/fixincludes/mkfixinc.sh 2016-06-21 23:57:20.000000000 +0200 # under the terms of the GNU General Public License as published by
+++ gcc-8.3.0-serenity/fixincludes/mkfixinc.sh 2019-04-04 19:58:19.000000000 +0200 @@ -1363,7 +1363,7 @@ case $os in
@@ -11,6 +11,7 @@ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd* | amdhsa* | unleashed* | emscripten*)
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | serenity*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
qnx*)
diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
index 0f9648608..1a6031479 100755
--- a/fixincludes/mkfixinc.sh
+++ b/fixincludes/mkfixinc.sh
@@ -11,6 +11,7 @@ target=fixinc.sh
# Check for special fix rules for particular targets # Check for special fix rules for particular targets
case $machine in case $machine in
@ -20,10 +32,115 @@ diff -Nru ../gcc-8.3.0/fixincludes/mkfixinc.sh gcc-8.3.0-serenity/fixincludes/mk
i?86-*-cygwin* | \ i?86-*-cygwin* | \
i?86-*-mingw32* | \ i?86-*-mingw32* | \
x86_64-*-mingw32* | \ x86_64-*-mingw32* | \
diff -Nru ../gcc-8.3.0/gcc/config/serenity.h gcc-8.3.0-serenity/gcc/config/serenity.h diff --git a/gcc/config.gcc b/gcc/config.gcc
--- ../gcc-8.3.0/gcc/config/serenity.h 1970-01-01 01:00:00.000000000 +0100 index ddd3b8f4d..b3308d4fd 100644
+++ gcc-8.3.0-serenity/gcc/config/serenity.h 2019-04-04 19:56:31.000000000 +0200 --- a/gcc/config.gcc
@@ -0,0 +1,32 @@ +++ b/gcc/config.gcc
@@ -675,6 +675,11 @@ x86_cpus="generic intel"
# Common parts for widely ported systems.
case ${target} in
+*-*-serenity*)
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ ;;
*-*-darwin*)
tmake_file="t-darwin "
tm_file="${tm_file} darwin.h"
@@ -978,6 +983,15 @@ case ${target} in
esac
case ${target} in
+i[34567]86-*-serenity*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h serenity.h"
+ ;;
+x86_64-*-serenity*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h serenity.h"
+ ;;
+arm-*-serenity*)
+ tm_file="dbxelf.h elfos.h arm/elf.h arm/aout.h glibc-stdint.h arm/serenity-elf.h ${tm_file} serenity.h"
+ ;;
aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
diff --git a/gcc/config/arm/serenity-elf.h b/gcc/config/arm/serenity-elf.h
new file mode 100644
index 000000000..24b29c3da
--- /dev/null
+++ b/gcc/config/arm/serenity-elf.h
@@ -0,0 +1,65 @@
+/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
+ Copyright (C) 2002-2018 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Run-time Target Specification. */
+
+/* arm.h defaults to ARM6 CPU. */
+
+/* This defaults us to little-endian. */
+#ifndef TARGET_ENDIAN_DEFAULT
+#define TARGET_ENDIAN_DEFAULT 0
+#endif
+
+#undef MULTILIB_DEFAULTS
+
+/* Default it to use ATPCS with soft-VFP. */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+ (MASK_APCS_FRAME \
+ | TARGET_ENDIAN_DEFAULT)
+
+#undef ARM_DEFAULT_ABI
+#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT -D_PTHREADS}"
+
+#undef SUBTARGET_EXTRA_ASM_SPEC
+#define SUBTARGET_EXTRA_ASM_SPEC \
+ "%{" FPIE_OR_FPIC_SPEC ":-k}"
+
+/* Default to full VFP if -mfloat-abi=hard is specified. */
+#undef SUBTARGET_ASM_FLOAT_SPEC
+#define SUBTARGET_ASM_FLOAT_SPEC \
+ "%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
+
+
+/* Make GCC agree with <machine/ansi.h>. */
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
diff --git a/gcc/config/serenity.h b/gcc/config/serenity.h
new file mode 100644
index 000000000..60ebec583
--- /dev/null
+++ b/gcc/config/serenity.h
@@ -0,0 +1,28 @@
+/* Useful if you wish to make target-specific GCC changes. */ +/* Useful if you wish to make target-specific GCC changes. */
+#undef TARGET_SERENITY +#undef TARGET_SERENITY
+#define TARGET_SERENITY 1 +#define TARGET_SERENITY 1
@ -42,10 +159,6 @@ diff -Nru ../gcc-8.3.0/gcc/config/serenity.h gcc-8.3.0-serenity/gcc/config/seren
+#undef ENDFILE_SPEC +#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s crtn.o%s" +#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+ +
+/* Don't automatically add extern "C" { } around header files. */
+#undef NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C 1
+
+/* Additional predefined macros. */ +/* Additional predefined macros. */
+#undef TARGET_OS_CPP_BUILTINS +#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \ +#define TARGET_OS_CPP_BUILTINS() \
@ -56,38 +169,11 @@ diff -Nru ../gcc-8.3.0/gcc/config/serenity.h gcc-8.3.0-serenity/gcc/config/seren
+ builtin_assert ("system=unix"); \ + builtin_assert ("system=unix"); \
+ builtin_assert ("system=posix"); \ + builtin_assert ("system=posix"); \
+ } while(0); + } while(0);
diff -Nru ../gcc-8.3.0/gcc/config.gcc gcc-8.3.0-serenity/gcc/config.gcc diff --git a/libgcc/config.host b/libgcc/config.host
--- ../gcc-8.3.0/gcc/config.gcc 2019-01-29 16:31:10.000000000 +0100 index 91abc84da..659376d14 100644
+++ gcc-8.3.0-serenity/gcc/config.gcc 2019-04-04 19:52:58.000000000 +0200 --- a/libgcc/config.host
@@ -646,6 +646,11 @@ +++ b/libgcc/config.host
@@ -1414,6 +1414,22 @@ nvptx-*)
# Common parts for widely ported systems.
case ${target} in
+*-*-serenity*)
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ ;;
*-*-darwin*)
tmake_file="t-darwin ${cpu_type}/t-darwin"
tm_file="${tm_file} darwin.h"
@@ -938,6 +943,12 @@
esac
case ${target} in
+i[34567]86-*-serenity*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h serenity.h"
+ ;;
+x86_64-*-serenity*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h serenity.h"
+ ;;
aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
diff -Nru ../gcc-8.3.0/libgcc/config.host gcc-8.3.0-serenity/libgcc/config.host
--- ../gcc-8.3.0/libgcc/config.host 2018-04-06 22:04:17.000000000 +0200
+++ gcc-8.3.0-serenity/libgcc/config.host 2019-04-04 20:31:21.000000000 +0200
@@ -1359,6 +1359,14 @@
tmake_file="$tmake_file nvptx/t-nvptx" tmake_file="$tmake_file nvptx/t-nvptx"
extra_parts="crt0.o" extra_parts="crt0.o"
;; ;;
@ -98,14 +184,23 @@ diff -Nru ../gcc-8.3.0/libgcc/config.host gcc-8.3.0-serenity/libgcc/config.host
+x86_64-*-serenity*) +x86_64-*-serenity*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o" + extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" + tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
+arm-*-serenity*)
+ tmake_file="${tmake_file} t-fixedpoint-gnu-prefix t-crtfm"
+ tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
+ tmake_file="${tmake_file} arm/t-bpabi"
+ tm_file="$tm_file arm/bpabi-lib.h"
+ unwind_header=config/arm/unwind-arm.h
+ extra_parts="$extra_parts crti.o crtn.o"
+ ;; + ;;
*) *)
echo "*** Configuration ${host} not supported" 1>&2 echo "*** Configuration ${host} not supported" 1>&2
exit 1 exit 1
diff -Nru ../gcc-8.3.0/libstdc++-v3/configure gcc-8.3.0-serenity/libstdc++-v3/configure diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
--- ../gcc-8.3.0/libstdc++-v3/configure 2018-08-13 21:15:40.000000000 +0200 index 5acf79cba..bc594989c 100755
+++ gcc-8.3.0-serenity/libstdc++-v3/configure 2019-04-04 20:01:11.000000000 +0200 --- a/libstdc++-v3/configure
@@ -28973,6 +28973,5985 @@ +++ b/libstdc++-v3/configure
@@ -29301,6 +29301,5985 @@ else
# Base decisions on target environment. # Base decisions on target environment.
case "${host}" in case "${host}" in
@ -6091,10 +6186,11 @@ diff -Nru ../gcc-8.3.0/libstdc++-v3/configure gcc-8.3.0-serenity/libstdc++-v3/co
arm*-*-symbianelf*) arm*-*-symbianelf*)
# This is a freestanding configuration; there is nothing to do here. # This is a freestanding configuration; there is nothing to do here.
;; ;;
diff -Nru ../gcc-8.3.0/libstdc++-v3/crossconfig.m4 gcc-8.3.0-serenity/libstdc++-v3/crossconfig.m4 diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
--- ../gcc-8.3.0/libstdc++-v3/crossconfig.m4 2018-07-04 13:45:51.000000000 +0200 index 344eec09d..c71585fb9 100644
+++ gcc-8.3.0-serenity/libstdc++-v3/crossconfig.m4 2019-04-04 19:56:55.000000000 +0200 --- a/libstdc++-v3/crossconfig.m4
@@ -5,6 +5,14 @@ +++ b/libstdc++-v3/crossconfig.m4
@@ -5,6 +5,14 @@ dnl
AC_DEFUN([GLIBCXX_CROSSCONFIG],[ AC_DEFUN([GLIBCXX_CROSSCONFIG],[
# Base decisions on target environment. # Base decisions on target environment.
case "${host}" in case "${host}" in