summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Jones <cretin@gentoo.org>2002-12-31 18:25:28 +0000
committerStefan Jones <cretin@gentoo.org>2002-12-31 18:25:28 +0000
commit4f81944cb2bb057d0b6694bb33935fb8cd7d47d9 (patch)
tree77945d40834c4d7ae0fc7316946aad225c36065d /sys-devel/kgcc
parentfixed sandbox violation with snmp. (diff)
downloadhistorical-4f81944cb2bb057d0b6694bb33935fb8cd7d47d9.tar.gz
historical-4f81944cb2bb057d0b6694bb33935fb8cd7d47d9.tar.bz2
historical-4f81944cb2bb057d0b6694bb33935fb8cd7d47d9.zip
an old C-compiler needed to compile sparc kernels
Diffstat (limited to 'sys-devel/kgcc')
-rw-r--r--sys-devel/kgcc/ChangeLog10
-rw-r--r--sys-devel/kgcc/files/digest-kgcc-2.95.31
-rw-r--r--sys-devel/kgcc/files/kgcc-2.95.3-new-atexit.diff397
-rw-r--r--sys-devel/kgcc/kgcc-2.95.3.ebuild113
4 files changed, 521 insertions, 0 deletions
diff --git a/sys-devel/kgcc/ChangeLog b/sys-devel/kgcc/ChangeLog
new file mode 100644
index 000000000000..319cbe1fad94
--- /dev/null
+++ b/sys-devel/kgcc/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for sys-devel/kgcc
+# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/kgcc/ChangeLog,v 1.1 2002/12/31 18:25:28 cretin Exp $
+
+*kgcc-2.95.3 (31 Dec 2002)
+
+ 31 Dec 2002; Stefan Jones <Cretin@gentoo.org> :
+ Installs a gcc-2.95.3 C-compiler only, named kgcc, used to compile sparc
+ 32bit kernels.
+
diff --git a/sys-devel/kgcc/files/digest-kgcc-2.95.3 b/sys-devel/kgcc/files/digest-kgcc-2.95.3
new file mode 100644
index 000000000000..fbd54ce087d9
--- /dev/null
+++ b/sys-devel/kgcc/files/digest-kgcc-2.95.3
@@ -0,0 +1 @@
+MD5 56dc4de966a54e4c511f65e525f9c0fe gcc-core-2.95.3.tar.bz2 6798053
diff --git a/sys-devel/kgcc/files/kgcc-2.95.3-new-atexit.diff b/sys-devel/kgcc/files/kgcc-2.95.3-new-atexit.diff
new file mode 100644
index 000000000000..af4de7908197
--- /dev/null
+++ b/sys-devel/kgcc/files/kgcc-2.95.3-new-atexit.diff
@@ -0,0 +1,397 @@
+--- gcc-2.95.3-orig/gcc/c-common.c Tue Sep 7 03:11:16 1999
++++ gcc-2.95.3/gcc/c-common.c Tue Aug 14 11:15:53 2001
+@@ -697,7 +697,23 @@
+ if (exact_log2 (align) == -1)
+ error ("requested alignment is not a power of 2");
+ else if (is_type)
+- TYPE_ALIGN (type) = align;
++ {
++ /* If we have a TYPE_DECL, then copy the type, so that we
++ don't accidentally modify a builtin type. See pushdecl. */
++ if (decl && TREE_TYPE (decl) != error_mark_node
++ && DECL_ORIGINAL_TYPE (decl) == NULL_TREE)
++ {
++ tree tt = TREE_TYPE (decl);
++ DECL_ORIGINAL_TYPE (decl) = tt;
++ tt = build_type_copy (tt);
++ TYPE_NAME (tt) = decl;
++ TREE_USED (tt) = TREE_USED (decl);
++ TREE_TYPE (decl) = tt;
++ type = tt;
++ }
++
++ TYPE_ALIGN (type) = align;
++ }
+ else if (TREE_CODE (decl) != VAR_DECL
+ && TREE_CODE (decl) != FIELD_DECL)
+ error_with_decl (decl,
+--- gcc-2.95.3-orig/gcc/config/alpha/crtbegin.asm Wed Dec 16 15:00:53 1998
++++ gcc-2.95.3/gcc/config/alpha/crtbegin.asm Tue Aug 14 11:15:53 2001
+@@ -97,6 +97,31 @@
+ # Support recursive calls to exit.
+ $ptr: .quad __DTOR_LIST__
+
++/* A globally unique widget for c++ local destructors to hang off.
++
++ This has a unique value in every dso; in the main program its
++ value is zero. The object should be protected. This means the
++ instance in any dso or the main program is not used in any other
++ dso. The dynamic linker takes care of this. */
++
++ .global __dso_handle
++ .type __dso_handle,@object
++ .size __dso_handle,8
++#ifdef SHARED
++.section .data
++ .align 3
++__dso_handle:
++ .quad __dso_handle
++#else
++.section .bss
++ .align 3
++__dso_handle:
++ .zero 8
++#endif
++#ifdef HAVE_GAS_HIDDEN
++ .hidden __dso_handle
++#endif
++
+ .text
+
+ .align 3
+--- gcc-2.95.3-orig/gcc/config/i386/i386.c Tue Sep 7 02:38:56 1999
++++ gcc-2.95.3/gcc/config/i386/i386.c Tue Aug 14 11:17:15 2001
+@@ -291,7 +291,7 @@
+
+ if (ix86_arch_string == 0)
+ {
+- ix86_arch_string = PROCESSOR_PENTIUM_STRING;
++ ix86_arch_string = PROCESSOR_DEFAULT_STRING;
+ if (ix86_cpu_string == 0)
+ ix86_cpu_string = PROCESSOR_DEFAULT_STRING;
+ }
+@@ -308,7 +308,7 @@
+ if (i == ptt_size)
+ {
+ error ("bad value (%s) for -march= switch", ix86_arch_string);
+- ix86_arch_string = PROCESSOR_PENTIUM_STRING;
++ ix86_arch_string = PROCESSOR_DEFAULT_STRING;
+ ix86_arch = PROCESSOR_DEFAULT;
+ }
+
+--- gcc-2.95.3-orig/gcc/config/i386/linux.h Wed Apr 7 19:32:13 1999
++++ gcc-2.95.3/gcc/config/i386/linux.h Tue Aug 14 11:15:53 2001
+@@ -234,3 +234,21 @@
+ } \
+ } while (0)
+ #endif
++
++#if defined(__PIC__) && defined (USE_GNULIBC_1)
++/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
++ __environ and atexit (). We have to make sure they are in the .dynsym
++ section. We accomplish it by making a dummy call here. This
++ code is never reached. */
++
++#define CRT_END_INIT_DUMMY \
++ do \
++ { \
++ extern void *___brk_addr; \
++ extern char **__environ; \
++ \
++ ___brk_addr = __environ; \
++ atexit (0); \
++ } \
++ while (0)
++#endif
+--- gcc-2.95.3-orig/gcc/config/rs6000/rs6000.md Thu Jan 25 08:03:35 2001
++++ gcc-2.95.3/gcc/config/rs6000/rs6000.md Tue Aug 14 11:15:53 2001
+@@ -6184,7 +6184,9 @@
+ reg. So expand it. */
+ if (GET_CODE (operands[0]) == SUBREG
+ && GET_CODE (SUBREG_REG (operands[0])) == REG
+- && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
++ && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER
++ && (! REG_FUNCTION_VALUE_P (SUBREG_REG (operands[0]))
++ || ! rtx_equal_function_value_matters))
+ operands[0] = alter_subreg (operands[0]);
+ if (GET_CODE (operands[1]) == SUBREG
+ && GET_CODE (SUBREG_REG (operands[1])) == REG
+--- gcc-2.95.3-orig/gcc/crtstuff.c Mon Mar 22 18:43:51 1999
++++ gcc-2.95.3/gcc/crtstuff.c Tue Aug 14 11:15:53 2001
+@@ -55,6 +55,7 @@
+ #include "defaults.h"
+ #include <stddef.h>
+ #include "frame.h"
++#include "auto-host.h"
+
+ /* We do not want to add the weak attribute to the declarations of these
+ routines in frame.h because that will cause the definition of these
+@@ -134,6 +135,29 @@
+ #ifdef INIT_SECTION_ASM_OP
+
+ #ifdef OBJECT_FORMAT_ELF
++/* Declare the __dso_handle variable. It should have a unique value
++ in every shared-object; in a main program its value is zero. The
++ object should in any case be protected. This means the instance
++ in one DSO or the main program is not used in another object. The
++ dynamic linker takes care of this. */
++
++/* XXX Ideally the following should be implemented using
++ __attribute__ ((__visibility__ ("hidden")))
++ but the __attribute__ support is not yet there. */
++#define HAVE_GAS_HIDDEN 1
++#ifdef HAVE_GAS_HIDDEN
++asm (".hidden\t__dso_handle");
++#endif
++
++#ifdef CRTSTUFFS_O
++void *__dso_handle = &__dso_handle;
++#else
++void *__dso_handle = 0;
++#endif
++
++/* The __cxa_finalize function may not be available so we use only a
++ weak declaration. */
++extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;
+
+ /* Run all the global destructors on exit from the program. */
+
+@@ -165,6 +189,11 @@
+ if (completed)
+ return;
+
++#ifdef CRTSTUFFS_O
++ if (__cxa_finalize)
++ __cxa_finalize (__dso_handle);
++#endif
++
+ while (*p)
+ {
+ p++;
+@@ -379,20 +408,8 @@
+ FORCE_INIT_SECTION_ALIGN;
+ #endif
+ asm (TEXT_SECTION_ASM_OP);
+-
+-/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
+- __environ and atexit (). We have to make sure they are in the .dynsym
+- section. We accomplish it by making a dummy call here. This
+- code is never reached. */
+-
+-#if defined(__linux__) && defined(__PIC__) && defined(__i386__)
+- {
+- extern void *___brk_addr;
+- extern char **__environ;
+-
+- ___brk_addr = __environ;
+- atexit ();
+- }
++#ifdef CRT_END_INIT_DUMMY
++ CRT_END_INIT_DUMMY;
+ #endif
+ }
+
+--- gcc-2.95.3-orig/gcc/cse.c Thu Jan 25 08:03:03 2001
++++ gcc-2.95.3/gcc/cse.c Tue Aug 14 11:15:53 2001
+@@ -695,8 +695,6 @@
+ static struct cse_reg_info* get_cse_reg_info PROTO((int));
+ static void free_cse_reg_info PROTO((splay_tree_value));
+ static void flush_hash_table PROTO((void));
+-
+-extern int rtx_equal_function_value_matters;
+
+ /* Dump the expressions in the equivalence class indicated by CLASSP.
+ This function is used only for debugging. */
+--- gcc-2.95.3-orig/gcc/function.c Thu Jan 25 08:03:15 2001
++++ gcc-2.95.3/gcc/function.c Tue Aug 14 11:15:53 2001
+@@ -5292,7 +5292,18 @@
+ - offset_ptr->constant);
+ }
+ #else /* !ARGS_GROW_DOWNWARD */
+- pad_to_arg_alignment (initial_offset_ptr, boundary);
++ if (!in_regs
++#ifdef REG_PARM_STACK_SPACE
++ || REG_PARM_STACK_SPACE (fndecl) > 0
++#else
++ /* For the gcc-2_95-branch we want to make sure not to break something
++ on platforms which pass argument in registers but don't define
++ REG_PARM_STACK_SPACE. So we force the original behaviour here. */
++ || 1
++#endif
++ )
++ pad_to_arg_alignment (initial_offset_ptr, boundary);
++
+ *offset_ptr = *initial_offset_ptr;
+
+ #ifdef PUSH_ROUNDING
+--- gcc-2.95.3-orig/gcc/rtl.h Thu Jan 25 08:03:22 2001
++++ gcc-2.95.3/gcc/rtl.h Tue Aug 14 11:16:20 2001
+@@ -168,7 +168,8 @@
+ either changing how we compute the frame address or saving and
+ restoring registers in the prologue and epilogue.
+ 1 in a MEM if the MEM refers to a scalar, rather than a member of
+- an aggregate. */
++ an aggregate.
++ 1 in a SYMBOL_REF if the symbol is weak. */
+ unsigned frame_related : 1;
+ /* The first element of the operands of this rtx.
+ The number of operands and their types are controlled
+@@ -661,6 +662,9 @@
+ /* 1 means a SYMBOL_REF has been the library function in emit_library_call. */
+ #define SYMBOL_REF_USED(RTX) ((RTX)->used)
+
++/* 1 means a SYMBOL_REF is weak. */
++#define SYMBOL_REF_WEAK(RTX) ((RTX)->frame_related)
++
+ /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
+ of the function that is not involved in copying parameters to
+ pseudo-registers. FIRST_PARM_INSN is the very first insn of
+@@ -888,6 +892,12 @@
+ /* For a NOTE_INSN_LIVE note, the original basic block number. */
+ #define RANGE_LIVE_ORIG_BLOCK(INSN) (XINT (INSN, 1))
+
++/* Nonzero if we need to distinguish between the return value of this function
++ and the return value of a function called by this function. This helps
++ integrate.c.
++ This is 1 until after the rtl generation pass. */
++extern int rtx_equal_function_value_matters;
++
+ /* Generally useful functions. */
+
+ /* The following functions accept a wide integer argument. Rather than
+--- gcc-2.95.3-orig/gcc/rtlanal.c Thu Jan 25 08:03:22 2001
++++ gcc-2.95.3/gcc/rtlanal.c Tue Aug 14 11:16:20 2001
+@@ -136,11 +136,9 @@
+ switch (code)
+ {
+ case SYMBOL_REF:
++ return SYMBOL_REF_WEAK (x);
++
+ case LABEL_REF:
+- /* SYMBOL_REF is problematic due to the possible presence of
+- a #pragma weak, but to say that loads from symbols can trap is
+- *very* costly. It's not at all clear what's best here. For
+- now, we ignore the impact of #pragma weak. */
+ return 0;
+
+ case REG:
+--- gcc-2.95.3-orig/gcc/stor-layout.c Thu Mar 11 07:56:20 1999
++++ gcc-2.95.3/gcc/stor-layout.c Tue Aug 14 11:15:53 2001
+@@ -264,8 +264,8 @@
+ if (spec_size == 0 && DECL_NAME (decl) != 0)
+ abort ();
+
+- /* Size is specified number of bits. */
+- DECL_SIZE (decl) = size_int (spec_size);
++ /* Size is specified in number of bits. */
++ DECL_SIZE (decl) = bitsize_int (spec_size, 0);
+ }
+ /* Force alignment required for the data type.
+ But if the decl itself wants greater alignment, don't override that.
+@@ -301,7 +301,7 @@
+ DECL_ALIGN (decl) = MAX ((unsigned) GET_MODE_ALIGNMENT (xmode),
+ DECL_ALIGN (decl));
+ DECL_MODE (decl) = xmode;
+- DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode));
++ DECL_SIZE (decl) = bitsize_int (GET_MODE_BITSIZE (xmode), 0);
+ /* This no longer needs to be accessed as a bit field. */
+ DECL_BIT_FIELD (decl) = 0;
+ }
+@@ -520,7 +520,7 @@
+ DECL_FIELD_BITPOS (field) = var_size;
+ else
+ {
+- DECL_FIELD_BITPOS (field) = size_int (const_size);
++ DECL_FIELD_BITPOS (field) = bitsize_int (const_size, 0L);
+
+ /* If this field ended up more aligned than we thought it
+ would be (we approximate this by seeing if its position
+@@ -562,7 +562,7 @@
+
+ if (var_size == 0)
+ {
+- TYPE_SIZE (rec) = size_int (const_size);
++ TYPE_SIZE (rec) = bitsize_int (const_size, 0L);
+ }
+ else
+ {
+@@ -610,7 +610,7 @@
+ /* The size of the union, based on the fields scanned so far,
+ is max (CONST_SIZE, VAR_SIZE).
+ VAR_SIZE may be null; then CONST_SIZE by itself is the size. */
+- register int const_size = 0;
++ register HOST_WIDE_INT const_size = 0;
+ register tree var_size = 0;
+
+ #ifdef STRUCTURE_SIZE_BOUNDARY
+@@ -627,6 +627,8 @@
+
+ for (field = TYPE_FIELDS (rec); field; field = TREE_CHAIN (field))
+ {
++ tree dsize;
++
+ /* Enums which are local to this class need not be laid out. */
+ if (TREE_CODE (field) == CONST_DECL || TREE_CODE (field) == TYPE_DECL)
+ continue;
+@@ -645,19 +647,22 @@
+ union_align = MAX (union_align, TYPE_ALIGN (TREE_TYPE (field)));
+ #endif
+
++ dsize = DECL_SIZE (field);
+ if (TREE_CODE (rec) == UNION_TYPE)
+ {
+ /* Set union_size to max (decl_size, union_size).
+ There are more and less general ways to do this.
+ Use only CONST_SIZE unless forced to use VAR_SIZE. */
+
+- if (TREE_CODE (DECL_SIZE (field)) == INTEGER_CST)
++ if (TREE_CODE (dsize) == INTEGER_CST
++ && ! TREE_CONSTANT_OVERFLOW (dsize)
++ && TREE_INT_CST_HIGH (dsize) == 0)
+ const_size
+- = MAX (const_size, TREE_INT_CST_LOW (DECL_SIZE (field)));
++ = MAX (const_size, TREE_INT_CST_LOW (dsize));
+ else if (var_size == 0)
+- var_size = DECL_SIZE (field);
++ var_size = dsize;
+ else
+- var_size = size_binop (MAX_EXPR, var_size, DECL_SIZE (field));
++ var_size = size_binop (MAX_EXPR, var_size, dsize);
+ }
+ else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
+ var_size = fold (build (COND_EXPR, sizetype, DECL_QUALIFIER (field),
+--- gcc-2.95.3-orig/gcc/toplev.c Thu Jan 25 08:03:23 2001
++++ gcc-2.95.3/gcc/toplev.c Tue Aug 14 11:15:53 2001
+@@ -137,8 +137,6 @@
+ #define DIR_SEPARATOR '/'
+ #endif
+
+-extern int rtx_equal_function_value_matters;
+-
+ #if ! (defined (VMS) || defined (OS2))
+ extern char **environ;
+ #endif
+--- gcc-2.95.3-orig/gcc/varasm.c Mon Feb 19 08:02:02 2001
++++ gcc-2.95.3/gcc/varasm.c Tue Aug 14 11:16:20 2001
+@@ -723,6 +723,8 @@
+ Also handle vars declared register invalidly. */
+ if (DECL_RTL (decl) == 0)
+ {
++ rtx x;
++
+ /* Can't use just the variable's own name for a variable
+ whose scope is less than the whole file.
+ Concatenate a distinguishing number. */
+@@ -752,8 +754,10 @@
+ new_name, strlen (new_name));
+ }
+
+- DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
+- gen_rtx_SYMBOL_REF (Pmode, name));
++ x = gen_rtx_SYMBOL_REF (Pmode, name);
++ SYMBOL_REF_WEAK (x) = DECL_WEAK (decl);
++ DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), x);
++
+ MEM_ALIAS_SET (DECL_RTL (decl)) = get_alias_set (decl);
+
+ /* If this variable is to be treated as volatile, show its
diff --git a/sys-devel/kgcc/kgcc-2.95.3.ebuild b/sys-devel/kgcc/kgcc-2.95.3.ebuild
new file mode 100644
index 000000000000..eb5709b3d94c
--- /dev/null
+++ b/sys-devel/kgcc/kgcc-2.95.3.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/kgcc/kgcc-2.95.3.ebuild,v 1.1 2002/12/31 18:25:28 cretin Exp $
+
+IUSE="static"
+
+inherit eutils flag-o-matic
+
+SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/gcc-${PV}/gcc-core-${PV}.tar.bz2"
+
+S="${WORKDIR}/gcc-${PV}"
+LOC="/usr"
+DESCRIPTION="Modern GCC C compiler for building kernels"
+HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
+SLOT="0"
+LICENSE="GPL-2 LGPL-2"
+KEYWORDS="x86 ppc sparc"
+
+DEPEND="virtual/glibc"
+RDEPEND="virtual/glibc"
+DEPEND="${DEPEND}
+ >=sys-libs/ncurses-5.2-r2
+ >=sys-apps/texinfo-4.2-r4"
+
+src_unpack() {
+ unpack gcc-core-${PV}.tar.bz2
+
+ cd ${S}
+
+ libtoolize --copy --force &> ${T}/foo-out
+
+ # This new patch for the atexit problem occured with glibc-2.2.3 should
+ # work with glibc-2.2.4. This closes bug #3987 and #4004.
+ #
+ # Azarah - 29 Jun 2002
+ #
+ # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2001/08/0476.html
+ # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2001/08/0589.html
+ #
+ #
+ # Something to note, is that this patch makes gcc crash if its given
+ # the "-mno-ieee-fp" flag ... libvorbis is an good example of this.
+ # This however is on of those which one we want fixed most cases :/
+ #
+ # Azarah - 30 Jun 2002
+ #
+ epatch ${FILESDIR}/${P}-new-atexit.diff
+
+}
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} --enable-languages=c --enable-shared"
+
+ # gcc does not like optimization
+
+ unset CFLAGS
+ unset CXXFLAGS
+
+ ${S}/configure --prefix=${LOC} \
+ --mandir=${LOC}/share/man \
+ --infodir=${LOC}/share/info \
+ --enable-version-specific-runtime-libs \
+ --host=${CHOST} \
+ --build=${CHOST} \
+ --target=${CHOST} \
+ --enable-threads \
+ --with-local-prefix=${LOC}/local \
+ ${myconf} || die
+
+ # Setup -j in MAKEOPTS
+ get_number_of_jobs
+
+ if [ -z "`use static`" ]
+ then
+ emake bootstrap-lean || die
+ else
+ emake LDFLAGS=-static bootstrap || die
+ fi
+}
+
+src_install() {
+ cd ${S}
+ make install \
+ prefix=${D}${LOC} \
+ mandir=${D}${LOC}/share/man \
+ infodir=${D}${LOC}/share/info || die
+
+ # binutils libiberty.a and we want to use that version
+ # closes bug #2262
+ rm -f ${D}/usr/lib/libiberty.a
+
+ # Don't need man and info files
+ cd ${D}/usr/share
+ rm -rf info man
+
+ cd ${D}/usr/bin
+ mv -f gcc kgcc
+ rm -rf cpp gcov unprotoize protoize *-gnu-gcc
+
+ cd ${D}/usr
+ rm -rf *-linux-gnu
+
+ cd ${S}
+ docinto /
+ dodoc COPYING COPYING.LIB README* FAQ MAINTAINERS
+ docinto html
+ dodoc faq.html
+ docinto gcc
+ cd ${S}/gcc
+ dodoc BUGS ChangeLog* COPYING* FSFChangeLog* LANGUAGES NEWS PROBLEMS README* SERVICE TESTS.FLUNK
+}
+