Skip to content

Commit

Permalink
gcc3: Default to building g++, for bootstrapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
JillTyrell committed Feb 8, 2017
1 parent 00a7be3 commit 7620293
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 6 deletions.
22 changes: 22 additions & 0 deletions KEEP/gcc-346-gperf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- a/gcc/cp/cfns.h
+++ b/gcc/cp/cfns.h
@@ -34,9 +34,6 @@
__inline
#endif
static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
const char * libc_name_p (const char *, unsigned int);
/* maximum key range = 391, duplicates = 0 */

@@ -105,9 +102,6 @@
return hval + asso_values[(unsigned char)str[len - 1]];
}

-#ifdef __GNUC__
-__inline
-#endif
const char *
libc_name_p (register const char *str, register unsigned int len)
{
26 changes: 26 additions & 0 deletions KEEP/gcc-346-no-target-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- gcc-4.5.3/configure
+++ gcc-patched/configure
@@ -3006,6 +3006,21 @@
# Noconfigdirs are removed loudly.
noconfigdirs=""

+# Make sure we don't let target-libiberty be added if we didn't want it.
+if test x$with_target_libiberty = xno ; then
+ noconfigdirs="$noconfigdirs target-libiberty"
+fi
+
+# Make sure we don't let target-zlib be added if we didn't want it.
+if test x$with_target_zlib = xno ; then
+ noconfigdirs="$noconfigdirs target-zlib"
+fi
+
+# Make sure we don't let target-libstdc++ be added if we didn't want it.
+if test x$with_target_libstdcxx = xno ; then
+ noconfigdirs="$noconfigdirs target-libstdc++-v3"
+fi
+
use_gnu_ld=
# Make sure we don't let GNU ld be added if we didn't want it.
if test x$with_gnu_ld = xno ; then


7 changes: 7 additions & 0 deletions pkg/g++346
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mirrors]
http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-g++-3.4.6.tar.bz2

[vars]
filesize=2511332
sha512=cb21aabd6a14618b36c2427cd9c27d57a8db8fe780fb3e8d1f66ffa36c2ee01d4bbdd0856d4959c2a38e319a59364c78badc175296c99b32e0ed51320e5314d3
pkgver=1
42 changes: 36 additions & 6 deletions pkg/gcc3
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,35 @@ filesize=13366790
sha512=06645865a851bfdeca399ed1266f99e072a9bb1d8c6f0d3d6d0f809080ce1e60f45d9e4b52c93cf89f2062a4db0a69f519f23ac5de918bc89bdd794ebd2b96b4
tardir=gcc-3.4.6

[deps]
g++346

[build]
VERSION=3.4.6

(
cd ..
tar xf $C/gcc-g++-$VERSION.tar.bz2
)

patch -p1 < "$K"/gcc-346-unwind2.patch
patch -p1 < "$K"/gcc-346-unlink.patch
patch -p1 < "$K"/gcc-346-libgcc-visibility.patch
patch -p1 < "$K"/gcc-346-gperf.patch
patch -p1 < "$K"/gcc-346-no-target-libs.patch

"$K"/libibertyfix libiberty

#more g++ hackery
#sed -i 's,# include <syscall.h>,#include <sys/syscall.h>,' ./libstdc++-v3/libsupc++/guard.cc

#todo check if this isnt to intrusive
sed -i 's,gcc_no_link=yes,gcc_no_link=no,' ./libstdc++-v3/configure

#and even more g++ hackery
mv ./libstdc\+\+-v3/config/os/gnu-linux ./libstdc\+\+-v3/config/os/gnu-linux.org
cp -r ./libstdc\+\+-v3/config/os/generic ./libstdc\+\+-v3/config/os/gnu-linux
#g++ hackery done

find gcc/config -name linux.h -exec sed -i 's@struct siginfo@siginfo_t@g' "{}" \;

Expand Down Expand Up @@ -38,9 +62,6 @@ sed -i 's@/lib/ld.so.1@/lib/ld-musl-powerpc.so.1@g' gcc/config/rs6000/sysv4.h
sed -i 's@/lib/ld.so.1@/lib/ld-musl-powerpc.so.1@g' gcc/config/rs6000/linux64.h
sed -i 's@/lib64/ld64.so.1@/lib/ld-musl-powerpc64.so.1@g' gcc/config/rs6000/linux64.h


"$K"/libibertyfix libiberty

case "$A" in
arm) echo "error: gcc 3.4.6 does not support EABI!" ; exit 1 ;;
x86_64) archflags=--disable-multilib ;;
Expand Down Expand Up @@ -71,12 +92,16 @@ export gcc_cv_as_hidden=yes
./configure --prefix="$butch_prefix" \
--mandir="$butch_prefix"/share/man \
--infodir="$butch_prefix"/infoXXX \
--disable-bootstrap --disable-shared --disable-nls $archflags
--disable-bootstrap --disable-shared --disable-nls $archflags \
--enable-languages=c,c++ --with-target-libiberty=no --with-target-zlib=no \
--enable-clocale=generic

make \
CFLAGS="-DSTDC_HEADERS -Werror-implicit-function-declaration" \
LDFLAGS="-static" \
LDFLAGS_FOR_TARGET="-static" \
-j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install-gcc
make DESTDIR="$butch_install_dir" install-gcc install-target-libstdc++-v3

dest="$butch_install_dir""$butch_prefix"

Expand All @@ -90,6 +115,11 @@ ln -sf ar "$dest"/bin/gcc-ar
ln -sf ranlib "$dest"/bin/gcc-ranlib
ln -sf nm "$dest"/bin/gcc-nm

[ "$A" = "x86_64" ] && mv "$dest"/lib64/* "$dest"lib/ || true
if [ "$A" = x86_64 ] ; then
mv "$dest"/lib64/* "$dest"/lib/ || true
sed -i 's,/lib/../lib64,/lib,' "$dest"/lib/libstdc++.la
sed -i 's,/lib/../lib64,/lib,' "$dest"/lib/libsupc++.la
fi

ln -sf rawcc "$dest"/bin/gcc-$VERSION
ln -sf g++ "$dest"/bin/g++-$VERSION

0 comments on commit 7620293

Please sign in to comment.