diff options
-rw-r--r-- | Kernel/Makefile | 4 | ||||
-rw-r--r-- | Makefile.common | 2 | ||||
-rwxr-xr-x | Toolchain/BuildIt.sh | 58 | ||||
-rw-r--r-- | Toolchain/Patches/binutils.patch | 174 | ||||
-rw-r--r-- | Toolchain/Patches/gcc.patch | 222 |
5 files changed, 298 insertions, 162 deletions
diff --git a/Kernel/Makefile b/Kernel/Makefile index 987a9a14db..877c37da30 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -109,8 +109,8 @@ OBJS = $(CXX_OBJS) Arch/i386/Boot/boot.ao KERNEL = kernel CXXFLAGS += -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables 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++/8.3.0/i686-pc-serenity/ +CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/ +CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/i686-pc-serenity/ DEFINES += -DKERNEL LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib diff --git a/Makefile.common b/Makefile.common index fddac1b9b9..b75635604e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,6 +1,6 @@ ARCH_FLAGS = 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 OPTIMIZATION_FLAGS = -Os diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh index 964a7d590f..49cb739b01 100755 --- a/Toolchain/BuildIt.sh +++ b/Toolchain/BuildIt.sh @@ -7,7 +7,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo "$DIR" -TARGET=i686-pc-serenity +ARCH=${ARCH:-"i686"} +TARGET="$ARCH-pc-serenity" PREFIX="$DIR/Local" SYSROOT="$DIR/../Root" @@ -15,45 +16,62 @@ echo PREFIX is "$PREFIX" echo SYSROOT is "$SYSROOT" mkdir -p "$DIR/Tarballs" - 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" - md5="$(md5sum binutils-2.32.tar.gz | cut -f1 -d' ')" + md5="$(md5sum $BINUTILS_PKG | cut -f1 -d' ')" echo "bu md5='$md5'" - if [ ! -e "binutils-2.32.tar.gz" ] || [ "$md5" != "d1119c93fc0ed3007be4a84dd186af55" ] ; then - rm -f binutils-2.32.tar.gz - curl -O "http://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.gz" + if [ ! -e $BINUTILS_PKG ] || [ "$md5" != ${BINUTILS_MD5SUM} ] ; then + rm -f $BINUTILS_PKG + wget "$BINUTILS_BASE_URL/$BINUTILS_PKG" else echo "Skipped downloading binutils" fi - md5="$(md5sum gcc-8.3.0.tar.gz | cut -f1 -d' ')" + md5="$(md5sum ${GCC_PKG} | cut -f1 -d' ')" echo "gc md5='$md5'" - if [ ! -e "gcc-8.3.0.tar.gz" ] || [ "$md5" != "9972f8c24c02ebcb5a342c1b30de69ff" ] ; then - rm -f gcc-8.3.0.tar.gz - curl -O "http://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz" + if [ ! -e $GCC_PKG ] || [ "$md5" != ${GCC_MD5SUM} ] ; then + rm -f $GCC_PKG + wget "$GCC_BASE_URL/$GCC_NAME/$GCC_PKG" else echo "Skipped downloading gcc" fi - if [ ! -d "binutils-2.32" ]; then + if [ ! -d ${BINUTILS_NAME} ]; then echo "Extracting binutils..." - tar -xf "binutils-2.32.tar.gz" + tar -xf ${BINUTILS_PKG} - pushd "binutils-2.32" - patch -p1 < "$DIR"/Patches/binutils.patch > /dev/null + pushd ${BINUTILS_NAME} + git init + git add . + git commit -am "BASE" + git apply "$DIR"/Patches/binutils.patch popd else echo "Skipped extracting binutils" fi - if [ ! -d "gcc-8.3.0" ]; then + if [ ! -d $GCC_NAME ]; then echo "Extracting gcc..." - tar -xf "gcc-8.3.0.tar.gz" + tar -xf $GCC_PKG - pushd "gcc-8.3.0" - patch -p1 < "$DIR"/Patches/gcc.patch > /dev/null + pushd $GCC_NAME + git init + git add . + git commit -am "BASE" + git apply "$DIR"/Patches/gcc.patch popd else echo "Skipped extracting gcc" @@ -73,7 +91,7 @@ pushd "$DIR/Build/" unset PKG_CONFIG_LIBDIR # Just in case pushd binutils - "$DIR"/Tarballs/binutils-2.32/configure --prefix="$PREFIX" \ + "$DIR"/Tarballs/binutils-2.33.1/configure --prefix="$PREFIX" \ --target="$TARGET" \ --with-sysroot="$SYSROOT" \ --disable-nls || exit 1 @@ -82,7 +100,7 @@ pushd "$DIR/Build/" popd pushd gcc - "$DIR"/Tarballs/gcc-8.3.0/configure --prefix="$PREFIX" \ + "$DIR"/Tarballs/gcc-9.2.0/configure --prefix="$PREFIX" \ --target="$TARGET" \ --with-sysroot="$SYSROOT" \ --disable-nls \ diff --git a/Toolchain/Patches/binutils.patch b/Toolchain/Patches/binutils.patch index 7454911fe1..243d04aaf9 100644 --- a/Toolchain/Patches/binutils.patch +++ b/Toolchain/Patches/binutils.patch @@ -1,10 +1,11 @@ -diff -Nru ../binutils-2.32/bfd/config.bfd binutils-2.32-serenity/bfd/config.bfd ---- ../binutils-2.32/bfd/config.bfd 2019-01-19 17:01:32.000000000 +0100 -+++ binutils-2.32-serenity/bfd/config.bfd 2019-04-04 17:41:07.000000000 +0200 -@@ -223,6 +223,20 @@ - ;; - +diff --git a/bfd/config.bfd b/bfd/config.bfd +index 13d678e1..782ad689 100644 +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -220,6 +220,26 @@ esac + case "${targ}" in # START OF targmatch.h + #ifdef BFD64 + + i[3-7]86-*-serenity*) + targ_defvec=i386_elf32_vec @@ -18,14 +19,21 @@ diff -Nru ../binutils-2.32/bfd/config.bfd binutils-2.32-serenity/bfd/config.bfd + want64=true + ;; +#endif -+ - #ifdef BFD64 ++ ++ arm-*-serenity*) ++ targ_defvec=arm_elf32_le_vec ++ targ_selvecs= ++ targ64_selvecs= ++ ;; ++ aarch64-*-darwin*) targ_defvec=aarch64_mach_o_vec -diff -Nru ../binutils-2.32/config.sub binutils-2.32-serenity/config.sub ---- ../binutils-2.32/config.sub 2019-01-19 17:01:33.000000000 +0100 -+++ binutils-2.32-serenity/config.sub 2019-04-04 17:39:29.000000000 +0200 -@@ -1337,6 +1337,7 @@ + targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec" +diff --git a/config.sub b/config.sub +index 5b158ac4..49f05c37 100755 +--- a/config.sub ++++ b/config.sub +@@ -1342,6 +1342,7 @@ case $os in # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. 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]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ -diff -Nru ../binutils-2.32/gas/configure.tgt binutils-2.32-serenity/gas/configure.tgt ---- ../binutils-2.32/gas/configure.tgt 2019-01-19 17:01:33.000000000 +0100 -+++ binutils-2.32-serenity/gas/configure.tgt 2019-04-04 17:41:40.000000000 +0200 -@@ -121,6 +121,7 @@ +diff --git a/gas/configure.tgt b/gas/configure.tgt +index a4828c4c..4d75ca56 100644 +--- a/gas/configure.tgt ++++ b/gas/configure.tgt +@@ -121,6 +121,8 @@ esac generic_target=${cpu_type}-$vendor-$os # Note: This table is alpha-sorted, please try to keep it that way. case ${generic_target} in + i386-*-serenity*) fmt=elf;; ++ arm-*-serenity*) fmt=elf;; aarch64*-*-elf*) fmt=elf;; aarch64*-*-fuchsia*) fmt=elf;; aarch64*-*-linux*) fmt=elf em=linux -diff -Nru ../binutils-2.32/ld/Makefile.am binutils-2.32-serenity/ld/Makefile.am ---- ../binutils-2.32/ld/Makefile.am 2019-01-19 17:01:33.000000000 +0100 -+++ binutils-2.32-serenity/ld/Makefile.am 2019-04-04 17:50:13.000000000 +0200 -@@ -1289,6 +1289,10 @@ - eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ - $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - -+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \ -+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} -+ ${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)" -+ - eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \ - $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - -@@ -1849,6 +1853,10 @@ - eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \ - $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - -+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \ -+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} -+ ${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/Makefile.in binutils-2.32-serenity/ld/Makefile.in ---- ../binutils-2.32/ld/Makefile.in 2019-02-02 16:54:43.000000000 +0100 -+++ binutils-2.32-serenity/ld/Makefile.in 2019-04-04 17:50:55.000000000 +0200 -@@ -2893,6 +2893,10 @@ - eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ - $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - -+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \ -+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} -+ ${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)" -+ - eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \ - $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - -@@ -3453,6 +3457,10 @@ - eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \ - $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - -+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \ -+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} -+ ${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 @@ +diff --git a/ld/Makefile.am b/ld/Makefile.am +index 0509c2e5..b1adc7c6 100644 +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -178,6 +178,7 @@ ALL_EMULATION_SOURCES = \ + earmelf_nbsd.c \ + earmelf_phoenix.c \ + earmelf_vxworks.c \ ++ earmelf_serenity.c \ + earmelfb.c \ + earmelfb_fbsd.c \ + earmelfb_fuchsia.c \ +diff --git a/ld/Makefile.in b/ld/Makefile.in +index 9898392a..9357b539 100644 +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -665,6 +665,7 @@ ALL_EMULATION_SOURCES = \ + earmelf_nbsd.c \ + earmelf_phoenix.c \ + earmelf_vxworks.c \ ++ earmelf_serenity.c \ + earmelfb.c \ + earmelfb_fbsd.c \ + earmelfb_fuchsia.c \ +@@ -779,6 +780,7 @@ ALL_EMULATION_SOURCES = \ + eelf_i386_vxworks.c \ + eelf_iamcu.c \ + eelf_s390.c \ ++ eelf_i386_serenity.c \ + eh8300elf.c \ + eh8300elf_linux.c \ + eh8300helf.c \ +@@ -945,6 +947,7 @@ ALL_64_EMULATION_SOURCES = \ + eelf_x86_64_fbsd.c \ + eelf_x86_64_nacl.c \ + eelf_x86_64_sol2.c \ ++ eelf_x86_64_serenity.c \ + ehppa64linux.c \ + ei386pep.c \ + emmo.c +diff --git a/ld/configure.tgt b/ld/configure.tgt +index c81bc8a7..a93a04c6 100644 +--- a/ld/configure.tgt ++++ b/ld/configure.tgt +@@ -45,6 +45,19 @@ targ64_extra_libpath= # architecture variants should be kept together even if their names # break the alpha sorting. case "${targ}" in @@ -110,18 +111,39 @@ diff -Nru ../binutils-2.32/ld/configure.tgt binutils-2.32-serenity/ld/configure. + targ_emul=elf_x86_64_serenity + 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 targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;; 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 ---- ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh 1970-01-01 01:00:00.000000000 +0100 -+++ binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh 2019-04-04 17:43:12.000000000 +0200 +diff --git a/ld/emulparams/armelf_serenity.sh b/ld/emulparams/armelf_serenity.sh +new file mode 100644 +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 @@ +. ${srcdir}/emulparams/elf_i386.sh +GENERATE_SHLIB_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 ---- ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh 1970-01-01 01:00:00.000000000 +0100 -+++ binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh 2019-04-04 17:43:34.000000000 +0200 +diff --git a/ld/emulparams/elf_x86_64_serenity.sh b/ld/emulparams/elf_x86_64_serenity.sh +new file mode 100644 +index 00000000..a2af90a6 +--- /dev/null ++++ b/ld/emulparams/elf_x86_64_serenity.sh @@ -0,0 +1 @@ +. ${srcdir}/emulparams/elf_x86_64.sh diff --git a/Toolchain/Patches/gcc.patch b/Toolchain/Patches/gcc.patch index 61c7aab25c..d460f533ab 100644 --- a/Toolchain/Patches/gcc.patch +++ b/Toolchain/Patches/gcc.patch @@ -1,18 +1,30 @@ -diff -Nru ../gcc-8.3.0/config.sub gcc-8.3.0-serenity/config.sub ---- ../gcc-8.3.0/config.sub 2018-01-03 05:25:18.000000000 +0100 -+++ gcc-8.3.0-serenity/config.sub 2019-04-04 19:51:43.000000000 +0200 -@@ -1391,6 +1391,7 @@ - # Each alternative MUST end in a * to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -+ | -serenity* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ -diff -Nru ../gcc-8.3.0/fixincludes/mkfixinc.sh gcc-8.3.0-serenity/fixincludes/mkfixinc.sh ---- ../gcc-8.3.0/fixincludes/mkfixinc.sh 2016-06-21 23:57:20.000000000 +0200 -+++ gcc-8.3.0-serenity/fixincludes/mkfixinc.sh 2019-04-04 19:58:19.000000000 +0200 -@@ -11,6 +11,7 @@ +diff --git a/config.sub b/config.sub +index 75bb6a313..da281fb48 100755 +--- a/config.sub ++++ b/config.sub +@@ -2,7 +2,7 @@ + # Configuration validation subroutine script. + # Copyright 1992-2019 Free Software Foundation, Inc. + +-timestamp='2019-01-01' ++timestamp='2019-12-17' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -1363,7 +1363,7 @@ case $os in + | 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 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-*-mingw32* | \ x86_64-*-mingw32* | \ -diff -Nru ../gcc-8.3.0/gcc/config/serenity.h gcc-8.3.0-serenity/gcc/config/serenity.h ---- ../gcc-8.3.0/gcc/config/serenity.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-8.3.0-serenity/gcc/config/serenity.h 2019-04-04 19:56:31.000000000 +0200 -@@ -0,0 +1,32 @@ +diff --git a/gcc/config.gcc b/gcc/config.gcc +index ddd3b8f4d..b3308d4fd 100644 +--- a/gcc/config.gcc ++++ 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. */ +#undef TARGET_SERENITY +#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 +#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. */ +#undef 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=posix"); \ + } while(0); -diff -Nru ../gcc-8.3.0/gcc/config.gcc gcc-8.3.0-serenity/gcc/config.gcc ---- ../gcc-8.3.0/gcc/config.gcc 2019-01-29 16:31:10.000000000 +0100 -+++ gcc-8.3.0-serenity/gcc/config.gcc 2019-04-04 19:52:58.000000000 +0200 -@@ -646,6 +646,11 @@ - - # 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 @@ +diff --git a/libgcc/config.host b/libgcc/config.host +index 91abc84da..659376d14 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -1414,6 +1414,22 @@ nvptx-*) tmake_file="$tmake_file nvptx/t-nvptx" extra_parts="crt0.o" ;; @@ -99,13 +185,22 @@ diff -Nru ../gcc-8.3.0/libgcc/config.host gcc-8.3.0-serenity/libgcc/config.host + 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" + ;; ++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 exit 1 -diff -Nru ../gcc-8.3.0/libstdc++-v3/configure gcc-8.3.0-serenity/libstdc++-v3/configure ---- ../gcc-8.3.0/libstdc++-v3/configure 2018-08-13 21:15:40.000000000 +0200 -+++ gcc-8.3.0-serenity/libstdc++-v3/configure 2019-04-04 20:01:11.000000000 +0200 -@@ -28973,6 +28973,5985 @@ +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 5acf79cba..bc594989c 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -29301,6 +29301,5985 @@ else # Base decisions on target environment. 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*) # 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 ---- ../gcc-8.3.0/libstdc++-v3/crossconfig.m4 2018-07-04 13:45:51.000000000 +0200 -+++ gcc-8.3.0-serenity/libstdc++-v3/crossconfig.m4 2019-04-04 19:56:55.000000000 +0200 -@@ -5,6 +5,14 @@ +diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 +index 344eec09d..c71585fb9 100644 +--- a/libstdc++-v3/crossconfig.m4 ++++ b/libstdc++-v3/crossconfig.m4 +@@ -5,6 +5,14 @@ dnl AC_DEFUN([GLIBCXX_CROSSCONFIG],[ # Base decisions on target environment. case "${host}" in |