gcc native: remove cross/native.sh and unused patches in cross/pkgs/gcc/patch

Apparently we can use the patches created for the cross compiler.

cross/native.sh has been moved in cross/pkgs/gcc/build.sh to get some
coherence among the packages (in the hope of writing a reasonable
package manager in the future).
This commit is contained in:
Giacomo Tesio 2020-09-01 13:10:12 +02:00
parent 545076c6df
commit 8d419405cb
12 changed files with 0 additions and 419 deletions

View File

@ -1,178 +0,0 @@
#!/bin/bash
echo "Cross compiling GCC and dependencies"
JEHANNE_TOOLCHAIN=$JEHANNE_TOOLCHAIN
CROSS_DIR="$JEHANNE/hacking/cross"
LOG="$JEHANNE_TOOLCHAIN/native.build.log"
export LD_PRELOAD=
OPATH=$PATH
export PATH="$CROSS_DIR/wrappers:$PATH"
function failOnError {
# $1 -> exit status on a previous command
# $2 -> task description
if [ $1 -ne 0 ]; then
echo "ERROR $2"
echo
echo BUILD LOG:
echo
cat $LOG
exit $1
fi
}
date > $LOG
# mock makeinfo (to avoid it as a dependency)
rm -f $JEHANNE/hacking/bin/makeinfo
ln -s `which echo` $JEHANNE/hacking/bin/makeinfo
# verify libtool is installed
libtool --version >> /dev/null
failOnError $? "libtool installation check"
(cd $JEHANNE_TOOLCHAIN/src && fetch) >> $LOG
failOnError $? "fetching sources"
echo -n Building libstdc++-v3... | tee -a $LOG
# libstdc++-v3 is part of GCC but must be built after newlib.
(
export GCC_BUILD_DIR=$JEHANNE_TOOLCHAIN/build/gcc &&
mkdir -p $GCC_BUILD_DIR &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/isl-0.18.tar.bz2 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/isl-0.18 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/isl &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/gmp-6.1.0.tar.bz2 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/gmp-6.1.0 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/gmp &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/mpfr-3.1.4.tar.bz2 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/mpfr-3.1.4 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/mpfr &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/mpc-1.0.3.tar.gz &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/mpc-1.0.3 &&
rm -fr $JEHANNE_TOOLCHAIN/src/gcc/mpc &&
cd $GCC_BUILD_DIR &&
mkdir -p $GCC_BUILD_DIR/x86_64-jehanne/libstdc++-v3 &&
cd $GCC_BUILD_DIR/x86_64-jehanne/libstdc++-v3 &&
rm -f config.cache &&
$JEHANNE_TOOLCHAIN/src/gcc/libstdc++-v3/configure --srcdir=$JEHANNE_TOOLCHAIN/src/gcc/libstdc++-v3 --cache-file=./config.cache --enable-multilib --with-cross-host=x86_64-pc-linux-gnu --prefix=/posix --with-sysroot=/ --with-build-sysroot=$JEHANNE --enable-languages=c,c++,lto --program-transform-name='s&^&x86_64-jehanne-&' --disable-option-checking --with-target-subdir=x86_64-jehanne --build=x86_64-pc-linux-gnu --host=x86_64-jehanne --target=x86_64-jehanne &&
make &&
make DESTDIR=$JEHANNE/pkgs/libstdc++-v3/9.2.0/ install
) >> $LOG 2>&1
failOnError $? "building libstdc++-v3"
echo done.
# Copy to /posix (to emulate bind during cross compilation)
cp -pfr $JEHANNE/pkgs/libstdc++-v3/9.2.0/posix/* $JEHANNE/posix
find $JEHANNE/posix/|grep '\.la$'|xargs rm
echo -n Building libgmp... | tee -a $LOG
(
cd $JEHANNE_TOOLCHAIN/src/libgmp &&
( grep -q jehanne configfsf.sub || patch -p0 < $CROSS_DIR/patch/libgmp.patch ) &&
./configure --host=x86_64-jehanne --disable-shared --prefix=/posix --with-sysroot=$JEHANNE &&
make &&
make DESTDIR=$JEHANNE/pkgs/libgmp/6.1.2/ install &&
libtool --mode=finish $JEHANNE/posix/lib
) >> $LOG 2>&1
failOnError $? "Building libgmp"
echo done.
# Copy to /posix (to emulate bind during cross compilation)
cp -pfr $JEHANNE/pkgs/libgmp/6.1.2/posix/* $JEHANNE/posix
rm $JEHANNE/posix/lib/*.la
echo -n Building libmpfr... | tee -a $LOG
(
cd $JEHANNE_TOOLCHAIN/src/libmpfr &&
( grep -q jehanne config.sub || patch -p0 < $CROSS_DIR/patch/libmpfr.patch ) &&
./configure --host=x86_64-jehanne --disable-shared --prefix=/posix --with-sysroot=$JEHANNE --with-gmp=$JEHANNE/posix/ &&
cp $CROSS_DIR/patch/MakeNothing.in doc/Makefile.in &&
make &&
make DESTDIR=$JEHANNE/pkgs/libmpfr/4.0.1/ install &&
libtool --mode=finish $JEHANNE/posix/lib
) >> $LOG 2>&1
failOnError $? "Building libmpfr"
echo done.
# Copy to /posix (to emulate bind during cross compilation)
cp -pfr $JEHANNE/pkgs/libmpfr/4.0.1/posix/* $JEHANNE/posix
rm $JEHANNE/posix/lib/*.la
echo -n Building libmpc... | tee -a $LOG
(
cd $JEHANNE_TOOLCHAIN/src/libmpc &&
( grep -q jehanne config.sub || ( chmod u+w config.sub &&
patch -p0 < $CROSS_DIR/patch/libmpc.patch &&
chmod u-w config.sub ) ) &&
./configure --host=x86_64-jehanne --disable-shared --prefix=/posix --with-sysroot=$JEHANNE --with-gmp=$JEHANNE/posix/ --with-mpfr=$JEHANNE/posix/ &&
cp $CROSS_DIR/patch/MakeNothing.in doc/Makefile.in &&
make &&
make DESTDIR=$JEHANNE/pkgs/libmpc/1.1.0/ install &&
libtool --mode=finish $JEHANNE/posix/lib
) >> $LOG 2>&1
failOnError $? "Building libmpc"
echo done.
# Copy to /posix (to emulate bind during cross compilation)
cp -pfr $JEHANNE/pkgs/libmpc/1.1.0/posix/* $JEHANNE/posix
rm $JEHANNE/posix/lib/*.la
echo -n Building binutils... | tee -a $LOG
# Patch and build binutils
if [ "$BINUTILS_BUILD_DIR" = "" ]; then
export BINUTILS_BUILD_DIR=$JEHANNE_TOOLCHAIN/build/binutils-native
fi
if [ ! -d $BINUTILS_BUILD_DIR ]; then
mkdir $BINUTILS_BUILD_DIR
fi
(
export LIBS="-L$JEHANNE/posix/lib -L$JEHANNE/arch/amd64/lib -lmpc -lmpfr -lgmp" &&
export CC_FOR_BUILD='CPATH="" LIBS="" gcc' &&
mkdir -p $BINUTILS_BUILD_DIR && cd $BINUTILS_BUILD_DIR &&
$JEHANNE_TOOLCHAIN/src/binutils/configure --host=x86_64-jehanne --with-sysroot=/ --with-build-sysroot=$JEHANNE --prefix=/posix --with-gmp=$JEHANNE/posix/ --with-mpfr=$JEHANNE/posix/ --with-mpc=$JEHANNE/posix/ --enable-interwork --enable-multilib --enable-newlib-long-time_t --disable-nls --disable-werror &&
cp $CROSS_DIR/patch/MakeNothing.in $JEHANNE_TOOLCHAIN/src/binutils/bfd/doc/Makefile.in &&
cp $CROSS_DIR/patch/MakeNothing.in $JEHANNE_TOOLCHAIN/src/binutils/bfd/po/Makefile.in &&
cp $CROSS_DIR/patch/MakeNothing.in $JEHANNE_TOOLCHAIN/src/binutils/gas/doc/Makefile.in &&
cp $CROSS_DIR/patch/MakeNothing.in $JEHANNE_TOOLCHAIN/src/binutils/binutils/doc/Makefile.in &&
make &&
make DESTDIR=$JEHANNE/pkgs/binutils/2.33.1/ install
) >> $LOG 2>&1
failOnError $? "Building binutils"
echo done.
# Copy to /posix (to emulate bind during cross compilation)
cp -pfr $JEHANNE/pkgs/binutils/2.33.1/posix/* $JEHANNE/posix
rm $JEHANNE/posix/lib/*.la
echo -n "Building gcc (and libgcc)..." | tee -a $LOG
(
export GCC_BUILD_DIR=$JEHANNE_TOOLCHAIN/build/gcc-native &&
mkdir -p $GCC_BUILD_DIR &&
cd $GCC_BUILD_DIR &&
$JEHANNE_TOOLCHAIN/src/gcc/configure \
--build=x86_64-pc-linux-gnu --host=x86_64-jehanne --target=x86_64-jehanne \
--enable-languages=c,c++ \
--prefix=/posix --with-sysroot=/ --with-build-sysroot=$JEHANNE \
--without-isl --with-gmp=$JEHANNE/posix --with-mpfr=$JEHANNE/posix --with-mpc=$JEHANNE/posix \
--disable-multiarch --disable-multilib \
--disable-shared --disable-threads --disable-tls \
--disable-libgomp --disable-werror --disable-nls &&
make all-gcc &&
make DESTDIR=$JEHANNE/pkgs/gcc/9.2.0/ install-gcc &&
make all-target-libgcc &&
make DESTDIR=$JEHANNE/pkgs/gcc/9.2.0/ install-target-libgcc
) >> $LOG 2>&1
failOnError $? "building gcc"
cp -pfr $JEHANNE/pkgs/gcc/9.2.0/posix/* $JEHANNE/posix
echo "done."

View File

@ -1,7 +0,0 @@
#ifdef BFD64
x86_64-*-jehanne*)
targ_defvec=x86_64_elf64_vec
targ_selvecs=i386_elf32_vec
want64=true
;;
#endif

View File

@ -1,3 +0,0 @@
i386-*-jehanne*) fmt=elf em=gnu ;;

View File

@ -1,8 +0,0 @@
eelf_i386_jehanne.c: $(srcdir)/emulparams/elf_i386_jehanne.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_jehanne "$(tdir_elf_i386_jehanne)"
eelf_x86_64_jehanne.c: $(srcdir)/emulparams/elf_x86_64_jehanne.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_x86_64_jehanne "$(tdir_elf_x86_64_jehanne)"

View File

@ -1,25 +0,0 @@
diff --git a/src/binutils/ld/configure.tgt b/src/binutils/ld/configure.tgt
index fad8b2e..ba3ddc9 100644
--- a/src/binutils/ld/configure.tgt
+++ b/src/binutils/ld/configure.tgt
@@ -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"
+ ;;
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'
;;
+x86_64-*-jehanne*)
+ NATIVE_LIB_DIRS='/arch/amd64/lib'
+ ;;
+
sparc*-*-solaris2*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;

View File

@ -1,4 +0,0 @@
. ${srcdir}/emulparams/elf_i386.sh
GENERATE_SHLIB_SCRIPT=
GENERATE_PIE_SCRIPT=yes
ENTRY=_main

View File

@ -1,4 +0,0 @@
. ${srcdir}/emulparams/elf_x86_64.sh
GENERATE_SHLIB_SCRIPT=
GENERATE_PIE_SCRIPT=yes
ENTRY=_main

View File

@ -1,71 +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"
;;
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

View File

@ -1,86 +0,0 @@
/*
* This file is part of Jehanne.
*
* Copyright (C) 2016-2019 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/>.
*/
#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"
/* 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"
/* ...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 } \
}
/* Files that are linked before user code.
The %s tells gcc to look for these files in the library directory. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
/* Files that are linked after user code. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
/* Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67132 */
#undef WCHAR_TYPE
#define WCHAR_TYPE "unsigned int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
#undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC "%G %L"
/* Additional predefined macros. */
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define ("__jehanne__"); \
builtin_assert ("system=jehanne"); \
} while(0);

View File

@ -1,11 +0,0 @@
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.
;;

View File

@ -1,11 +0,0 @@
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.
;;

View File

@ -1,11 +0,0 @@
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.
;;