Merge months of work

This commit is contained in:
2020-09-16 01:55:12 +02:00
35 changed files with 800 additions and 419 deletions

View File

@@ -1,3 +1,5 @@
info:
echo "make info does nothing HERE"
all:
echo "make all does nothing HERE"
install:

View File

@@ -1,2 +0,0 @@
#!/bin/sh
echo "2.64" | tr -d '\012'

View File

@@ -1,18 +1,18 @@
diff --git a/src/binutils/ld/configure.tgt b/src/binutils/ld/configure.tgt
index 6b6bbf2..29b5f30 100644
index fad8b2e..ba3ddc9 100644
--- a/src/binutils/ld/configure.tgt
+++ b/src/binutils/ld/configure.tgt
@@ -383,6 +383,9 @@ x86_64-*-nacl*) targ_emul=elf32_x86_64_nacl
targ_extra_libpath=$targ_extra_emuls
@@ -370,6 +370,9 @@ targ_extra_emuls="elf_i386_nacl elf_x86_64_nacl armelf_nacl armelfb_nacl"
targ_extra_libpath=$targ_extra_emuls
tdir_elf_i386_nacl=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
;;
+x86_64*-jehanne*) targ_emul=elf_x86_64_jehanne
+ targ_extra_emuls="elf_i386_jehanne elf_x86_64 elf_i386"
+ ;;
i860-*-coff) targ_emul=coff_i860 ;;
i860-stardent-sysv4* | i860-stardent-elf*)
targ_emul=elf32_i860
@@ -852,6 +855,10 @@ ia64-*-aix*)
ia16-*-elf*) targ_emul=elf_i386 targ_extra_emuls=i386msdos ;;
ia64-*-elf*) targ_emul=elf64_ia64 ;;
ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
@@ -806,6 +809,10 @@ ia64-*-aix*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
;;

89
cross/patch/gcc.patch Normal file
View File

@@ -0,0 +1,89 @@
diff --git a/src/gcc/gcc/config.gcc b/src/gcc/gcc/config.gcc
index ddd3b8f..702aa59 100644
--- a/src/gcc/gcc/config.gcc
+++ b/src/gcc/gcc/config.gcc
@@ -947,6 +947,17 @@ case ${target} in
tmake_file="$tmake_file vms/t-vmsnative"
fi
;;
+*-*-jehanne*)
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ extra_options="$extra_options jehanne.opt"
+ case $target in
+ x86_64-*)
+ native_system_header_dir="/arch/amd64/include"
+ ;;
+ esac
+ ;;
*-*-vxworks*)
tmake_file=t-vxworks
xm_defines=POSIX
@@ -1635,6 +1647,9 @@ i[34567]86-*-elfiamcu)
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
;;
+x86_64-*-jehanne*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h jehanne.h"
+ ;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
;;
diff --git a/src/gcc/config.sub b/src/gcc/config.sub
index 75bb6a3..1905540 100755
--- a/src/gcc/config.sub
+++ b/src/gcc/config.sub
@@ -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*)
+ | jehanne* | midnightbsd* | amdhsa* | unleashed* | emscripten*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
qnx*)
diff --git a/src/gcc/fixincludes/mkfixinc.sh b/src/gcc/fixincludes/mkfixinc.sh
index 0f96486..9f0ee74 100755
--- a/src/gcc/fixincludes/mkfixinc.sh
+++ b/src/gcc/fixincludes/mkfixinc.sh
@@ -14,6 +14,7 @@ case $machine in
i?86-*-cygwin* | \
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
+ *-jehanne* | \
powerpc-*-eabisim* | \
powerpc-*-eabi* | \
powerpc-*-rtems* | \
diff --git a/src/gcc/libgcc/config.host b/src/gcc/libgcc/config.host
index 91abc84..a994e3a 100644
--- a/src/gcc/libgcc/config.host
+++ b/src/gcc/libgcc/config.host
@@ -1414,6 +1414,10 @@ nvptx-*)
tmake_file="$tmake_file nvptx/t-nvptx"
extra_parts="crt0.o"
;;
+x86_64-*-jehanne*)
+ extra_parts="$extra_parts crtbegin.o crtend.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
*)
echo "*** Configuration ${host} not supported" 1>&2
exit 1
diff --git a/src/gcc/libstdc++-v3/crossconfig.m4 b/src/gcc/libstdc++-v3/crossconfig.m4
index 344eec0..cc6eafe 100644
--- a/src/gcc/libstdc++-v3/crossconfig.m4
+++ b/src/gcc/libstdc++-v3/crossconfig.m4
@@ -186,6 +186,12 @@ case "${host}" in
;;
esac
;;
+ *-jehanne*)
+ GLIBCXX_CHECK_COMPILER_FEATURES
+ GLIBCXX_CHECK_LINKER_FEATURES
+ GLIBCXX_CHECK_MATH_SUPPORT
+ GLIBCXX_CHECK_STDLIB_SUPPORT
+ ;;
*-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-cygwin* | *-solaris*)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES

View File

@@ -1,3 +0,0 @@
-jehanne*)
os=-jehanne
;;

View File

@@ -1,71 +0,0 @@
#! /bin/sh
# Download some prerequisites needed by gcc.
# Run this from the top level of the gcc source tree and the gcc
# build will do the right thing.
#
# (C) 2010 Free Software Foundation
#
# This program 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 of the License, or
# (at your option) any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
# If you want to build GCC with the Graphite loop optimizations,
# set GRAPHITE_LOOP_OPT=yes to download optional prerequisties
# ISL Library and CLooG.
GRAPHITE_LOOP_OPT=yes
if [ ! -e gcc/BASE-VER ] ; then
echo "You must run this script in the top level GCC source directory."
exit 1
fi
# Necessary to build GCC.
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
if [ ! -d $MPFR ]; then
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
tar xjf $MPFR.tar.bz2 || exit 1
ln -sf $MPFR mpfr || exit 1
fi
if [ ! -d $GMP ]; then
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
tar xjf $GMP.tar.bz2 || exit 1
ln -sf $GMP gmp || exit 1
fi
if [ ! -d $MPC ]; then
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
tar xzf $MPC.tar.gz || exit 1
ln -sf $MPC mpc || exit 1
fi
# Necessary to build GCC with the Graphite loop optimizations.
if [ "$GRAPHITE_LOOP_OPT" = "yes" ] ; then
ISL=isl-0.12.2
CLOOG=cloog-0.18.1
if [ ! -d $ISL ]; then
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1
tar xjf $ISL.tar.bz2 || exit 1
ln -sf $ISL isl || exit 1
fi
if [ ! -d $CLOOG ]; then
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure/$CLOOG.tar.gz || exit 1
tar xzf $CLOOG.tar.gz || exit 1
ln -sf $CLOOG cloog || exit 1
fi
fi

View File

@@ -1 +0,0 @@
*-jehanne* | \

View File

@@ -1,31 +0,0 @@
diff --git a/src/gcc/gcc/config.gcc b/src/gcc/gcc/config.gcc
index f02ddbd..e5ebfe0 100644
--- a/src/gcc/gcc/config.gcc
+++ b/src/gcc/gcc/config.gcc
@@ -862,6 +862,16 @@ case ${target} in
tmake_file="$tmake_file vms/t-vmsnative"
fi
;;
+*-*-jehanne*)
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ case $target in
+ x86_64-*)
+ native_system_header_dir="/arch/amd64/include"
+ ;;
+ esac
+ ;;
*-*-vxworks*)
tmake_file=t-vxworks
xm_defines=POSIX
@@ -1347,6 +1357,9 @@ x86_64-*-darwin*)
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
;;
+x86_64-*-jehanne*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h jehanne.h"
+ ;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
;;

View File

@@ -1,7 +1,7 @@
/*
* This file is part of Jehanne.
*
* Copyright (C) 2016 Giacomo Tesio <giacomo@tesio.it>
* Copyright (C) 2016-2020 Giacomo Tesio <giacomo@tesio.it>
*
* Jehanne is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,46 +19,144 @@
#undef TARGET_JEHANNE
#define TARGET_JEHANNE 1
/* Default arguments you want when running x86_64-jehanne-gcc */
#undef LIB_SPEC
#define LIB_SPEC "-lc"
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/arch/amd64/lib/"
#undef MD_STARTFILE_PREFIX
#define MD_STARTFILE_PREFIX "/arch/amd64/lib/"
#undef GPLUSPLUS_INCLUDE_DIR
#define GPLUSPLUS_INCLUDE_DIR "/posix/g++"
#undef GCC_INCLUDE_DIR
#define GCC_INCLUDE_DIR "/posix/gcc"
/* In Jehanne, GCC has to be able to build two different kind of programs
* - native, directly repending on Jehanne's development environment
* - posix, based on the mainstream standards
*
* LibPOSIX exists to enable, together with a standard library
* (newlib, so far) the cooperation of these two worlds.
*
* By default, GCC will compile POSIX software looking for standard
* libraries and includes in /posix subfolders.
* However, the new option `-9` will enable the compilation of
* native programs by REMOVING the POSIX stuffs from the various Specs.
*/
/* Architecture specific header (u.h) goes here (from config.gcc) */
#define ARCH_INCLUDE_DIR NATIVE_SYSTEM_HEADER_DIR
/* The default include dir is /sys/include but... */
#define PORTABLE_INCLUDE_DIR "/sys/include"
#define POSIX_INCLUDE_DIR "/posix/include"
/* INCLUDE_DEFAULTS is used by gcc/cppdefault.c
* The struct is defined in gcc/cppdefault.h
*
* struct default_include
* {
* const char *const fname; // The name of the directory.
* const char *const component; // The component containing the directory
* (see update_path in prefix.c)
* const char cplusplus; // Only look here if we're compiling C++.
* const char cxx_aware; // Includes in this directory don't need to
* be wrapped in extern "C" when compiling
* C++.
* const char add_sysroot; // FNAME should be prefixed by
* cpp_SYSROOT.
* const char multilib; // FNAME should have appended
* - the multilib path specified with -imultilib
* when set to 1,
* - the multiarch path specified with
* -imultiarch, when set to 2.
* };
*
* Since C++ assumes a POSIX environment, we include all of the POSIX
* headers but with `cplusplus = 1`, to not mess native C compilation
* that have to react to the `-9` option.
*/
/* C++ : only define values for INCLUDE_DEFAULTS */
#ifdef GPLUSPLUS_INCLUDE_DIR
# define JEHANNE_ID_GPLUSPLUS { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
#else
# define JEHANNE_ID_GPLUSPLUS
#endif
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
# define JEHANNE_ID_GPLUSPLUS_TOOL { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
#else
# define JEHANNE_ID_GPLUSPLUS_TOOL
#endif
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
# define JEHANNE_ID_GPLUSPLUS_BACKWARD { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
#else
# define JEHANNE_ID_GPLUSPLUS_BACKWARD
#endif
/* GCC's private headers. */
#ifdef GCC_INCLUDE_DIR
# define JEHANNE_ID_GCC { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
#else
# define JEHANNE_ID_GCC
#endif
#ifdef PREFIX_INCLUDE_DIR
# define JEHANNE_ID_PREFIX { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
#else
# define JEHANNE_ID_PREFIX
#endif
#if defined (CROSS_INCLUDE_DIR) && defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
# define JEHANNE_ID_CROSS { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
#else
# define JEHANNE_ID_CROSS
#endif
/* Binutils headers. */
#ifdef TOOL_INCLUDE_DIR
# define JEHANNE_ID_TOOL { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
#else
# define JEHANNE_ID_TOOL
#endif
#define JEHANNE_POSIX_INCLUDE_DIR "/posix/include"
#define JEHANNE_ID_POSIX { JEHANNE_POSIX_INCLUDE_DIR, 0, 0, 0, 1, 0 },
#ifdef CROSS_DIRECTORY_STRUCTURE
# define JEHANNE_POSIX_LIB_DIR "%:getenv(JEHANNE /posix/lib)"
#else
# define JEHANNE_POSIX_LIB_DIR "/posix/lib"
#endif
/* ...we have to wrap libc.h and stdio.h with basic POSIX headers */
#define BASIC_POSIX_INCLUDE_DIR "/sys/include/apw"
#undef INCLUDE_DEFAULTS
#define INCLUDE_DEFAULTS \
{ \
{ GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 1, 0 }, \
{ GCC_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ POSIX_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ BASIC_POSIX_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ ARCH_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ PORTABLE_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ ".", 0, 0, 0, 1, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
#define INCLUDE_DEFAULTS \
{ \
JEHANNE_ID_GPLUSPLUS \
JEHANNE_ID_GPLUSPLUS_TOOL \
JEHANNE_ID_GPLUSPLUS_BACKWARD \
JEHANNE_ID_GCC \
JEHANNE_ID_POSIX \
JEHANNE_ID_PREFIX \
JEHANNE_ID_CROSS \
JEHANNE_ID_TOOL \
{ PORTABLE_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ ARCH_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
#undef EXTRA_SPECS
#define EXTRA_SPECS \
{ "posixly_lib", "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}} -lposix" },
/* These Specs reacts `-9` option by removing POSIX stuff */
//#undef CPP_SPEC
//#define CPP_SPEC "%{!9:%(posixly_isystems)}"
/* Since -nostdinc++ doesn't exclude C headers but we have cheated
* marking them as C++ headers, we need to add them back when
* this option is provided
*/
//#undef CPLUSPLUS_CPP_SPEC
//#define CPLUSPLUS_CPP_SPEC "%{nostdinc++:%(posixly_isystems)}"
//#define CPLUSPLUS_CPP_SPEC ""
#undef LINK_SPEC
#define LINK_SPEC "%{!9:-L" JEHANNE_POSIX_LIB_DIR "}"
#undef LIB_SPEC
#define LIB_SPEC "%{!9:%(posixly_lib)} -ljehanne"
#define DRIVER_SELF_SPECS "%{9:-fno-builtin -fno-omit-frame-pointer -fplan9-extensions -fvar-tracking -fvar-tracking-assignments}"
/* Files that are linked before user code.
The %s tells gcc to look for these files in the library directory. */
#undef STARTFILE_SPEC
@@ -67,11 +165,13 @@
/* Files that are linked after user code. */
#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
/* In Jehanne start files will be in /arch/amd64/lib, nearby libjehanne.a
*/
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/arch/amd64/lib/"
/* Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67132 */
#undef WCHAR_TYPE
#define WCHAR_TYPE "unsigned int"

View File

@@ -0,0 +1,25 @@
; Jehanne options.
; This file is part of Jehanne.
;
; Copyright (C) 2016-2020 Giacomo Tesio <giacomo@tesio.it>
;
; Jehanne 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, version 2 of the License.
;
; Jehanne 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.
;
; You should have received a copy of the GNU General Public License
; along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
; Please try to keep this file in ASCII collating order.
9
C Driver RejectNegative
Do not lookup for POSIX includes and libraries in /posix
; This comment is to ensure we retain the blank line above.

View File

@@ -1,4 +0,0 @@
x86_64-*-jehanne*)
extra_parts="$extra_parts crtbegin.o crtend.o"
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
;;

View File

@@ -1,3 +0,0 @@
/enable_execute_stack=enable-execute-stack-empty.c;/,/Configuration ${host} not supported/{
/^case ${host} in$/r ../patch/gcc/libgcc/config.host
}

View File

@@ -1,6 +0,0 @@
*-jehanne*)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
;;

11
cross/patch/libgmp.patch Normal file
View File

@@ -0,0 +1,11 @@
diff -Naru ../orig/configfsf.sub ./configfsf.sub
--- ../orig/configfsf.sub 2018-11-26 11:59:08.897396848 +0100
+++ ./configfsf.sub 2018-11-26 12:20:10.079672849 +0100
@@ -1399,6 +1399,7 @@
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -jehanne* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;

11
cross/patch/libmpc.patch Normal file
View File

@@ -0,0 +1,11 @@
diff -Naru ../orig/config.sub ./config.sub
--- ../orig/config.sub 2018-11-27 00:30:59.807843647 +0100
+++ ./config.sub 2018-11-27 00:32:49.224841688 +0100
@@ -1393,6 +1393,7 @@
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -jehanne* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;

11
cross/patch/libmpfr.patch Normal file
View File

@@ -0,0 +1,11 @@
diff -Naru ../orig/config.sub ./config.sub
--- ../orig/config.sub 2018-11-26 14:23:59.224388851 +0100
+++ ./config.sub 2018-11-26 14:24:55.300412850 +0100
@@ -1416,6 +1416,7 @@
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+ | -jehanne* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
# Remember, each alternative MUST END IN *, to match a version number.
;;