summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2003-05-17 00:18:44 +0000
committerMartin Schlemmer <azarah@gentoo.org>2003-05-17 00:18:44 +0000
commite68e5f3d8d0be1d35551efa3be30614b117abbe2 (patch)
tree17fabacfcf0b184dbc56f71f519e7d010f11f59f /sys-devel/gcc
parentunmask gnucash/guile (diff)
downloadhistorical-e68e5f3d8d0be1d35551efa3be30614b117abbe2.tar.gz
historical-e68e5f3d8d0be1d35551efa3be30614b117abbe2.tar.bz2
historical-e68e5f3d8d0be1d35551efa3be30614b117abbe2.zip
cleanup
Diffstat (limited to 'sys-devel/gcc')
-rw-r--r--sys-devel/gcc/files/3.2.2/protector.c2450
-rw-r--r--sys-devel/gcc/files/3.2.2/protector.h48
-rw-r--r--sys-devel/gcc/files/3.2.2/protector.patch1078
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.1-r71
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2-r11
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2-r42
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.11
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.1-r13
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.1-r51
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.1-r63
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.2-r12
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.2-r34
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.33
-rw-r--r--sys-devel/gcc/gcc-3.1-r7.ebuild371
-rw-r--r--sys-devel/gcc/gcc-3.2-r1.ebuild408
-rw-r--r--sys-devel/gcc/gcc-3.2-r4.ebuild423
-rw-r--r--sys-devel/gcc/gcc-3.2-r5.ebuild4
-rw-r--r--sys-devel/gcc/gcc-3.2.1-r1.ebuild475
-rw-r--r--sys-devel/gcc/gcc-3.2.1-r5.ebuild449
-rw-r--r--sys-devel/gcc/gcc-3.2.1-r6.ebuild499
-rw-r--r--sys-devel/gcc/gcc-3.2.1-r7.ebuild4
-rw-r--r--sys-devel/gcc/gcc-3.2.1.ebuild414
-rw-r--r--sys-devel/gcc/gcc-3.2.2-r1.ebuild519
-rw-r--r--sys-devel/gcc/gcc-3.2.2-r3.ebuild555
-rw-r--r--sys-devel/gcc/gcc-3.2.3.ebuild556
25 files changed, 4 insertions, 8270 deletions
diff --git a/sys-devel/gcc/files/3.2.2/protector.c b/sys-devel/gcc/files/3.2.2/protector.c
deleted file mode 100644
index f316b9c76bd0..000000000000
--- a/sys-devel/gcc/files/3.2.2/protector.c
+++ /dev/null
@@ -1,2450 +0,0 @@
-/* RTL buffer overflow protection function for GNU C compiler
- Copyright (C) 1987, 88, 89, 92-7, 1998 Free Software Foundation, 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 2, 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.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "machmode.h"
-
-#include "rtl.h"
-#include "tree.h"
-#include "regs.h"
-#include "flags.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "expr.h"
-#include "output.h"
-#include "recog.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "except.h"
-#include "function.h"
-#include "toplev.h"
-#include "conditions.h"
-#include "insn-attr.h"
-#include "c-tree.h"
-#include "optabs.h"
-#include "protector.h"
-
-
-void prepare_stack_protection PARAMS ((int inlinable));
-int search_string_def PARAMS ((tree names));
-rtx assign_stack_local_for_pseudo_reg PARAMS ((enum machine_mode, HOST_WIDE_INT, int));
-
-
-/* Warn when not issuing stack smashing protection for some reason */
-int warn_stack_protector;
-
-/* Round a value to the lowest integer less than it that is a multiple of
- the required alignment. Avoid using division in case the value is
- negative. Assume the alignment is a power of two. */
-#define FLOOR_ROUND(VALUE,ALIGN) ((VALUE) & ~((ALIGN) - 1))
-
-/* Similar, but round to the next highest integer that meets the
- alignment. */
-#define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1))
-
-
-/* Nonzero means use propolice as a stack protection method */
-extern int flag_propolice_protection;
-
-/* This file contains several memory arrangement functions to protect
- the return address and the frame pointer of the stack
- from a stack-smashing attack. It also
- provides the function that protects pointer variables. */
-
-/* Nonzero if function being compiled can define string buffers that may be
- damaged by the stack-smash attack */
-static int current_function_defines_vulnerable_string;
-static int current_function_defines_short_string;
-static int current_function_has_variable_string;
-static int current_function_defines_vsized_array;
-static int current_function_is_inlinable;
-
-static rtx guard_area, _guard;
-static rtx function_first_insn, prologue_insert_point;
-static rtx debuginsn;
-
-/* */
-static HOST_WIDE_INT sweep_frame_offset;
-static HOST_WIDE_INT push_allocated_offset = 0;
-static HOST_WIDE_INT push_frame_offset = 0;
-static int saved_cse_not_expected = 0;
-
-static int search_string_from_argsandvars PARAMS ((int caller));
-static int search_string_from_local_vars PARAMS ((tree block));
-static int search_pointer_def PARAMS ((tree names));
-static int search_func_pointer PARAMS ((tree type, int mark));
-static void reset_used_flags_for_insns PARAMS ((rtx insn));
-static void reset_used_flags_for_decls PARAMS ((tree block));
-static void reset_used_flags_of_plus PARAMS ((rtx x));
-static void rtl_prologue PARAMS ((rtx insn));
-static void rtl_epilogue PARAMS ((rtx fnlastinsn));
-static void arrange_var_order PARAMS ((tree blocks));
-static void copy_args_for_protection PARAMS ((void));
-static void sweep_string_variable PARAMS ((rtx sweep_var, HOST_WIDE_INT var_size));
-static void sweep_string_in_decls PARAMS ((tree block, HOST_WIDE_INT sweep_offset, HOST_WIDE_INT size));
-static void sweep_string_in_args PARAMS ((tree parms, HOST_WIDE_INT sweep_offset, HOST_WIDE_INT size));
-static void sweep_string_use_of_insns PARAMS ((rtx insn, HOST_WIDE_INT sweep_offset, HOST_WIDE_INT size));
-static void sweep_string_in_operand PARAMS ((rtx insn, rtx *loc, HOST_WIDE_INT sweep_offset, HOST_WIDE_INT size));
-static void move_arg_location PARAMS ((rtx insn, rtx orig, rtx new, HOST_WIDE_INT var_size));
-static void change_arg_use_of_insns PARAMS ((rtx insn, rtx orig, rtx *new, HOST_WIDE_INT size));
-static void change_arg_use_of_insns_2 PARAMS ((rtx insn, rtx orig, rtx *new, HOST_WIDE_INT size));
-static void change_arg_use_in_operand PARAMS ((rtx x, rtx orig, rtx *new, HOST_WIDE_INT size));
-static void validate_insns_of_varrefs PARAMS ((rtx insn));
-static void validate_operand_of_varrefs PARAMS ((rtx insn, rtx *loc));
-
-#define SUSPICIOUS_BUF_SIZE 8
-
-#define AUTO_BASEPTR(X) \
- (GET_CODE (X) == PLUS ? XEXP (X, 0) : X)
-#define AUTO_OFFSET(X) \
- (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
-#undef PARM_PASSED_IN_MEMORY
-#define PARM_PASSED_IN_MEMORY(PARM) \
- (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
-#define VIRTUAL_STACK_VARS_P(X) \
- ((X) == virtual_stack_vars_rtx || (GET_CODE (X) == REG && (X)->used))
-
-
-
-void
-prepare_stack_protection (inlinable)
- int inlinable;
-{
- tree blocks = DECL_INITIAL (current_function_decl);
- current_function_is_inlinable = inlinable && !flag_no_inline;
- push_frame_offset = push_allocated_offset = 0;
- saved_cse_not_expected = 0;
-
- /*
- skip the protection if the function has no block or it is an inline function
- */
- if (current_function_is_inlinable) validate_insns_of_varrefs (get_insns ());
- if (! blocks || current_function_is_inlinable) return;
-
- current_function_defines_vulnerable_string = search_string_from_argsandvars (0);
-
- if (current_function_defines_vulnerable_string)
- {
- HOST_WIDE_INT offset;
- function_first_insn = get_insns ();
-
- if (current_function_contains_functions) {
- if (warn_stack_protector)
- warning ("not protecting function: it contains functions");
- return;
- }
-
- /* Initialize recognition, indicating that volatile is OK. */
- init_recog ();
-
- sweep_frame_offset = 0;
-
-#ifdef STACK_GROWS_DOWNWARD
- /*
- frame_offset: offset to end of allocated area of stack frame.
- It is defined in the function.c
- */
-
- /* the location must be before buffers */
- guard_area = assign_stack_local (BLKmode, UNITS_PER_GUARD, -1);
- PUT_MODE (guard_area, GUARD_m);
- MEM_VOLATILE_P (guard_area) = 1;
-
-#ifndef FRAME_GROWS_DOWNWARD
- sweep_frame_offset = frame_offset;
-#endif
-
- /* For making room for guard value, scan all insns and fix the offset address
- of the variable that is based on frame pointer.
- Scan all declarations of variables and fix the offset address of the variable that
- is based on the frame pointer */
- sweep_string_variable (guard_area, UNITS_PER_GUARD);
-
-
- /* the location of guard area moves to the beginning of stack frame */
- if ((offset = AUTO_OFFSET(XEXP (guard_area, 0))))
- XEXP (XEXP (guard_area, 0), 1) = gen_rtx_CONST_INT (VOIDmode, sweep_frame_offset);
-
-
- /* Insert prologue rtl instructions */
- rtl_prologue (function_first_insn);
-
- if (! current_function_has_variable_string)
- {
- /* Generate argument saving instruction */
- copy_args_for_protection ();
-
-#ifndef FRAME_GROWS_DOWNWARD
- /* If frame grows upward, character string copied from an arg stays top of
- the guard variable. So sweep the guard variable again */
- sweep_frame_offset = CEIL_ROUND (frame_offset, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
- sweep_string_variable (guard_area, UNITS_PER_GUARD);
-#endif
- }
- else if (warn_stack_protector)
- warning ("not protecting variables: it has a variable length buffer");
-#endif
-#ifndef FRAME_GROWS_DOWNWARD
- if (STARTING_FRAME_OFFSET == 0)
- {
- /* this may be only for alpha */
- push_allocated_offset = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- assign_stack_local (BLKmode, push_allocated_offset, -1);
- sweep_frame_offset = frame_offset;
- sweep_string_variable (const0_rtx, -push_allocated_offset);
- sweep_frame_offset = AUTO_OFFSET (XEXP (guard_area, 0));
- }
-#endif
-
- /* Arrange the order of local variables */
- arrange_var_order (blocks);
-
-#ifdef STACK_GROWS_DOWNWARD
- /* Insert epilogue rtl instructions */
- rtl_epilogue (get_last_insn ());
-#endif
- init_recog_no_volatile ();
- }
- else if (current_function_defines_short_string
- && warn_stack_protector)
- warning ("not protecting function: buffer is less than %d bytes long",
- SUSPICIOUS_BUF_SIZE);
-}
-
-/*
- search string from arguments and local variables
- caller: 0 means call from protector_stack_protection
- 1 means call from push_frame
-*/
-static int
-search_string_from_argsandvars (caller)
- int caller;
-{
- tree blocks, parms;
- int string_p;
-
- /* saves a latest search result as a cached infomation */
- static tree __latest_search_decl = 0;
- static int __latest_search_result = FALSE;
-
- if (__latest_search_decl == current_function_decl)
- return __latest_search_result;
- else if (caller) return FALSE;
- __latest_search_decl = current_function_decl;
- __latest_search_result = TRUE;
-
- current_function_defines_short_string = FALSE;
- current_function_has_variable_string = FALSE;
- current_function_defines_vsized_array = FALSE;
-
- /*
- search a string variable from local variables
- */
- blocks = DECL_INITIAL (current_function_decl);
- string_p = search_string_from_local_vars (blocks);
-
- if (!current_function_defines_vsized_array && current_function_calls_alloca)
- {
- current_function_has_variable_string = TRUE;
- return TRUE;
- }
-
- if (string_p) return TRUE;
-
-#ifdef STACK_GROWS_DOWNWARD
- /*
- search a string variable from arguments
- */
- parms = DECL_ARGUMENTS (current_function_decl);
-
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
- {
- if (PARM_PASSED_IN_MEMORY (parms) && DECL_NAME (parms))
- {
- string_p = search_string_def (TREE_TYPE(parms));
- if (string_p) return TRUE;
- }
- }
-#endif
-
- __latest_search_result = FALSE;
- return FALSE;
-}
-
-
-static int
-search_string_from_local_vars (block)
- tree block;
-{
- tree types;
- int found = FALSE;
-
- while (block && TREE_CODE(block)==BLOCK)
- {
- types = BLOCK_VARS(block);
-
- while (types)
- {
- /* skip the declaration that refers an external variable */
- /* name: types.decl.name.identifier.id */
- if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types)
- && TREE_CODE (types) == VAR_DECL
- && ! DECL_ARTIFICIAL (types)
- && DECL_RTL_SET_P (types)
- && GET_CODE (DECL_RTL (types)) == MEM)
- {
- if (search_string_def (TREE_TYPE (types)))
- {
- rtx home = DECL_RTL (types);
-
- if (GET_CODE (home) == MEM
- && (GET_CODE (XEXP (home, 0)) == MEM
- || (GET_CODE (XEXP (home, 0)) == REG
- && XEXP (home, 0) != virtual_stack_vars_rtx
- && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
-#endif
- )))
- /* If the value is indirect by memory or by a register
- that isn't the frame pointer
- then it means the object is variable-sized and address through
- that register or stack slot. The protection has no way to hide pointer variables
- behind the array, so all we can do is staying the order of variables and arguments. */
- {
- current_function_has_variable_string = TRUE;
- }
-
- /* found character array */
- found = TRUE;
- }
- }
-
- types = TREE_CHAIN(types);
- }
-
- if (search_string_from_local_vars (BLOCK_SUBBLOCKS (block)))
- {
- found = TRUE;
- }
-
- block = BLOCK_CHAIN (block);
- }
-
- return found;
-}
-
-
-/*
- * search a character array from the specified type tree
- */
-int
-search_string_def (type)
- tree type;
-{
- tree tem;
-
- if (! type)
- return FALSE;
-
- switch (TREE_CODE (type))
- {
- case ARRAY_TYPE:
- /* Check if the array is a variable-sized array */
- if (TYPE_DOMAIN (type) == 0
- || (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
- && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) == NOP_EXPR))
- current_function_defines_vsized_array = TRUE;
-
- /* TREE_CODE( TREE_TYPE(type) ) == INTEGER_TYPE */
- if (TYPE_MAIN_VARIANT (TREE_TYPE(type)) == char_type_node
- || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == signed_char_type_node
- || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == unsigned_char_type_node)
- {
- /* Check if the string is a variable string */
- if (TYPE_DOMAIN (type) == 0
- || (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
- && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) == NOP_EXPR))
- return TRUE;
-
- /* Check if the string size is greater than SUSPICIOUS_BUF_SIZE */
- if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
- && TREE_INT_CST_LOW(TYPE_MAX_VALUE(TYPE_DOMAIN(type)))+1 >= SUSPICIOUS_BUF_SIZE)
- return TRUE;
-
- current_function_defines_short_string = TRUE;
- }
- return search_string_def(TREE_TYPE(type));
-
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case RECORD_TYPE:
- /* Output the name, type, position (in bits), size (in bits) of each
- field. */
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- {
- /* Omit here local type decls until we know how to support them. */
- if ((TREE_CODE (tem) == TYPE_DECL)
- || (TREE_CODE (tem) == VAR_DECL && TREE_STATIC (tem)))
- continue;
-
- if (search_string_def(TREE_TYPE(tem))) return TRUE;
- }
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* I'm not sure whether OFFSET_TYPE needs this treatment,
- so I'll play safe and return 1. */
- case OFFSET_TYPE:
- default:
- break;
- }
-
- return FALSE;
-}
-
-/*
- * examine whether the input contains frame pointer addressing
- */
-int
-contains_fp (op)
- rtx op;
-{
- register enum rtx_code code;
- rtx x;
- int i, j;
- const char *fmt;
-
- x = op;
- if (x == 0)
- return FALSE;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case REG:
- case ADDRESSOF:
- return FALSE;
-
- case PLUS:
- if (XEXP (x, 0) == virtual_stack_vars_rtx
- && CONSTANT_P (XEXP (x, 1)))
- return TRUE;
-
- default:
- break;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- {
- if (contains_fp (XEXP (x, i))) return TRUE;
- }
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- if (contains_fp (XVECEXP (x, i, j))) return TRUE;
-
- return FALSE;
-}
-
-
-static int
-search_pointer_def (type)
- tree type;
-{
- tree tem;
-
- if (! type)
- return FALSE;
-
- switch (TREE_CODE (type))
- {
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case RECORD_TYPE:
- /* Output the name, type, position (in bits), size (in bits) of each
- field. */
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- {
- /* Omit here local type decls until we know how to support them. */
- if ((TREE_CODE (tem) == TYPE_DECL)
- || (TREE_CODE (tem) == VAR_DECL && TREE_STATIC (tem)))
- continue;
-
- if (search_pointer_def (TREE_TYPE(tem))) return TRUE;
- }
- break;
-
- case ARRAY_TYPE:
- return search_pointer_def (TREE_TYPE(type));
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* I'm not sure whether OFFSET_TYPE needs this treatment,
- so I'll play safe and return 1. */
- case OFFSET_TYPE:
- if (TYPE_READONLY (TREE_TYPE (type)))
- {
- int funcp = search_func_pointer (TREE_TYPE (type), 1);
- /* Un-mark the type as having been visited already */
- search_func_pointer (TREE_TYPE (type), 0);
- return funcp;
- }
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-
-static int
-search_func_pointer (type, mark)
- tree type;
- int mark;
-{
- tree tem;
-
- if (! type)
- return FALSE;
-
- switch (TREE_CODE (type))
- {
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case RECORD_TYPE:
- if (TREE_ASM_WRITTEN (type) != mark)
- {
- /* mark the type as having been visited already */
- TREE_ASM_WRITTEN (type) = mark;
-
- /* Output the name, type, position (in bits), size (in bits) of
- each field. */
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- {
- /* Omit here local type decls until we know how to support them. */
- if (TREE_CODE (tem) == FIELD_DECL
- && search_func_pointer (TREE_TYPE(tem), mark)) return TRUE;
- }
- }
- break;
-
- case ARRAY_TYPE:
- return search_func_pointer (TREE_TYPE(type), mark);
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* I'm not sure whether OFFSET_TYPE needs this treatment,
- so I'll play safe and return 1. */
- case OFFSET_TYPE:
- return TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-
-static void
-reset_used_flags_for_insns (insn)
- rtx insn;
-{
- register int i, j;
- register enum rtx_code code;
- register const char *format_ptr;
-
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- code = GET_CODE (insn);
- insn->used = 0;
- format_ptr = GET_RTX_FORMAT (code);
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++) {
- case 'e':
- reset_used_flags_of_plus (XEXP (insn, i));
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (insn, i); j++)
- reset_used_flags_of_plus (XVECEXP (insn, i, j));
- break;
- }
- }
- }
-}
-
-static void
-reset_used_flags_for_decls (block)
- tree block;
-{
- tree types;
- rtx home;
-
- while (block && TREE_CODE(block)==BLOCK)
- {
- types = BLOCK_VARS(block);
-
- while (types)
- {
- /* skip the declaration that refers an external variable and
- also skip an global variable */
- if (! DECL_EXTERNAL (types))
- {
- if (!DECL_RTL_SET_P (types)) goto next;
- home = DECL_RTL (types);
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
- {
- XEXP (home, 0)->used = 0;
- }
- }
- next:
- types = TREE_CHAIN(types);
- }
-
- reset_used_flags_for_decls (BLOCK_SUBBLOCKS (block));
-
- block = BLOCK_CHAIN (block);
- }
-}
-
-/* Clear the USED bits only of type PLUS in X */
-
-static void
-reset_used_flags_of_plus (x)
- rtx x;
-{
- register int i, j;
- register enum rtx_code code;
- register const char *format_ptr;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- /* These types may be freely shared so we needn't do any resetting
- for them. */
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- return;
-
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case NOTE:
- case LABEL_REF:
- case BARRIER:
- /* The chain of insns is not being copied. */
- return;
-
- case PLUS:
- x->used = 0;
- break;
-
- case CALL_PLACEHOLDER:
- reset_used_flags_for_insns (XEXP (x, 0));
- reset_used_flags_for_insns (XEXP (x, 1));
- reset_used_flags_for_insns (XEXP (x, 2));
- break;
-
- default:
- break;
- }
-
- format_ptr = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- reset_used_flags_of_plus (XEXP (x, i));
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- reset_used_flags_of_plus (XVECEXP (x, i, j));
- break;
- }
- }
-}
-
-
-static void
-rtl_prologue (insn)
- rtx insn;
-{
-#if defined(INIT_SECTION_ASM_OP) && !defined(INVOKE__main)
-#undef HAS_INIT_SECTION
-#define HAS_INIT_SECTION
-#endif
-
- rtx _val;
-
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
- break;
-
-#if !defined (HAS_INIT_SECTION)
- /* If this function is `main', skip a call to `__main'
- to run guard instruments after global initializers, etc. */
- if (DECL_NAME (current_function_decl)
- && MAIN_NAME_P (DECL_NAME (current_function_decl))
- && DECL_CONTEXT (current_function_decl) == NULL_TREE)
- {
- rtx fbinsn = insn;
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
- break;
- if (insn == 0) insn = fbinsn;
- }
-#endif
-
- prologue_insert_point = NEXT_INSN (insn); /* mark the next insn of FUNCTION_BEG insn */
-
- start_sequence ();
-
- _guard = gen_rtx_MEM (GUARD_m, gen_rtx_SYMBOL_REF (Pmode, "__guard"));
- emit_move_insn ( guard_area, _guard);
-
- _val = gen_sequence ();
- end_sequence ();
-
- emit_insn_before (_val, prologue_insert_point);
-}
-
-static void
-rtl_epilogue (insn)
- rtx insn;
-{
- rtx if_false_label;
- rtx _val;
- rtx funcname;
- tree funcstr;
- int flag_have_return = FALSE;
-
- start_sequence ();
-
-#ifdef HAVE_return
- if (HAVE_return)
- {
- rtx insn;
- return_label = gen_label_rtx ();
-
- for (insn = prologue_insert_point; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == RETURN
- && GET_MODE (PATTERN (insn)) == VOIDmode)
- {
- rtx pat = gen_rtx_SET (VOIDmode,
- pc_rtx,
- gen_rtx_LABEL_REF (VOIDmode,
- return_label));
- PATTERN (insn) = pat;
- flag_have_return = TRUE;
- }
-
-
- emit_label (return_label);
- }
-#endif
-
- compare_from_rtx (guard_area, _guard, NE, 0, GUARD_m, NULL_RTX); /* if (guard_area != _guard) */
-
- if_false_label = gen_label_rtx (); /* { */
- emit_jump_insn ( gen_beq(if_false_label));
-
- /* generate string for the current function name */
- funcstr = build_string (strlen(current_function_name)+1, current_function_name);
- TREE_TYPE (funcstr) = build_array_type (char_type_node, 0);/* = char_array_type_node;*/
- funcname = output_constant_def (funcstr, 1);
-
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__stack_smash_handler"),
- 0, VOIDmode, 2,
- XEXP (funcname, 0), Pmode, guard_area, GUARD_m);
-
- /* generate RTL to return from the current function */
-
- emit_barrier (); /* } */
- emit_label (if_false_label);
-
- /* generate RTL to return from the current function */
- if (DECL_RTL_SET_P (DECL_RESULT (current_function_decl)))
- use_return_register ();
-
-#ifdef HAVE_return
- if (HAVE_return && flag_have_return)
- {
- emit_jump_insn (gen_return ());
- emit_barrier ();
- }
-#endif
-
- _val = gen_sequence ();
- end_sequence ();
-
- emit_insn_after (_val, insn);
-}
-
-
-static void
-arrange_var_order (block)
- tree block;
-{
- tree types;
- HOST_WIDE_INT offset;
-
- while (block && TREE_CODE(block)==BLOCK)
- {
- types = BLOCK_VARS (block);
-
- while (types)
- {
- /* skip the declaration that refers an external variable */
- /* name: types.decl.assembler_name.id */
- if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types)
- && TREE_CODE (types) == VAR_DECL
- && ! DECL_ARTIFICIAL (types)
- && ! DECL_INLINE (types) /* don't sweep inlined string */
- && DECL_RTL_SET_P (types)
- && GET_CODE (DECL_RTL (types)) == MEM)
- {
- if (search_string_def (TREE_TYPE (types)))
- {
- rtx home = DECL_RTL (types);
-
- if (! (GET_CODE (home) == MEM
- && (GET_CODE (XEXP (home, 0)) == MEM
- || (GET_CODE (XEXP (home, 0)) == REG
- && XEXP (home, 0) != virtual_stack_vars_rtx
- && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
-#endif
- ))))
- {
- /* found a string variable */
- HOST_WIDE_INT var_size =
- ((TREE_INT_CST_LOW (DECL_SIZE (types)) + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT);
-
- if (GET_MODE (DECL_RTL (types)) == BLKmode)
- {
- int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- var_size = CEIL_ROUND (var_size, alignment);
- }
-
- /* skip the variable if it is top of the region
- specified by sweep_frame_offset */
- offset = AUTO_OFFSET (XEXP (DECL_RTL (types), 0));
- if (offset == sweep_frame_offset - var_size)
- sweep_frame_offset -= var_size;
-
- else if (offset < sweep_frame_offset - var_size)
- sweep_string_variable (DECL_RTL (types), var_size);
- }
- }
- }
-
- types = TREE_CHAIN(types);
- }
-
- arrange_var_order (BLOCK_SUBBLOCKS (block));
-
- block = BLOCK_CHAIN (block);
- }
-}
-
-
-static void
-copy_args_for_protection (void)
-{
- tree parms = DECL_ARGUMENTS (current_function_decl);
- rtx temp_rtx;
-
- parms = DECL_ARGUMENTS (current_function_decl);
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
- {
- if (PARM_PASSED_IN_MEMORY (parms) && DECL_NAME (parms))
- {
- int string_p;
-
- /*
- skip arguemnt protection if the last argument is used
- for the variable argument
- */
- /*
- tree fntype;
- if (TREE_CHAIN (parms) == 0)
- {
- fntype = TREE_TYPE (current_function_decl);
-
- if ((TYPE_ARG_TYPES (fntype) != 0 &&
- TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) != void_type_node)
- || current_function_varargs)
- continue;
- }
- */
-
- string_p = search_string_def (TREE_TYPE(parms));
-
- /* check if it is a candidate to move */
- if (string_p || search_pointer_def (TREE_TYPE (parms)))
- {
- int arg_size
- = ((TREE_INT_CST_LOW (DECL_SIZE (parms)) + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT);
-
- start_sequence ();
-
- if (GET_CODE (DECL_RTL (parms)) == REG)
- {
- rtx safe = 0;
-
- change_arg_use_of_insns (prologue_insert_point, DECL_RTL (parms), &safe, 0);
- if (safe)
- {
- /* generate codes for copying the content */
- rtx movinsn = emit_move_insn (safe, DECL_RTL (parms));
-
- /* avoid register elimination in gcse.c (COPY-PROP)*/
- PATTERN (movinsn)->volatil = 1;
-
- /* save debugger info */
- DECL_INCOMING_RTL (parms) = safe;
- }
- }
-
- else if (GET_CODE (DECL_RTL (parms)) == MEM
- && GET_CODE (XEXP (DECL_RTL (parms), 0)) == ADDRESSOF)
- {
- rtx movinsn;
- rtx safe = gen_reg_rtx (GET_MODE (DECL_RTL (parms)));
-
- /* generate codes for copying the content */
- movinsn = emit_move_insn (safe, DECL_INCOMING_RTL (parms));
- PATTERN (movinsn)->volatil = 1; /* avoid register elimination in gcse.c (COPY-PROP)*/
-
- /* change the addressof information to the newly allocated pseudo register */
- emit_move_insn (DECL_RTL (parms), safe);
-
- /* save debugger info */
- DECL_INCOMING_RTL (parms) = safe;
- }
-
- else
- {
- /* declare temporary local variable DECL_NAME (parms) for it */
- temp_rtx
- = assign_stack_local (DECL_MODE (parms), arg_size,
- DECL_MODE (parms) == BLKmode ? -1 : 0);
-
- MEM_IN_STRUCT_P (temp_rtx) = AGGREGATE_TYPE_P (TREE_TYPE (parms));
- set_mem_alias_set (temp_rtx, get_alias_set (parms));
-
- /* generate codes for copying the content */
- store_expr (parms, temp_rtx, 0);
-
- /* change the reference for each instructions */
- move_arg_location (prologue_insert_point, DECL_RTL (parms),
- temp_rtx, arg_size);
-
- /* change the location of parms variable */
- SET_DECL_RTL (parms, temp_rtx);
-
- /* change debugger info */
- DECL_INCOMING_RTL (parms) = temp_rtx;
- }
-
- emit_insn_before (gen_sequence (), prologue_insert_point);
- end_sequence ();
-
-#ifdef FRAME_GROWS_DOWNWARD
- /* process the string argument */
- if (string_p && DECL_MODE (parms) == BLKmode)
- {
- int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- arg_size = CEIL_ROUND (arg_size, alignment);
-
- /* change the reference for each instructions */
- sweep_string_variable (DECL_RTL (parms), arg_size);
- }
-#endif
- }
- }
- }
-}
-
-
-/*
- sweep a string variable to the local variable addressed by sweep_frame_offset, that is
- a last position of string variables.
-*/
-static void
-sweep_string_variable (sweep_var, var_size)
- rtx sweep_var;
- HOST_WIDE_INT var_size;
-{
- HOST_WIDE_INT sweep_offset;
-
- switch (GET_CODE (sweep_var))
- {
- case MEM:
- if (GET_CODE (XEXP (sweep_var, 0)) == ADDRESSOF
- && GET_CODE (XEXP (XEXP (sweep_var, 0), 0)) == REG)
- return;
- sweep_offset = AUTO_OFFSET(XEXP (sweep_var, 0));
- break;
- case CONST_INT:
- sweep_offset = INTVAL (sweep_var);
- break;
- default:
- abort ();
- }
-
- /* scan all declarations of variables and fix the offset address of
- the variable based on the frame pointer */
- sweep_string_in_decls (DECL_INITIAL (current_function_decl), sweep_offset, var_size);
-
- /* scan all argument variable and fix the offset address based on the frame pointer */
- sweep_string_in_args (DECL_ARGUMENTS (current_function_decl), sweep_offset, var_size);
-
- /* For making room for sweep variable, scan all insns and fix the offset address
- of the variable that is based on frame pointer*/
- sweep_string_use_of_insns (function_first_insn, sweep_offset, var_size);
-
-
- /* Clear all the USED bits in operands of all insns and declarations of local vars */
- reset_used_flags_for_decls (DECL_INITIAL (current_function_decl));
- reset_used_flags_for_insns (function_first_insn);
-
- sweep_frame_offset -= var_size;
-}
-
-
-
-/*
- move an argument to the local variable addressed by frame_offset
-*/
-static void
-move_arg_location (insn, orig, new, var_size)
- rtx insn, orig, new;
- HOST_WIDE_INT var_size;
-{
- /* For making room for sweep variable, scan all insns and fix the offset address
- of the variable that is based on frame pointer*/
- change_arg_use_of_insns (insn, orig, &new, var_size);
-
-
- /* Clear all the USED bits in operands of all insns and declarations of local vars */
- reset_used_flags_for_insns (insn);
-}
-
-
-static void
-sweep_string_in_decls (block, sweep_offset, sweep_size)
- tree block;
- HOST_WIDE_INT sweep_offset, sweep_size;
-{
- tree types;
- HOST_WIDE_INT offset;
- rtx home;
-
- while (block && TREE_CODE(block)==BLOCK)
- {
- types = BLOCK_VARS(block);
-
- while (types)
- {
- /* skip the declaration that refers an external variable and
- also skip an global variable */
- if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types)) {
-
- if (!DECL_RTL_SET_P (types)) goto next;
- home = DECL_RTL (types);
-
- /* process for static local variable */
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
- goto next;
-
- if (GET_CODE (home) == MEM
- && XEXP (home, 0) == virtual_stack_vars_rtx)
- {
- offset = 0;
-
- /* the operand related to the sweep variable */
- if (sweep_offset <= offset
- && offset < sweep_offset + sweep_size)
- {
- offset = sweep_frame_offset - sweep_size - sweep_offset;
-
- XEXP (home, 0) = plus_constant (virtual_stack_vars_rtx, offset);
- XEXP (home, 0)->used = 1;
- }
- else if (sweep_offset <= offset
- && offset < sweep_frame_offset)
- { /* the rest of variables under sweep_frame_offset, so shift the location */
- XEXP (home, 0) = plus_constant (virtual_stack_vars_rtx, -sweep_size);
- XEXP (home, 0)->used = 1;
- }
- }
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == MEM)
- {
- /* process for dynamically allocated aray */
- home = XEXP (home, 0);
- }
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == PLUS
- && XEXP (XEXP (home, 0), 0) == virtual_stack_vars_rtx
- && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
- {
- if (! XEXP (home, 0)->used)
- {
- offset = AUTO_OFFSET(XEXP (home, 0));
-
- /* the operand related to the sweep variable */
- if (sweep_offset <= offset
- && offset < sweep_offset + sweep_size)
- {
-
- offset += sweep_frame_offset - sweep_size - sweep_offset;
- XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
- else if (sweep_offset <= offset
- && offset < sweep_frame_offset)
- { /* the rest of variables under sweep_frame_offset,
- so shift the location */
-
- XEXP (XEXP (home, 0), 1)
- = gen_rtx_CONST_INT (VOIDmode, offset - sweep_size);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
- }
- }
-
- }
- next:
- types = TREE_CHAIN(types);
- }
-
- sweep_string_in_decls (BLOCK_SUBBLOCKS (block), sweep_offset, sweep_size);
- block = BLOCK_CHAIN (block);
- }
-}
-
-
-static void
-sweep_string_in_args (parms, sweep_offset, sweep_size)
- tree parms;
- HOST_WIDE_INT sweep_offset, sweep_size;
-{
- rtx home;
- HOST_WIDE_INT offset;
-
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
- {
- if (PARM_PASSED_IN_MEMORY (parms) && DECL_NAME (parms))
- {
- home = DECL_INCOMING_RTL (parms);
-
- if (XEXP (home, 0)->used) continue;
-
- offset = AUTO_OFFSET(XEXP (home, 0));
-
- /* the operand related to the sweep variable */
- if (AUTO_BASEPTR (XEXP (home, 0)) == virtual_stack_vars_rtx)
- {
- if (sweep_offset <= offset
- && offset < sweep_offset + sweep_size)
- {
- offset += sweep_frame_offset - sweep_size - sweep_offset;
- XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
- else if (sweep_offset <= offset
- && offset < sweep_frame_offset)
- { /* the rest of variables under sweep_frame_offset, so shift the location */
- XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset - sweep_size);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
- }
- }
- }
-}
-
-
-static int has_virtual_reg;
-
-static void
-sweep_string_use_of_insns (insn, sweep_offset, sweep_size)
- rtx insn;
- HOST_WIDE_INT sweep_offset, sweep_size;
-{
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- has_virtual_reg = FALSE;
- sweep_string_in_operand (insn, &PATTERN (insn), sweep_offset, sweep_size);
- }
-}
-
-
-static void
-sweep_string_in_operand (insn, loc, sweep_offset, sweep_size)
- rtx insn, *loc;
- HOST_WIDE_INT sweep_offset, sweep_size;
-{
- register rtx x = *loc;
- register enum rtx_code code;
- int i, j, k = 0;
- HOST_WIDE_INT offset;
- const char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- case ADDRESSOF:
- return;
-
- case REG:
- if (x == virtual_incoming_args_rtx
- || x == virtual_stack_vars_rtx
- || x == virtual_stack_dynamic_rtx
- || x == virtual_outgoing_args_rtx
- || x == virtual_cfa_rtx)
- has_virtual_reg = TRUE;
- return;
-
- case SET:
- /*
- skip setjmp setup insn and setjmp restore insn
- Example:
- (set (MEM (reg:SI xx)) (virtual_stack_vars_rtx)))
- (set (virtual_stack_vars_rtx) (REG))
- */
- if (GET_CODE (XEXP (x, 0)) == MEM
- && XEXP (x, 1) == virtual_stack_vars_rtx)
- return;
- if (XEXP (x, 0) == virtual_stack_vars_rtx
- && GET_CODE (XEXP (x, 1)) == REG)
- return;
- break;
-
- case PLUS:
- /* Handle typical case of frame register plus constant. */
- if (XEXP (x, 0) == virtual_stack_vars_rtx
- && CONSTANT_P (XEXP (x, 1)))
- {
- if (x->used) goto single_use_of_virtual_reg;
-
- offset = AUTO_OFFSET(x);
- if (RTX_INTEGRATED_P (x)) k = -1; /* for inline base ptr */
-
- /* the operand related to the sweep variable */
- if (sweep_offset <= offset + k
- && offset + k < sweep_offset + sweep_size)
- {
- offset += sweep_frame_offset - sweep_size - sweep_offset;
-
- XEXP (x, 0) = virtual_stack_vars_rtx;
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
- x->used = 1;
- }
- else if (sweep_offset <= offset + k
- && offset + k < sweep_frame_offset)
- { /* the rest of variables under sweep_frame_offset, so shift the location */
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset - sweep_size);
- x->used = 1;
- }
-
- single_use_of_virtual_reg:
- if (has_virtual_reg) {
- /* excerpt from insn_invalid_p in recog.c */
- int icode = recog_memoized (insn);
-
- if (icode < 0 && asm_noperands (PATTERN (insn)) < 0)
- {
- rtx temp, seq;
-
- start_sequence ();
- temp = force_operand (x, NULL_RTX);
- seq = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq, insn);
- if (! validate_change (insn, loc, temp, 0)
- && ! validate_replace_rtx (x, temp, insn))
- fatal_insn ("sweep_string_in_operand", insn);
- }
- }
-
- has_virtual_reg = TRUE;
- return;
- }
-
-#ifdef FRAME_GROWS_DOWNWARD
- /*
- alert the case of frame register plus constant given by reg.
- */
- else if (XEXP (x, 0) == virtual_stack_vars_rtx
- && GET_CODE (XEXP (x, 1)) == REG)
- fatal_insn ("sweep_string_in_operand: unknown addressing", insn);
-#endif
-
- /*
- process further subtree:
- Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
- (const_int 5))
- */
- break;
-
- case CALL_PLACEHOLDER:
- sweep_string_use_of_insns (XEXP (x, 0), sweep_offset, sweep_size);
- sweep_string_use_of_insns (XEXP (x, 1), sweep_offset, sweep_size);
- sweep_string_use_of_insns (XEXP (x, 2), sweep_offset, sweep_size);
- break;
-
- default:
- break;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- {
- /*
- virtual_stack_vars_rtx without offset
- Example:
- (set (reg:SI xx) (reg:SI 78))
- (set (reg:SI xx) (MEM (reg:SI 78)))
- */
- if (XEXP (x, i) == virtual_stack_vars_rtx)
- fatal_insn ("sweep_string_in_operand: unknown fp usage", insn);
- sweep_string_in_operand (insn, &XEXP (x, i), sweep_offset, sweep_size);
- }
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- sweep_string_in_operand (insn, &XVECEXP (x, i, j), sweep_offset, sweep_size);
-}
-
-
-/*
- change a argument variable to the local variable addressed by the "new" variable.
-*/
-static int flag_caui_exit;
-
-static void
-change_arg_use_of_insns (insn, orig, new, size)
- rtx insn, orig, *new;
- HOST_WIDE_INT size;
-{
- flag_caui_exit = FALSE;
- change_arg_use_of_insns_2 (insn, orig, new, size);
-}
-
-static void
-change_arg_use_of_insns_2 (insn, orig, new, size)
- rtx insn, orig, *new;
- HOST_WIDE_INT size;
-{
- for (; insn && !flag_caui_exit; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- change_arg_use_in_operand (PATTERN (insn), orig, new, size);
- }
-}
-
-
-
-static void
-change_arg_use_in_operand (x, orig, new, size)
- rtx x, orig, *new;
- HOST_WIDE_INT size;
-{
- register enum rtx_code code;
- int i, j;
- HOST_WIDE_INT offset;
- const char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- case REG:
- case ADDRESSOF:
- return;
-
- case MEM:
- /* Handle special case of MEM (incoming_args) */
- if (GET_CODE (orig) == MEM
- && XEXP (x, 0) == virtual_incoming_args_rtx)
- {
- offset = 0;
-
- /* the operand related to the sweep variable */
- if (AUTO_OFFSET(XEXP (orig, 0)) <= offset &&
- offset < AUTO_OFFSET(XEXP (orig, 0)) + size) {
-
- offset = AUTO_OFFSET(XEXP (*new, 0))
- + (offset - AUTO_OFFSET(XEXP (orig, 0)));
-
- XEXP (x, 0) = plus_constant (virtual_stack_vars_rtx, offset);
- XEXP (x, 0)->used = 1;
-
- return;
- }
- }
- break;
-
- case PLUS:
- /* Handle special case of frame register plus constant. */
- if (GET_CODE (orig) == MEM /* skip if orig is register variable in the optimization */
- && XEXP (x, 0) == virtual_incoming_args_rtx && CONSTANT_P (XEXP (x, 1))
- && ! x->used)
- {
- offset = AUTO_OFFSET(x);
-
- /* the operand related to the sweep variable */
- if (AUTO_OFFSET(XEXP (orig, 0)) <= offset &&
- offset < AUTO_OFFSET(XEXP (orig, 0)) + size) {
-
- offset = AUTO_OFFSET(XEXP (*new, 0))
- + (offset - AUTO_OFFSET(XEXP (orig, 0)));
-
- XEXP (x, 0) = virtual_stack_vars_rtx;
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
- x->used = 1;
-
- return;
- }
-
- /*
- process further subtree:
- Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
- (const_int 5))
- */
- }
- break;
-
- case CALL_PLACEHOLDER:
- change_arg_use_of_insns_2 (XEXP (x, 0), orig, new, size); if (flag_caui_exit) return;
- change_arg_use_of_insns_2 (XEXP (x, 1), orig, new, size); if (flag_caui_exit) return;
- change_arg_use_of_insns_2 (XEXP (x, 2), orig, new, size); if (flag_caui_exit) return;
- break;
-
- default:
- break;
- }
-
- if (*new == 0
- && code == SET
- && SET_SRC (x) == orig
- && GET_CODE (SET_DEST (x)) == REG)
- {
- /* exit to the change_arg_use_of_insns */
- flag_caui_exit = TRUE;
- x->volatil = 1; /* avoid register elimination in gcse.c (COPY-PROP)*/
- return;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- {
- if (XEXP (x, i) == orig)
- {
- if (*new == 0) *new = gen_reg_rtx (GET_MODE (orig));
- XEXP (x, i) = *new;
- continue;
- }
- change_arg_use_in_operand (XEXP (x, i), orig, new, size);
- }
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- {
-
- if (XVECEXP (x, i, j) == orig)
- {
- if (*new == 0) *new = gen_reg_rtx (GET_MODE (orig));
- XVECEXP (x, i, j) = *new;
- continue;
- }
- change_arg_use_in_operand (XVECEXP (x, i, j), orig, new, size);
- }
-}
-
-
-static void
-validate_insns_of_varrefs (insn)
- rtx insn;
-{
- rtx next;
-
- /* Initialize recognition, indicating that volatile is OK. */
- init_recog ();
-
- for (; insn; insn = next)
- {
- next = NEXT_INSN (insn);
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- /* excerpt from insn_invalid_p in recog.c */
- int icode = recog_memoized (insn);
-
- if (icode < 0 && asm_noperands (PATTERN (insn)) < 0)
- validate_operand_of_varrefs (insn, &PATTERN (insn));
- }
- }
-
- init_recog_no_volatile ();
-}
-
-
-static void
-validate_operand_of_varrefs (insn, loc)
- rtx insn, *loc;
-{
- register enum rtx_code code;
- rtx x, temp, seq;
- int i, j;
- const char *fmt;
-
- x = *loc;
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case USE:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- case REG:
- case ADDRESSOF:
- return;
-
- case PLUS:
- /* validate insn of frame register plus constant. */
- if (GET_CODE (x) == PLUS
- && XEXP (x, 0) == virtual_stack_vars_rtx
- && CONSTANT_P (XEXP (x, 1)))
- {
- start_sequence ();
- /* temp = force_operand (x, NULL_RTX); */
- { /* excerpt from expand_binop in optabs.c */
- optab binoptab = add_optab;
- enum machine_mode mode = GET_MODE (x);
- int icode = (int) binoptab->handlers[(int) mode].insn_code;
- enum machine_mode mode1 = insn_data[icode].operand[2].mode;
- rtx pat;
- rtx xop0 = XEXP (x, 0), xop1 = XEXP (x, 1);
- temp = gen_reg_rtx (mode);
-
- /* Now, if insn's predicates don't allow offset operands, put them into
- pseudo regs. */
-
- if (! (*insn_data[icode].operand[2].predicate) (xop1, mode1)
- && mode1 != VOIDmode)
- xop1 = copy_to_mode_reg (mode1, xop1);
-
- pat = GEN_FCN (icode) (temp, xop0, xop1);
- if (pat)
- emit_insn (pat);
- }
- seq = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq, insn);
- if (! validate_change (insn, loc, temp, 0))
- abort ();
- return;
- }
- break;
-
-
- case CALL_PLACEHOLDER:
- validate_insns_of_varrefs (XEXP (x, 0));
- validate_insns_of_varrefs (XEXP (x, 1));
- validate_insns_of_varrefs (XEXP (x, 2));
- break;
-
- default:
- break;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- validate_operand_of_varrefs (insn, &XEXP (x, i));
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- validate_operand_of_varrefs (insn, &XVECEXP (x, i, j));
-}
-
-
-
-
-/*
- The following codes are invoked after the instantiation of pseuso registers.
-
- Reorder local variables to place a peudo register after buffers to avoid
- the corruption of local variables that could be used to further corrupt
- arbitrary memory locations.
-*/
-#if !defined(FRAME_GROWS_DOWNWARD) && defined(STACK_GROWS_DOWNWARD)
-static void push_frame PARAMS ((HOST_WIDE_INT var_size, HOST_WIDE_INT boundary));
-static void push_frame_in_decls PARAMS ((tree block, HOST_WIDE_INT push_size, HOST_WIDE_INT boundary));
-static void push_frame_in_args PARAMS ((tree parms, HOST_WIDE_INT push_size, HOST_WIDE_INT boundary));
-static void push_frame_of_insns PARAMS ((rtx insn, HOST_WIDE_INT push_size, HOST_WIDE_INT boundary));
-static void push_frame_in_operand PARAMS ((rtx insn, rtx orig, HOST_WIDE_INT push_size, HOST_WIDE_INT boundary));
-static void push_frame_of_reg_equiv_memory_loc PARAMS ((HOST_WIDE_INT push_size, HOST_WIDE_INT boundary));
-static void push_frame_of_reg_equiv_constant PARAMS ((HOST_WIDE_INT push_size, HOST_WIDE_INT boundary));
-static void reset_used_flags_for_push_frame PARAMS ((void));
-static int check_out_of_frame_access PARAMS ((rtx insn, HOST_WIDE_INT boundary));
-static int check_out_of_frame_access_in_operand PARAMS ((rtx, HOST_WIDE_INT boundary));
-#endif
-
-rtx
-assign_stack_local_for_pseudo_reg (mode, size, align)
- enum machine_mode mode;
- HOST_WIDE_INT size;
- int align;
-{
-#if defined(FRAME_GROWS_DOWNWARD) || !defined(STACK_GROWS_DOWNWARD)
- return assign_stack_local (mode, size, align);
-#else
- tree blocks = DECL_INITIAL (current_function_decl);
- rtx new;
- HOST_WIDE_INT saved_frame_offset, units_per_push, starting_frame;
- int first_call_from_purge_addressof, first_call_from_global_alloc;
-
- if (! flag_propolice_protection
- || size == 0
- || ! blocks
- || current_function_is_inlinable
- || ! search_string_from_argsandvars (1)
- || current_function_contains_functions)
- return assign_stack_local (mode, size, align);
-
- first_call_from_purge_addressof = !push_frame_offset && !cse_not_expected;
- first_call_from_global_alloc = !saved_cse_not_expected && cse_not_expected;
- saved_cse_not_expected = cse_not_expected;
-
- starting_frame = (STARTING_FRAME_OFFSET)?STARTING_FRAME_OFFSET:BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- units_per_push = MAX(BIGGEST_ALIGNMENT / BITS_PER_UNIT,
- GET_MODE_SIZE (mode));
-
- if (first_call_from_purge_addressof)
- {
- push_frame_offset = push_allocated_offset;
- if (check_out_of_frame_access (get_insns (), starting_frame))
- {
- /* if there is an access beyond frame, push dummy region to seperate
- the address of instantiated variables */
- push_frame (GET_MODE_SIZE (DImode), 0);
- assign_stack_local (BLKmode, GET_MODE_SIZE (DImode), -1);
- }
- }
-
- if (first_call_from_global_alloc)
- {
- push_frame_offset = push_allocated_offset = 0;
- if (check_out_of_frame_access (get_insns (), starting_frame))
- {
- if (STARTING_FRAME_OFFSET)
- {
- /* if there is an access beyond frame, push dummy region
- to seperate the address of instantiated variables */
- push_frame (GET_MODE_SIZE (DImode), 0);
- assign_stack_local (BLKmode, GET_MODE_SIZE (DImode), -1);
- }
- else
- push_allocated_offset = starting_frame;
- }
- }
-
- saved_frame_offset = frame_offset;
- frame_offset = push_frame_offset;
-
- new = assign_stack_local (mode, size, align);
-
- push_frame_offset = frame_offset;
- frame_offset = saved_frame_offset;
-
- if (push_frame_offset > push_allocated_offset)
- {
- push_frame (units_per_push, push_allocated_offset + STARTING_FRAME_OFFSET);
-
- assign_stack_local (BLKmode, units_per_push, -1);
- push_allocated_offset += units_per_push;
- }
-
- /* At the second call from global alloc, alpha push frame and assign
- a local variable to the top of the stack */
- if (first_call_from_global_alloc && STARTING_FRAME_OFFSET == 0)
- push_frame_offset = push_allocated_offset = 0;
-
- return new;
-#endif
-}
-
-
-#if !defined(FRAME_GROWS_DOWNWARD) && defined(STACK_GROWS_DOWNWARD)
-/*
- push frame infomation for instantiating pseudo register at the top of stack.
- This is only for the "frame grows upward", it means FRAME_GROWS_DOWNWARD is
- not defined.
-
- It is called by purge_addressof function and global_alloc (or reload)
- function.
-*/
-static void
-push_frame (var_size, boundary)
- HOST_WIDE_INT var_size, boundary;
-{
- reset_used_flags_for_push_frame();
-
- /* scan all declarations of variables and fix the offset address of the variable based on the frame pointer */
- push_frame_in_decls (DECL_INITIAL (current_function_decl), var_size, boundary);
-
- /* scan all argument variable and fix the offset address based on the frame pointer */
- push_frame_in_args (DECL_ARGUMENTS (current_function_decl), var_size, boundary);
-
- /* scan all operands of all insns and fix the offset address based on the frame pointer */
- push_frame_of_insns (get_insns (), var_size, boundary);
-
- /* scan all reg_equiv_memory_loc and reg_equiv_constant*/
- push_frame_of_reg_equiv_memory_loc (var_size, boundary);
- push_frame_of_reg_equiv_constant (var_size, boundary);
-
- reset_used_flags_for_push_frame();
-}
-
-static void
-reset_used_flags_for_push_frame()
-{
- int i;
- extern rtx *reg_equiv_memory_loc;
- extern rtx *reg_equiv_constant;
-
- /* Clear all the USED bits in operands of all insns and declarations of local vars */
- reset_used_flags_for_decls (DECL_INITIAL (current_function_decl));
- reset_used_flags_for_insns (get_insns ());
-
-
- /* The following codes are processed if the push_frame is called from
- global_alloc (or reload) function */
- if (reg_equiv_memory_loc == 0) return;
-
- for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
- if (reg_equiv_memory_loc[i])
- {
- rtx x = reg_equiv_memory_loc[i];
-
- if (GET_CODE (x) == MEM
- && GET_CODE (XEXP (x, 0)) == PLUS
- && AUTO_BASEPTR (XEXP (x, 0)) == frame_pointer_rtx)
- {
- /* reset */
- XEXP (x, 0)->used = 0;
- }
- }
-
-
- if (reg_equiv_constant == 0) return;
-
- for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
- if (reg_equiv_constant[i])
- {
- rtx x = reg_equiv_constant[i];
-
- if (GET_CODE (x) == PLUS
- && AUTO_BASEPTR (x) == frame_pointer_rtx)
- {
- /* reset */
- x->used = 0;
- }
- }
-}
-
-static void
-push_frame_in_decls (block, push_size, boundary)
- tree block;
- HOST_WIDE_INT push_size, boundary;
-{
- tree types;
- HOST_WIDE_INT offset;
- rtx home;
-
- while (block && TREE_CODE(block)==BLOCK)
- {
- types = BLOCK_VARS(block);
-
- while (types)
- {
- /* skip the declaration that refers an external variable and
- also skip an global variable */
- if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types))
- {
-
- if (!DECL_RTL_SET_P (types)) goto next;
- home = DECL_RTL (types);
-
- /* process for static local variable */
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
- goto next;
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == REG)
- {
- if (XEXP (home, 0) != frame_pointer_rtx
- || boundary != 0)
- goto next;
-
- XEXP (home, 0) = plus_constant (frame_pointer_rtx,
- push_size);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == MEM)
- {
-
- /* process for dynamically allocated aray */
- home = XEXP (home, 0);
- }
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
- {
- offset = AUTO_OFFSET(XEXP (home, 0));
-
- if (! XEXP (home, 0)->used
- && offset >= boundary)
- {
- offset += push_size;
- XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
- }
-
- }
- next:
- types = TREE_CHAIN(types);
- }
-
- push_frame_in_decls (BLOCK_SUBBLOCKS (block), push_size, boundary);
- block = BLOCK_CHAIN (block);
- }
-}
-
-
-static void
-push_frame_in_args (parms, push_size, boundary)
- tree parms;
- HOST_WIDE_INT push_size, boundary;
-{
- rtx home;
- HOST_WIDE_INT offset;
-
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
- {
- if (PARM_PASSED_IN_MEMORY (parms) && DECL_NAME (parms))
- {
- home = DECL_INCOMING_RTL (parms);
- offset = AUTO_OFFSET(XEXP (home, 0));
-
- if (XEXP (home, 0)->used || offset < boundary) continue;
-
- /* the operand related to the sweep variable */
- if (AUTO_BASEPTR (XEXP (home, 0)) == frame_pointer_rtx)
- {
- offset += push_size;
- XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset);
-
- /* mark */
- XEXP (home, 0)->used = 1;
- }
- }
- }
-}
-
-
-static int insn_pushed;
-static int *fp_equiv = 0;
-
-static void
-push_frame_of_insns (insn, push_size, boundary)
- rtx insn;
- HOST_WIDE_INT push_size, boundary;
-{
- /* init fp_equiv */
- fp_equiv = (int *) xcalloc (max_reg_num (), sizeof (int));
-
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- insn_pushed = FALSE; debuginsn = insn;
- push_frame_in_operand (insn, PATTERN (insn), push_size, boundary);
-
- if (insn_pushed
- /* skip if it is called from purge_address_of */
- && cse_not_expected)
- {
- rtx after = insn;
- rtx seq = split_insns (PATTERN (insn), insn);
-
- if (seq && GET_CODE (seq) == SEQUENCE)
- {
- register int i;
-
- /* replace the pattern of the insn */
- PATTERN (insn) = PATTERN (XVECEXP (seq, 0, 0));
-
- if (XVECLEN (seq, 0) == 2)
- {
- rtx pattern = PATTERN (XVECEXP (seq, 0, 1));
-
- if (GET_CODE (pattern) == SET
- && GET_CODE (XEXP (pattern, 0)) == REG
- && GET_CODE (XEXP (pattern, 1)) == PLUS
- && XEXP (pattern, 0) == XEXP (XEXP (pattern, 1), 0)
- && CONSTANT_P (XEXP (XEXP (pattern, 1), 1)))
- {
- rtx offset = XEXP (XEXP (pattern, 1), 1);
- fp_equiv[REGNO (XEXP (pattern, 0))] = INTVAL (offset);
- goto next;
- }
- }
-
- for (i = 1; i < XVECLEN (seq, 0); i++)
- {
- rtx insn = XVECEXP (seq, 0, i);
- add_insn_after (insn, after);
- after = insn;
- }
-
- /* Recursively call try_split for each new insn created */
- insn = NEXT_INSN (insn);
- for (i = 1; i < XVECLEN (seq, 0); i++, insn = NEXT_INSN (insn))
- insn = try_split (PATTERN (insn), insn, 1);
- }
- }
-
- next:
- /* push frame in NOTE */
- push_frame_in_operand (insn, REG_NOTES (insn), push_size, boundary);
-
- /* push frame in CALL EXPR_LIST */
- if (GET_CODE (insn) == CALL_INSN)
- push_frame_in_operand (insn, CALL_INSN_FUNCTION_USAGE (insn), push_size, boundary);
- }
-
- /* Clean up. */
- free (fp_equiv);
-}
-
-
-static void
-push_frame_in_operand (insn, orig, push_size, boundary)
- rtx insn, orig;
- HOST_WIDE_INT push_size, boundary;
-{
- register rtx x = orig;
- register enum rtx_code code;
- int i, j;
- HOST_WIDE_INT offset;
- const char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- case REG:
- case ADDRESSOF:
- case USE:
- return;
-
- case SET:
- /*
- skip setjmp setup insn and setjmp restore insn
- alpha case:
- (set (MEM (reg:SI xx)) (frame_pointer_rtx)))
- (set (frame_pointer_rtx) (REG))
- */
- if (GET_CODE (XEXP (x, 0)) == MEM
- && XEXP (x, 1) == frame_pointer_rtx)
- return;
- if (XEXP (x, 0) == frame_pointer_rtx
- && GET_CODE (XEXP (x, 1)) == REG)
- return;
-
- /*
- powerpc case: restores setjmp address
- (set (frame_pointer_rtx) (plus frame_pointer_rtx const_int -n))
- or
- (set (reg) (plus frame_pointer_rtx const_int -n))
- (set (frame_pointer_rtx) (reg))
- */
- if (GET_CODE (XEXP (x, 0)) == REG
- && GET_CODE (XEXP (x, 1)) == PLUS
- && XEXP (XEXP (x, 1), 0) == frame_pointer_rtx
- && CONSTANT_P (XEXP (XEXP (x, 1), 1))
- && INTVAL (XEXP (XEXP (x, 1), 1)) < 0)
- {
- x = XEXP (x, 1);
- offset = AUTO_OFFSET(x);
- if (x->used || abs (offset) < boundary)
- return;
-
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset - push_size);
- x->used = 1; insn_pushed = TRUE;
- return;
- }
-
- /* reset fp_equiv register */
- else if (GET_CODE (XEXP (x, 0)) == REG
- && fp_equiv[REGNO (XEXP (x, 0))])
- fp_equiv[REGNO (XEXP (x, 0))] = 0;
-
- /* propagete fp_equiv register */
- else if (GET_CODE (XEXP (x, 0)) == REG
- && GET_CODE (XEXP (x, 1)) == REG
- && fp_equiv[REGNO (XEXP (x, 1))])
- if (REGNO (XEXP (x, 0)) <= LAST_VIRTUAL_REGISTER
- || reg_renumber[REGNO (XEXP (x, 0))] > 0)
- fp_equiv[REGNO (XEXP (x, 0))] = fp_equiv[REGNO (XEXP (x, 1))];
- break;
-
- case MEM:
- if (XEXP (x, 0) == frame_pointer_rtx
- && boundary == 0)
- {
- XEXP (x, 0) = plus_constant (frame_pointer_rtx, push_size);
- XEXP (x, 0)->used = 1; insn_pushed = TRUE;
- return;
- }
- break;
-
- case PLUS:
- offset = AUTO_OFFSET(x);
-
- /* Handle special case of frame register plus constant. */
- if (CONSTANT_P (XEXP (x, 1))
- && XEXP (x, 0) == frame_pointer_rtx)
- {
- if (x->used || offset < boundary)
- return;
-
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset + push_size);
- x->used = 1; insn_pushed = TRUE;
-
- return;
- }
- /*
- Handle alpha case:
- (plus:SI (subreg:SI (reg:DI 63 FP) 0) (const_int 64 [0x40]))
- */
- if (CONSTANT_P (XEXP (x, 1))
- && GET_CODE (XEXP (x, 0)) == SUBREG
- && SUBREG_REG (XEXP (x, 0)) == frame_pointer_rtx)
- {
- if (x->used || offset < boundary)
- return;
-
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset + push_size);
- x->used = 1; insn_pushed = TRUE;
-
- return;
- }
- /*
- Handle powerpc case:
- (set (reg x) (plus fp const))
- (set (.....) (... (plus (reg x) (const B))))
- */
- else if (CONSTANT_P (XEXP (x, 1))
- && GET_CODE (XEXP (x, 0)) == REG
- && fp_equiv[REGNO (XEXP (x, 0))])
- {
- if (x->used) return;
-
- offset += fp_equiv[REGNO (XEXP (x, 0))];
-
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
- x->used = 1; insn_pushed = TRUE;
-
- return;
- }
- /*
- Handle special case of frame register plus reg (constant).
- (set (reg x) (const B))
- (set (....) (...(plus fp (reg x))))
- */
- else if (XEXP (x, 0) == frame_pointer_rtx
- && GET_CODE (XEXP (x, 1)) == REG
- && PREV_INSN (insn)
- && PATTERN (PREV_INSN (insn))
- && SET_DEST (PATTERN (PREV_INSN (insn))) == XEXP (x, 1)
- && CONSTANT_P (SET_SRC (PATTERN (PREV_INSN (insn)))))
- {
- HOST_WIDE_INT offset = INTVAL (SET_SRC (PATTERN (PREV_INSN (insn))));
-
- if (x->used || offset < boundary)
- return;
-
- SET_SRC (PATTERN (PREV_INSN (insn)))
- = gen_rtx_CONST_INT (VOIDmode, offset + push_size);
- x->used = 1;
- XEXP (x, 1)->used = 1;
-
- return;
- }
- /* Handle special case of frame register plus reg (used). */
- else if (XEXP (x, 0) == frame_pointer_rtx
- && XEXP (x, 1)->used)
- {
- x->used = 1;
- return;
- }
- /*
- process further subtree:
- Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
- (const_int 5))
- */
- break;
-
- case CALL_PLACEHOLDER:
- push_frame_of_insns (XEXP (x, 0), push_size, boundary);
- push_frame_of_insns (XEXP (x, 1), push_size, boundary);
- push_frame_of_insns (XEXP (x, 2), push_size, boundary);
- break;
-
- default:
- break;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- {
- if (XEXP (x, i) == frame_pointer_rtx && boundary == 0)
- fatal_insn ("push_frame_in_operand", insn);
- push_frame_in_operand (insn, XEXP (x, i), push_size, boundary);
- }
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- push_frame_in_operand (insn, XVECEXP (x, i, j), push_size, boundary);
-}
-
-static void
-push_frame_of_reg_equiv_memory_loc (push_size, boundary)
- HOST_WIDE_INT push_size, boundary;
-{
- int i;
- extern rtx *reg_equiv_memory_loc;
-
- /* This function is processed if the push_frame is called from
- global_alloc (or reload) function */
- if (reg_equiv_memory_loc == 0) return;
-
- for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
- if (reg_equiv_memory_loc[i])
- {
- rtx x = reg_equiv_memory_loc[i];
- int offset;
-
- if (GET_CODE (x) == MEM
- && GET_CODE (XEXP (x, 0)) == PLUS
- && XEXP (XEXP (x, 0), 0) == frame_pointer_rtx)
- {
- offset = AUTO_OFFSET(XEXP (x, 0));
-
- if (! XEXP (x, 0)->used
- && offset >= boundary)
- {
- offset += push_size;
- XEXP (XEXP (x, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset);
-
- /* mark */
- XEXP (x, 0)->used = 1;
- }
- }
- else if (GET_CODE (x) == MEM
- && XEXP (x, 0) == frame_pointer_rtx
- && boundary == 0)
- {
- XEXP (x, 0) = plus_constant (frame_pointer_rtx, push_size);
- XEXP (x, 0)->used = 1; insn_pushed = TRUE;
- }
- }
-}
-
-static void
-push_frame_of_reg_equiv_constant (push_size, boundary)
- HOST_WIDE_INT push_size, boundary;
-{
- int i;
- extern rtx *reg_equiv_constant;
-
- /* This function is processed if the push_frame is called from
- global_alloc (or reload) function */
- if (reg_equiv_constant == 0) return;
-
- for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
- if (reg_equiv_constant[i])
- {
- rtx x = reg_equiv_constant[i];
- int offset;
-
- if (GET_CODE (x) == PLUS
- && XEXP (x, 0) == frame_pointer_rtx)
- {
- offset = AUTO_OFFSET(x);
-
- if (! x->used
- && offset >= boundary)
- {
- offset += push_size;
- XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
-
- /* mark */
- x->used = 1;
- }
- }
- else if (x == frame_pointer_rtx
- && boundary == 0)
- {
- reg_equiv_constant[i]
- = plus_constant (frame_pointer_rtx, push_size);
- reg_equiv_constant[i]->used = 1; insn_pushed = TRUE;
- }
- }
-}
-
-static int
-check_out_of_frame_access (insn, boundary)
- rtx insn;
- HOST_WIDE_INT boundary;
-{
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- if (check_out_of_frame_access_in_operand (PATTERN (insn), boundary))
- return TRUE;
- }
- return FALSE;
-}
-
-
-static int
-check_out_of_frame_access_in_operand (orig, boundary)
- rtx orig;
- HOST_WIDE_INT boundary;
-{
- register rtx x = orig;
- register enum rtx_code code;
- int i, j;
- const char *fmt;
-
- if (x == 0)
- return FALSE;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- case REG:
- case ADDRESSOF:
- return FALSE;
-
- case MEM:
- if (XEXP (x, 0) == frame_pointer_rtx)
- if (0 < boundary) return TRUE;
- break;
-
- case PLUS:
- /* Handle special case of frame register plus constant. */
- if (CONSTANT_P (XEXP (x, 1))
- && XEXP (x, 0) == frame_pointer_rtx)
- {
- if (0 <= AUTO_OFFSET(x)
- && AUTO_OFFSET(x) < boundary) return TRUE;
- return FALSE;
- }
- /*
- process further subtree:
- Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
- (const_int 5))
- */
- break;
-
- case CALL_PLACEHOLDER:
- if (check_out_of_frame_access (XEXP (x, 0), boundary)) return TRUE;
- if (check_out_of_frame_access (XEXP (x, 1), boundary)) return TRUE;
- if (check_out_of_frame_access (XEXP (x, 2), boundary)) return TRUE;
- break;
-
- default:
- break;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- {
- if (check_out_of_frame_access_in_operand (XEXP (x, i), boundary))
- return TRUE;
- }
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- if (check_out_of_frame_access_in_operand (XVECEXP (x, i, j), boundary))
- return TRUE;
-
- return FALSE;
-}
-#endif
diff --git a/sys-devel/gcc/files/3.2.2/protector.h b/sys-devel/gcc/files/3.2.2/protector.h
deleted file mode 100644
index 341b50907a2e..000000000000
--- a/sys-devel/gcc/files/3.2.2/protector.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* RTL buffer overflow protection function for GNU C compiler
- Copyright (C) 1987, 88, 89, 92-7, 1998 Free Software Foundation, 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 2, 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.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
-
-
-/* declaration of GUARD variable */
-#define GUARD_m Pmode
-#define UNITS_PER_GUARD MAX(BIGGEST_ALIGNMENT / BITS_PER_UNIT, GET_MODE_SIZE (GUARD_m))
-
-#ifndef L_stack_smash_handler
-
-/* insert a guard variable before a character buffer and change the order
- of pointer variables, character buffers and pointer arguments */
-
-extern void prepare_stack_protection PARAMS ((int inlinable));
-
-#ifdef TREE_CODE
-/* search a character array from the specified type tree */
-
-extern int search_string_def PARAMS ((tree names));
-#endif
-
-/* examine whether the input contains frame pointer addressing */
-
-extern int contains_fp PARAMS ((rtx op));
-
-/* allocate a local variable in the stack area before character buffers
- to avoid the corruption of it */
-
-extern rtx assign_stack_local_for_pseudo_reg PARAMS ((enum machine_mode, HOST_WIDE_INT, int));
-
-#endif
diff --git a/sys-devel/gcc/files/3.2.2/protector.patch b/sys-devel/gcc/files/3.2.2/protector.patch
deleted file mode 100644
index cf2982f1165a..000000000000
--- a/sys-devel/gcc/files/3.2.2/protector.patch
+++ /dev/null
@@ -1,1078 +0,0 @@
-Index: gcc/Makefile.in
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/Makefile.in,v
-retrieving revision 1.1.1.12
-retrieving revision 1.1.1.12.2.1
-diff -c -3 -p -r1.1.1.12 -r1.1.1.12.2.1
-*** gcc/Makefile.in 2003/02/19 07:11:06 1.1.1.12
---- gcc/Makefile.in 2003/02/26 08:01:00 1.1.1.12.2.1
-*************** OBJS = alias.o bb-reorder.o bitmap.o bui
-*** 728,734 ****
- sibcall.o simplify-rtx.o ssa.o ssa-ccp.o ssa-dce.o stmt.o \
- stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-dump.o \
- tree-inline.o unroll.o varasm.o varray.o version.o vmsdbgout.o xcoffout.o \
-! $(GGC) $(out_object_file) $(EXTRA_OBJS)
-
- BACKEND = main.o libbackend.a
-
---- 728,734 ----
- sibcall.o simplify-rtx.o ssa.o ssa-ccp.o ssa-dce.o stmt.o \
- stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-dump.o \
- tree-inline.o unroll.o varasm.o varray.o version.o vmsdbgout.o xcoffout.o \
-! protector.o $(GGC) $(out_object_file) $(EXTRA_OBJS)
-
- BACKEND = main.o libbackend.a
-
-*************** LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _
-*** 769,775 ****
-
- LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \
- _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \
-! _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
-
- # Defined in libgcc2.c, included only in the static library.
- LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp
---- 769,775 ----
-
- LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \
- _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \
-! _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors _stack_smash_handler
-
- # Defined in libgcc2.c, included only in the static library.
- LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp
-Index: gcc/calls.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/calls.c,v
-retrieving revision 1.1.1.9
-retrieving revision 1.1.1.9.2.1
-diff -c -3 -p -r1.1.1.9 -r1.1.1.9.2.1
-*** gcc/calls.c 2003/02/19 07:11:08 1.1.1.9
---- gcc/calls.c 2003/02/26 08:01:00 1.1.1.9.2.1
-*************** expand_call (exp, target, ignore)
-*** 2300,2306 ****
- /* For variable-sized objects, we must be called with a target
- specified. If we were to allocate space on the stack here,
- we would have no way of knowing when to free it. */
-! rtx d = assign_temp (TREE_TYPE (exp), 1, 1, 1);
-
- mark_temp_addr_taken (d);
- structure_value_addr = XEXP (d, 0);
---- 2300,2306 ----
- /* For variable-sized objects, we must be called with a target
- specified. If we were to allocate space on the stack here,
- we would have no way of knowing when to free it. */
-! rtx d = assign_temp (TREE_TYPE (exp), 5, 1, 1);
-
- mark_temp_addr_taken (d);
- structure_value_addr = XEXP (d, 0);
-Index: gcc/combine.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/combine.c,v
-retrieving revision 1.1.1.9
-retrieving revision 1.1.1.9.2.2
-diff -c -3 -p -r1.1.1.9 -r1.1.1.9.2.2
-*** gcc/combine.c 2003/02/19 07:11:08 1.1.1.9
---- gcc/combine.c 2003/03/11 05:51:10 1.1.1.9.2.2
-*************** combine_simplify_rtx (x, op0_mode, last,
-*** 3819,3825 ****
- rtx inner_op0 = XEXP (XEXP (x, 0), 1);
- rtx inner_op1 = XEXP (x, 1);
- rtx inner;
-!
- /* Make sure we pass the constant operand if any as the second
- one if this is a commutative operation. */
- if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c')
---- 3819,3835 ----
- rtx inner_op0 = XEXP (XEXP (x, 0), 1);
- rtx inner_op1 = XEXP (x, 1);
- rtx inner;
-!
-! #ifndef FRAME_GROWS_DOWNWARD
-! if (flag_propolice_protection
-! && code == PLUS
-! && other == frame_pointer_rtx
-! && GET_CODE (inner_op0) == CONST_INT
-! && GET_CODE (inner_op1) == CONST_INT
-! && INTVAL (inner_op0) > 0
-! && INTVAL (inner_op0) + INTVAL (inner_op1) <= 0)
-! return x;
-! #endif
- /* Make sure we pass the constant operand if any as the second
- one if this is a commutative operation. */
- if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c')
-*************** combine_simplify_rtx (x, op0_mode, last,
-*** 4193,4198 ****
---- 4203,4213 ----
- they are now checked elsewhere. */
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
-+ #ifndef FRAME_GROWS_DOWNWARD
-+ if (! (flag_propolice_protection
-+ && XEXP (XEXP (x, 0), 0) == frame_pointer_rtx
-+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT))
-+ #endif
- return gen_binary (PLUS, mode,
- gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0),
- XEXP (x, 1)),
-Index: gcc/cse.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/cse.c,v
-retrieving revision 1.1.1.6
-retrieving revision 1.1.1.6.8.2
-diff -c -3 -p -r1.1.1.6 -r1.1.1.6.8.2
-*** gcc/cse.c 2002/07/29 05:12:14 1.1.1.6
---- gcc/cse.c 2003/02/28 06:27:19 1.1.1.6.8.2
-*************** fold_rtx (x, insn)
-*** 4274,4280 ****
-
- if (new_const == 0)
- break;
-!
- /* If we are associating shift operations, don't let this
- produce a shift of the size of the object or larger.
- This could occur when we follow a sign-extend by a right
---- 4274,4287 ----
-
- if (new_const == 0)
- break;
-! #ifndef FRAME_GROWS_DOWNWARD
-! if (flag_propolice_protection
-! && GET_CODE (y) == PLUS
-! && XEXP (y, 0) == frame_pointer_rtx
-! && INTVAL (inner_const) > 0
-! && INTVAL (new_const) <= 0)
-! break;
-! #endif
- /* If we are associating shift operations, don't let this
- produce a shift of the size of the object or larger.
- This could occur when we follow a sign-extend by a right
-*************** cse_insn (insn, libcall_insn)
-*** 4801,4806 ****
---- 4808,4820 ----
- if (SET_DEST (x) == pc_rtx
- && GET_CODE (SET_SRC (x)) == LABEL_REF)
- ;
-+ /* cut the reg propagation of stack-protected argument */
-+ else if (x->volatil) {
-+ rtx x1 = SET_DEST (x);
-+ if (GET_CODE (x1) == SUBREG && GET_CODE (SUBREG_REG (x1)) == REG)
-+ x1 = SUBREG_REG (x1);
-+ make_new_qty (REGNO (x1), GET_MODE (x1));
-+ }
-
- /* Don't count call-insns, (set (reg 0) (call ...)), as a set.
- The hard function value register is used only once, to copy to
-Index: gcc/explow.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/explow.c,v
-retrieving revision 1.1.1.5
-retrieving revision 1.1.1.5.4.1
-diff -c -3 -p -r1.1.1.5 -r1.1.1.5.4.1
-*** gcc/explow.c 2002/12/18 00:55:39 1.1.1.5
---- gcc/explow.c 2003/02/26 08:01:01 1.1.1.5.4.1
-*************** plus_constant_wide (x, c)
-*** 82,88 ****
- rtx tem;
- int all_constant = 0;
-
-! if (c == 0)
- return x;
-
- restart:
---- 82,89 ----
- rtx tem;
- int all_constant = 0;
-
-! if (c == 0
-! && !(flag_propolice_protection && x == virtual_stack_vars_rtx))
- return x;
-
- restart:
-*************** plus_constant_wide (x, c)
-*** 183,189 ****
- break;
- }
-
-! if (c != 0)
- x = gen_rtx_PLUS (mode, x, GEN_INT (c));
-
- if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
---- 184,191 ----
- break;
- }
-
-! if (c != 0
-! || (flag_propolice_protection && x == virtual_stack_vars_rtx))
- x = gen_rtx_PLUS (mode, x, GEN_INT (c));
-
- if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
-*************** memory_address (mode, x)
-*** 526,531 ****
---- 528,548 ----
- in certain cases. This is not necessary since the code
- below can handle all possible cases, but machine-dependent
- transformations can make better code. */
-+ if (flag_propolice_protection)
-+ {
-+ #define FRAMEADDR_P(X) (GET_CODE (X) == PLUS \
-+ && XEXP (X, 0) == virtual_stack_vars_rtx \
-+ && GET_CODE (XEXP (X, 1)) == CONST_INT)
-+ rtx y;
-+ if (FRAMEADDR_P (x)) goto win;
-+ for (y=x; y!=0 && GET_CODE (y)==PLUS; y = XEXP (y, 0))
-+ {
-+ if (FRAMEADDR_P (XEXP (y, 0)))
-+ XEXP (y, 0) = force_reg (GET_MODE (XEXP (y, 0)), XEXP (y, 0));
-+ if (FRAMEADDR_P (XEXP (y, 1)))
-+ XEXP (y, 1) = force_reg (GET_MODE (XEXP (y, 1)), XEXP (y, 1));
-+ }
-+ }
- LEGITIMIZE_ADDRESS (x, oldx, mode, win);
-
- /* PLUS and MULT can appear in special ways
-Index: gcc/expr.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/expr.c,v
-retrieving revision 1.1.1.11
-retrieving revision 1.1.1.11.2.2
-diff -c -3 -p -r1.1.1.11 -r1.1.1.11.2.2
-*** gcc/expr.c 2003/02/19 07:11:13 1.1.1.11
---- gcc/expr.c 2003/04/07 02:36:16 1.1.1.11.2.2
-*************** Software Foundation, 59 Temple Place - S
-*** 45,50 ****
---- 45,51 ----
- #include "langhooks.h"
- #include "intl.h"
- #include "tm_p.h"
-+ #include "protector.h"
-
- /* Decide whether a function's arguments should be processed
- from first to last or from last to first.
-*************** move_by_pieces (to, from, len, align)
-*** 1448,1454 ****
-
- if (USE_LOAD_PRE_DECREMENT (mode) && data.reverse && ! data.autinc_from)
- {
-! data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
- data.autinc_from = 1;
- data.explicit_inc_from = -1;
- }
---- 1449,1455 ----
-
- if (USE_LOAD_PRE_DECREMENT (mode) && data.reverse && ! data.autinc_from)
- {
-! data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len-GET_MODE_SIZE (mode)));
- data.autinc_from = 1;
- data.explicit_inc_from = -1;
- }
-*************** move_by_pieces (to, from, len, align)
-*** 1462,1468 ****
- data.from_addr = copy_addr_to_reg (from_addr);
- if (USE_STORE_PRE_DECREMENT (mode) && data.reverse && ! data.autinc_to)
- {
-! data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
- data.autinc_to = 1;
- data.explicit_inc_to = -1;
- }
---- 1463,1469 ----
- data.from_addr = copy_addr_to_reg (from_addr);
- if (USE_STORE_PRE_DECREMENT (mode) && data.reverse && ! data.autinc_to)
- {
-! data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len-GET_MODE_SIZE (mode)));
- data.autinc_to = 1;
- data.explicit_inc_to = -1;
- }
-*************** move_by_pieces_1 (genfun, mode, data)
-*** 1579,1589 ****
- from1 = adjust_address (data->from, mode, data->offset);
-
- if (HAVE_PRE_DECREMENT && data->explicit_inc_to < 0)
-! emit_insn (gen_add2_insn (data->to_addr,
-! GEN_INT (-(HOST_WIDE_INT)size)));
- if (HAVE_PRE_DECREMENT && data->explicit_inc_from < 0)
-! emit_insn (gen_add2_insn (data->from_addr,
-! GEN_INT (-(HOST_WIDE_INT)size)));
-
- if (data->to)
- emit_insn ((*genfun) (to1, from1));
---- 1580,1592 ----
- from1 = adjust_address (data->from, mode, data->offset);
-
- if (HAVE_PRE_DECREMENT && data->explicit_inc_to < 0)
-! if (data->explicit_inc_to < -1)
-! emit_insn (gen_add2_insn (data->to_addr,
-! GEN_INT (-(HOST_WIDE_INT)size)));
- if (HAVE_PRE_DECREMENT && data->explicit_inc_from < 0)
-! if (data->explicit_inc_from < -1)
-! emit_insn (gen_add2_insn (data->from_addr,
-! GEN_INT (-(HOST_WIDE_INT)size)));
-
- if (data->to)
- emit_insn ((*genfun) (to1, from1));
-*************** store_by_pieces_1 (data, align)
-*** 2480,2486 ****
-
- if (USE_STORE_PRE_DECREMENT (mode) && data->reverse && ! data->autinc_to)
- {
-! data->to_addr = copy_addr_to_reg (plus_constant (to_addr, data->len));
- data->autinc_to = 1;
- data->explicit_inc_to = -1;
- }
---- 2483,2489 ----
-
- if (USE_STORE_PRE_DECREMENT (mode) && data->reverse && ! data->autinc_to)
- {
-! data->to_addr = copy_addr_to_reg (plus_constant (to_addr, data->len-GET_MODE_SIZE (mode)));
- data->autinc_to = 1;
- data->explicit_inc_to = -1;
- }
-*************** store_by_pieces_2 (genfun, mode, data)
-*** 2551,2558 ****
- to1 = adjust_address (data->to, mode, data->offset);
-
- if (HAVE_PRE_DECREMENT && data->explicit_inc_to < 0)
-! emit_insn (gen_add2_insn (data->to_addr,
-! GEN_INT (-(HOST_WIDE_INT) size)));
-
- cst = (*data->constfun) (data->constfundata, data->offset, mode);
- emit_insn ((*genfun) (to1, cst));
---- 2554,2562 ----
- to1 = adjust_address (data->to, mode, data->offset);
-
- if (HAVE_PRE_DECREMENT && data->explicit_inc_to < 0)
-! if (data->explicit_inc_to < -1)
-! emit_insn (gen_add2_insn (data->to_addr,
-! GEN_INT (-(HOST_WIDE_INT) size)));
-
- cst = (*data->constfun) (data->constfundata, data->offset, mode);
- emit_insn ((*genfun) (to1, cst));
-*************** force_operand (value, target)
-*** 5474,5480 ****
- && GET_CODE (XEXP (value, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
- && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
-! && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER)
- {
- rtx temp = expand_simple_binop (GET_MODE (value), code,
- XEXP (XEXP (value, 0), 0), op2,
---- 5478,5486 ----
- && GET_CODE (XEXP (value, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
- && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
-! && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER
-! && (!flag_propolice_protection
-! || XEXP (XEXP (value, 0), 0) != virtual_stack_vars_rtx))
- {
- rtx temp = expand_simple_binop (GET_MODE (value), code,
- XEXP (XEXP (value, 0), 0), op2,
-*************** expand_expr (exp, target, tmode, modifie
-*** 7614,7620 ****
- /* If adding to a sum including a constant,
- associate it to put the constant outside. */
- if (GET_CODE (op1) == PLUS
-! && CONSTANT_P (XEXP (op1, 1)))
- {
- rtx constant_term = const0_rtx;
-
---- 7620,7627 ----
- /* If adding to a sum including a constant,
- associate it to put the constant outside. */
- if (GET_CODE (op1) == PLUS
-! && CONSTANT_P (XEXP (op1, 1))
-! && !(flag_propolice_protection && (contains_fp (op0) || contains_fp (op1))))
- {
- rtx constant_term = const0_rtx;
-
-Index: gcc/flags.h
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/flags.h,v
-retrieving revision 1.1.1.5
-retrieving revision 1.1.1.5.4.1
-diff -c -3 -p -r1.1.1.5 -r1.1.1.5.4.1
-*** gcc/flags.h 2002/12/18 00:55:41 1.1.1.5
---- gcc/flags.h 2003/02/26 08:01:02 1.1.1.5.4.1
-*************** extern int flag_detailed_statistics;
-*** 645,648 ****
---- 645,656 ----
- /* Nonzero means enable synchronous exceptions for non-call instructions. */
- extern int flag_non_call_exceptions;
-
-+ /* Nonzero means use propolice as a stack protection method */
-+
-+ extern int flag_propolice_protection;
-+
-+ /* Warn when not issuing stack smashing protection for some reason */
-+
-+ extern int warn_stack_protector;
-+
- #endif /* ! GCC_FLAGS_H */
-Index: gcc/function.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/function.c,v
-retrieving revision 1.1.1.9
-retrieving revision 1.1.1.9.2.1
-diff -c -3 -p -r1.1.1.9 -r1.1.1.9.2.1
-*** gcc/function.c 2003/02/19 07:11:14 1.1.1.9
---- gcc/function.c 2003/02/26 08:01:02 1.1.1.9.2.1
-*************** Software Foundation, 59 Temple Place - S
-*** 60,65 ****
---- 60,66 ----
- #include "tm_p.h"
- #include "integrate.h"
- #include "langhooks.h"
-+ #include "protector.h"
-
- #ifndef TRAMPOLINE_ALIGNMENT
- #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
-*************** static varray_type epilogue;
-*** 156,161 ****
---- 157,166 ----
- /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
- in this function. */
- static varray_type sibcall_epilogue;
-+
-+ /* Current boundary mark for character arrays. */
-+ int temp_boundary_mark = 0;
-+
-
- /* In order to evaluate some expressions, such as function calls returning
- structures in memory, we need to temporarily allocate stack locations.
-*************** struct temp_slot
-*** 209,214 ****
---- 214,221 ----
- /* The size of the slot, including extra space for alignment. This
- info is for combine_temp_slots. */
- HOST_WIDE_INT full_size;
-+ /* Boundary mark of a character array and the others. This info is for propolice */
-+ int boundary_mark;
- };
-
- /* This structure is used to record MEMs or pseudos used to replace VAR, any
-*************** assign_stack_local (mode, size, align)
-*** 655,660 ****
---- 662,668 ----
- whose lifetime is controlled by CLEANUP_POINT_EXPRs. KEEP is 3
- if we are to allocate something at an inner level to be treated as
- a variable in the block (e.g., a SAVE_EXPR).
-+ KEEP is 5 if we allocate a place to return structure.
-
- TYPE is the type that will be used for the stack slot. */
-
-*************** assign_stack_temp_for_type (mode, size,
-*** 668,673 ****
---- 676,683 ----
- unsigned int align;
- struct temp_slot *p, *best_p = 0;
- rtx slot;
-+ int char_array = (flag_propolice_protection
-+ && keep == 1 && search_string_def (type));
-
- /* If SIZE is -1 it means that somebody tried to allocate a temporary
- of a variable size. */
-*************** assign_stack_temp_for_type (mode, size,
-*** 693,699 ****
- && ! p->in_use
- && objects_must_conflict_p (p->type, type)
- && (best_p == 0 || best_p->size > p->size
-! || (best_p->size == p->size && best_p->align > p->align)))
- {
- if (p->align == align && p->size == size)
- {
---- 703,710 ----
- && ! p->in_use
- && objects_must_conflict_p (p->type, type)
- && (best_p == 0 || best_p->size > p->size
-! || (best_p->size == p->size && best_p->align > p->align))
-! && (! char_array || p->boundary_mark != 0))
- {
- if (p->align == align && p->size == size)
- {
-*************** assign_stack_temp_for_type (mode, size,
-*** 728,733 ****
---- 739,745 ----
- p->address = 0;
- p->rtl_expr = 0;
- p->type = best_p->type;
-+ p->boundary_mark = best_p->boundary_mark;
- p->next = temp_slots;
- temp_slots = p;
-
-*************** assign_stack_temp_for_type (mode, size,
-*** 788,793 ****
---- 800,806 ----
- p->full_size = frame_offset - frame_offset_old;
- #endif
- p->address = 0;
-+ p->boundary_mark = char_array?++temp_boundary_mark:0;
- p->next = temp_slots;
- temp_slots = p;
- }
-*************** combine_temp_slots ()
-*** 958,971 ****
- int delete_q = 0;
- if (! q->in_use && GET_MODE (q->slot) == BLKmode)
- {
-! if (p->base_offset + p->full_size == q->base_offset)
- {
- /* Q comes after P; combine Q into P. */
- p->size += q->size;
- p->full_size += q->full_size;
- delete_q = 1;
- }
-! else if (q->base_offset + q->full_size == p->base_offset)
- {
- /* P comes after Q; combine P into Q. */
- q->size += p->size;
---- 971,986 ----
- int delete_q = 0;
- if (! q->in_use && GET_MODE (q->slot) == BLKmode)
- {
-! if (p->base_offset + p->full_size == q->base_offset &&
-! p->boundary_mark == q->boundary_mark)
- {
- /* Q comes after P; combine Q into P. */
- p->size += q->size;
- p->full_size += q->full_size;
- delete_q = 1;
- }
-! else if (q->base_offset + q->full_size == p->base_offset &&
-! p->boundary_mark == q->boundary_mark)
- {
- /* P comes after Q; combine P into Q. */
- q->size += p->size;
-*************** put_reg_into_stack (function, reg, type,
-*** 1519,1525 ****
- new = func->x_parm_reg_stack_loc[regno];
-
- if (new == 0)
-! new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func);
-
- PUT_CODE (reg, MEM);
- PUT_MODE (reg, decl_mode);
---- 1534,1542 ----
- new = func->x_parm_reg_stack_loc[regno];
-
- if (new == 0)
-! new = function ?
-! assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func):
-! assign_stack_local_for_pseudo_reg (decl_mode, GET_MODE_SIZE (decl_mode), 0);
-
- PUT_CODE (reg, MEM);
- PUT_MODE (reg, decl_mode);
-*************** instantiate_virtual_regs_1 (loc, object,
-*** 3950,3956 ****
- constant with that register. */
- temp = gen_reg_rtx (Pmode);
- XEXP (x, 0) = new;
-! if (validate_change (object, &XEXP (x, 1), temp, 0))
- emit_insn_before (gen_move_insn (temp, new_offset), object);
- else
- {
---- 3967,3974 ----
- constant with that register. */
- temp = gen_reg_rtx (Pmode);
- XEXP (x, 0) = new;
-! if (validate_change (object, &XEXP (x, 1), temp, 0)
-! && ! flag_propolice_protection)
- emit_insn_before (gen_move_insn (temp, new_offset), object);
- else
- {
-Index: gcc/gcse.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/gcse.c,v
-retrieving revision 1.1.1.4
-retrieving revision 1.1.1.4.8.1
-diff -c -3 -p -r1.1.1.4 -r1.1.1.4.8.1
-*** gcc/gcse.c 2002/07/29 05:12:18 1.1.1.4
---- gcc/gcse.c 2003/02/26 08:01:02 1.1.1.4.8.1
-*************** cprop_insn (bb, insn, alter_jumps)
-*** 4193,4199 ****
- /* Find an assignment that sets reg_used and is available
- at the start of the block. */
- set = find_avail_set (regno, insn);
-! if (! set)
- continue;
-
- pat = set->expr;
---- 4193,4199 ----
- /* Find an assignment that sets reg_used and is available
- at the start of the block. */
- set = find_avail_set (regno, insn);
-! if (! set || set->expr->volatil)
- continue;
-
- pat = set->expr;
-Index: gcc/integrate.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/integrate.c,v
-retrieving revision 1.1.1.7
-retrieving revision 1.1.1.7.2.1
-diff -c -3 -p -r1.1.1.7 -r1.1.1.7.2.1
-*** gcc/integrate.c 2003/02/19 07:11:16 1.1.1.7
---- gcc/integrate.c 2003/02/26 08:01:02 1.1.1.7.2.1
-*************** copy_decl_for_inlining (decl, from_fn, t
-*** 388,393 ****
---- 388,397 ----
- /* These args would always appear unused, if not for this. */
- TREE_USED (copy) = 1;
-
-+ /* The inlined variable is marked as INLINE not to sweep by propolice */
-+ if (flag_propolice_protection && TREE_CODE (copy) == VAR_DECL)
-+ DECL_INLINE (copy) = 1;
-+
- /* Set the context for the new declaration. */
- if (!DECL_CONTEXT (decl))
- /* Globals stay global. */
-*************** copy_rtx_and_substitute (orig, map, for_
-*** 1950,1955 ****
---- 1954,1963 ----
-
- seq = gen_sequence ();
- end_sequence ();
-+ #ifdef FRAME_GROWS_DOWNWARD
-+ if (flag_propolice_protection && GET_CODE (seq) == SET)
-+ RTX_INTEGRATED_P (SET_SRC (seq)) = 1;
-+ #endif
- emit_insn_after (seq, map->insns_at_start);
- return temp;
- }
-Index: gcc/libgcc-std.ver
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/libgcc-std.ver,v
-retrieving revision 1.1.1.4
-retrieving revision 1.1.1.4.12.1
-diff -c -3 -p -r1.1.1.4 -r1.1.1.4.12.1
-*** gcc/libgcc-std.ver 2001/06/19 04:54:26 1.1.1.4
---- gcc/libgcc-std.ver 2003/02/26 08:01:02 1.1.1.4.12.1
-*************** GCC_3.0 {
-*** 174,177 ****
---- 174,181 ----
- _Unwind_SjLj_RaiseException
- _Unwind_SjLj_ForcedUnwind
- _Unwind_SjLj_Resume
-+
-+ # stack smash handler symbols
-+ __guard
-+ __stack_smash_handler
- }
-Index: gcc/libgcc2.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/libgcc2.c,v
-retrieving revision 1.1.1.7
-retrieving revision 1.1.1.7.4.3
-diff -c -3 -p -r1.1.1.7 -r1.1.1.7.4.3
-*** gcc/libgcc2.c 2002/12/18 00:55:44 1.1.1.7
---- gcc/libgcc2.c 2003/04/07 02:03:19 1.1.1.7.4.3
-*************** atexit (func_ptr func)
-*** 2050,2052 ****
---- 2050,2151 ----
- #endif /* NEED_ATEXIT */
-
- #endif /* L_exit */
-+
-+ #ifdef L_stack_smash_handler
-+ #include <stdio.h>
-+ #include <string.h>
-+ #include <fcntl.h>
-+ #include <unistd.h>
-+
-+ #ifdef _POSIX_SOURCE
-+ #include <signal.h>
-+ #endif
-+
-+ #if defined(HAVE_SYSLOG)
-+ #include <sys/types.h>
-+ #include <sys/socket.h>
-+ #include <sys/un.h>
-+
-+ #include <sys/syslog.h>
-+ #ifndef _PATH_LOG
-+ #define _PATH_LOG "/dev/log"
-+ #endif
-+ #endif
-+
-+ long __guard[8] = {0,0,0,0,0,0,0,0};
-+ static void __guard_setup (void) __attribute__ ((constructor)) ;
-+ static void __guard_setup (void)
-+ {
-+ int fd;
-+ if (__guard[0]!=0) return;
-+ fd = open ("/dev/urandom", 0);
-+ if (fd != -1) {
-+ ssize_t size = read (fd, (char*)&__guard, sizeof(__guard));
-+ close (fd) ;
-+ if (size == sizeof(__guard)) return;
-+ }
-+ /* If a random generator can't be used, the protector switches the guard
-+ to the "terminator canary" */
-+ ((char*)__guard)[0] = 0; ((char*)__guard)[1] = 0;
-+ ((char*)__guard)[2] = '\n'; ((char*)__guard)[3] = 255;
-+ }
-+ void __stack_smash_handler (char func[], int damaged ATTRIBUTE_UNUSED)
-+ {
-+ #if defined (__GNU_LIBRARY__)
-+ extern char * __progname;
-+ #endif
-+ const char message[] = ": stack smashing attack in function ";
-+ int bufsz = 256, len;
-+ char buf[bufsz];
-+ #if defined(HAVE_SYSLOG)
-+ int LogFile;
-+ struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
-+ #endif
-+ #ifdef _POSIX_SOURCE
-+ {
-+ sigset_t mask;
-+ sigfillset(&mask);
-+ sigdelset(&mask, SIGABRT); /* Block all signal handlers */
-+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGABRT */
-+ }
-+ #endif
-+
-+ strcpy(buf, "<2>"); len=3; /* send LOG_CRIT */
-+ #if defined (__GNU_LIBRARY__)
-+ strncat(buf, __progname, bufsz-len-1); len = strlen(buf);
-+ #endif
-+ if (bufsz>len) {strncat(buf, message, bufsz-len-1); len = strlen(buf);}
-+ if (bufsz>len) {strncat(buf, func, bufsz-len-1); len = strlen(buf);}
-+
-+ /* print error message */
-+ write (STDERR_FILENO, buf+3, len-3);
-+ #if defined(HAVE_SYSLOG)
-+ if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
-+
-+ /*
-+ * Send "found" message to the "/dev/log" path
-+ */
-+ SyslogAddr.sun_family = AF_UNIX;
-+ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
-+ sizeof(SyslogAddr.sun_path) - 1);
-+ SyslogAddr.sun_path[sizeof(SyslogAddr.sun_path) - 1] = '\0';
-+ sendto(LogFile, buf, len, 0, (struct sockaddr *)&SyslogAddr,
-+ sizeof(SyslogAddr));
-+ }
-+ #endif
-+
-+ #ifdef _POSIX_SOURCE
-+ { /* Make sure the default handler is associated with SIGABRT */
-+ struct sigaction sa;
-+
-+ memset(&sa, 0, sizeof(struct sigaction));
-+ sigfillset(&sa.sa_mask); /* Block all signals */
-+ sa.sa_flags = 0;
-+ sa.sa_handler = SIG_DFL;
-+ sigaction(SIGABRT, &sa, NULL);
-+ (void)kill(getpid(), SIGABRT);
-+ }
-+ #endif
-+ _exit(127);
-+ }
-+ #endif
-Index: gcc/loop.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/loop.c,v
-retrieving revision 1.1.1.9
-retrieving revision 1.1.1.9.2.2
-diff -c -3 -p -r1.1.1.9 -r1.1.1.9.2.2
-*** gcc/loop.c 2003/02/19 07:11:17 1.1.1.9
---- gcc/loop.c 2003/03/11 05:50:50 1.1.1.9.2.2
-*************** general_induction_var (loop, x, src_reg,
-*** 6385,6390 ****
---- 6385,6398 ----
- if (GET_CODE (*mult_val) == USE)
- *mult_val = XEXP (*mult_val, 0);
-
-+ #ifndef FRAME_GROWS_DOWNWARD
-+ if (flag_propolice_protection
-+ && GET_CODE (*add_val) == PLUS
-+ && (XEXP (*add_val, 0) == frame_pointer_rtx
-+ || XEXP (*add_val, 1) == frame_pointer_rtx))
-+ return 0;
-+ #endif
-+
- if (is_addr)
- *pbenefit += address_cost (orig_x, addr_mode) - reg_address_cost;
- else
-Index: gcc/optabs.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/optabs.c,v
-retrieving revision 1.1.1.8
-retrieving revision 1.1.1.8.2.1
-diff -c -3 -p -r1.1.1.8 -r1.1.1.8.2.1
-*** gcc/optabs.c 2003/02/19 07:11:17 1.1.1.8
---- gcc/optabs.c 2003/02/26 08:01:03 1.1.1.8.2.1
-*************** expand_binop (mode, binoptab, op0, op1,
-*** 670,675 ****
---- 670,695 ----
- if (target)
- target = protect_from_queue (target, 1);
-
-+ if (flag_propolice_protection
-+ && binoptab->code == PLUS
-+ && op0 == virtual_stack_vars_rtx
-+ && GET_CODE(op1) == CONST_INT)
-+ {
-+ int icode = (int) binoptab->handlers[(int) mode].insn_code;
-+ if (target)
-+ temp = target;
-+ else
-+ temp = gen_reg_rtx (mode);
-+
-+ if (! (*insn_data[icode].operand[0].predicate) (temp, mode)
-+ || GET_CODE (temp) != REG)
-+ temp = gen_reg_rtx (mode);
-+
-+ emit_insn (gen_rtx_SET (VOIDmode, temp,
-+ gen_rtx_PLUS (GET_MODE (op0), op0, op1)));
-+ return temp;
-+ }
-+
- if (flag_force_mem)
- {
- op0 = force_not_mem (op0);
-Index: gcc/reload1.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/reload1.c,v
-retrieving revision 1.1.1.7
-retrieving revision 1.1.1.7.4.1
-diff -c -3 -p -r1.1.1.7 -r1.1.1.7.4.1
-*** gcc/reload1.c 2002/12/18 00:55:47 1.1.1.7
---- gcc/reload1.c 2003/02/26 08:01:03 1.1.1.7.4.1
-*************** Software Foundation, 59 Temple Place - S
-*** 42,47 ****
---- 42,48 ----
- #include "toplev.h"
- #include "except.h"
- #include "tree.h"
-+ #include "protector.h"
-
- /* This file contains the reload pass of the compiler, which is
- run after register allocation has been done. It checks that
-*************** alter_reg (i, from_reg)
-*** 1985,1991 ****
- if (from_reg == -1)
- {
- /* No known place to spill from => no slot to reuse. */
-! x = assign_stack_local (GET_MODE (regno_reg_rtx[i]), total_size,
- inherent_size == total_size ? 0 : -1);
- if (BYTES_BIG_ENDIAN)
- /* Cancel the big-endian correction done in assign_stack_local.
---- 1986,1992 ----
- if (from_reg == -1)
- {
- /* No known place to spill from => no slot to reuse. */
-! x = assign_stack_local_for_pseudo_reg (GET_MODE (regno_reg_rtx[i]), total_size,
- inherent_size == total_size ? 0 : -1);
- if (BYTES_BIG_ENDIAN)
- /* Cancel the big-endian correction done in assign_stack_local.
-Index: gcc/simplify-rtx.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/simplify-rtx.c,v
-retrieving revision 1.1.1.2
-retrieving revision 1.1.1.2.8.1
-diff -c -3 -p -r1.1.1.2 -r1.1.1.2.8.1
-*** gcc/simplify-rtx.c 2002/07/29 05:12:24 1.1.1.2
---- gcc/simplify-rtx.c 2003/02/26 08:01:04 1.1.1.2.8.1
-*************** simplify_plus_minus (code, mode, op0, op
-*** 1763,1769 ****
- int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
- int first, negate, changed;
- int i, j;
-!
- memset ((char *) ops, 0, sizeof ops);
-
- /* Set up the two operands and then expand them until nothing has been
---- 1763,1770 ----
- int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
- int first, negate, changed;
- int i, j;
-! HOST_WIDE_INT fp_offset = 0;
-!
- memset ((char *) ops, 0, sizeof ops);
-
- /* Set up the two operands and then expand them until nothing has been
-*************** simplify_plus_minus (code, mode, op0, op
-*** 1788,1793 ****
---- 1789,1798 ----
- switch (this_code)
- {
- case PLUS:
-+ if (flag_propolice_protection
-+ && XEXP (this_op, 0) == virtual_stack_vars_rtx
-+ && GET_CODE (XEXP (this_op, 1)) == CONST_INT)
-+ fp_offset = INTVAL (XEXP (this_op, 1));
- case MINUS:
- if (n_ops == 7)
- return NULL_RTX;
-*************** simplify_plus_minus (code, mode, op0, op
-*** 1942,1951 ****
- && GET_CODE (ops[n_ops - 1].op) == CONST_INT
- && CONSTANT_P (ops[n_ops - 2].op))
- {
-! rtx value = ops[n_ops - 1].op;
- if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
-! value = neg_const_int (mode, value);
-! ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
- n_ops--;
- }
-
---- 1947,1956 ----
- && GET_CODE (ops[n_ops - 1].op) == CONST_INT
- && CONSTANT_P (ops[n_ops - 2].op))
- {
-! int value = INTVAL (ops[n_ops - 1].op);
- if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
-! value = -value;
-! ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, value);
- n_ops--;
- }
-
-*************** simplify_plus_minus (code, mode, op0, op
-*** 1963,1968 ****
---- 1968,2021 ----
- && (n_ops + n_consts > input_ops
- || (n_ops + n_consts == input_ops && n_consts <= input_consts)))
- return NULL_RTX;
-+
-+ if (flag_propolice_protection)
-+ {
-+ /* keep the addressing style of local variables
-+ as (plus (virtual_stack_vars_rtx) (CONST_int x))
-+ (1) inline function is expanded, (+ (+VFP c1) -c2)=>(+ VFP c1-c2)
-+ (2) the case ary[r-1], (+ (+VFP c1) (+r -1))=>(+ R (+r -1))
-+ */
-+ for (i = 0; i < n_ops; i++)
-+ #ifdef FRAME_GROWS_DOWNWARD
-+ if (ops[i].op == virtual_stack_vars_rtx)
-+ #else
-+ if (ops[i].op == virtual_stack_vars_rtx
-+ || ops[i].op == frame_pointer_rtx)
-+ #endif
-+ {
-+ if (GET_CODE (ops[n_ops - 1].op) == CONST_INT)
-+ {
-+ HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
-+ if (n_ops < 3 || value >= fp_offset)
-+ {
-+ ops[i].op = plus_constant (ops[i].op, value);
-+ n_ops--;
-+ }
-+ else
-+ {
-+ if (!force
-+ && (n_ops+1 + n_consts > input_ops
-+ || (n_ops+1 + n_consts == input_ops && n_consts <= input_consts)))
-+ return NULL_RTX;
-+ ops[n_ops - 1].op = GEN_INT (value-fp_offset);
-+ ops[i].op = plus_constant (ops[i].op, fp_offset);
-+ }
-+ }
-+ /* buf[BUFSIZE]: buf is the first local variable (+ (+ fp -S) S)
-+ or (+ (fp 0) r) ==> ((+ (+fp 1) r) -1) */
-+ else if (fp_offset != 0)
-+ return NULL_RTX;
-+ #ifndef FRAME_GROWS_DOWNWARD
-+ /*
-+ * For the case of buf[i], i: REG, buf: (plus fp 0),
-+ */
-+ else if (fp_offset == 0)
-+ return NULL_RTX;
-+ #endif
-+ break;
-+ }
-+ }
-
- /* Put a non-negated operand first. If there aren't any, make all
- operands positive and negate the whole thing later. */
-Index: gcc/toplev.c
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/toplev.c,v
-retrieving revision 1.1.1.10
-retrieving revision 1.1.1.10.4.1
-diff -c -3 -p -r1.1.1.10 -r1.1.1.10.4.1
-*** gcc/toplev.c 2002/12/18 00:55:48 1.1.1.10
---- gcc/toplev.c 2003/02/26 08:01:04 1.1.1.10.4.1
-*************** int align_functions_log;
-*** 883,888 ****
---- 883,895 ----
- minimum function alignment. Zero means no alignment is forced. */
- int force_align_functions_log;
-
-+ #if defined(STACK_PROTECTOR) && defined(STACK_GROWS_DOWNWARD)
-+ /* Nonzero means use propolice as a stack protection method */
-+ int flag_propolice_protection = 1;
-+ #else
-+ int flag_propolice_protection = 0;
-+ #endif
-+
- /* Table of supported debugging formats. */
- static const struct
- {
-*************** static const lang_independent_options f_
-*** 1154,1159 ****
---- 1161,1170 ----
- N_("Report on permanent memory allocation at end of run") },
- { "trapv", &flag_trapv, 1,
- N_("Trap for signed overflow in addition / subtraction / multiplication") },
-+ {"stack-protector", &flag_propolice_protection, 1,
-+ N_("Enables stack protection") },
-+ {"no-stack-protector", &flag_propolice_protection, 0,
-+ N_("Disables stack protection") },
- };
-
- /* Table of language-specific options. */
-*************** static const lang_independent_options W_
-*** 1495,1501 ****
- {"deprecated-declarations", &warn_deprecated_decl, 1,
- N_("Warn about uses of __attribute__((deprecated)) declarations") },
- {"missing-noreturn", &warn_missing_noreturn, 1,
-! N_("Warn about functions which might be candidates for attribute noreturn") }
- };
-
- void
---- 1506,1514 ----
- {"deprecated-declarations", &warn_deprecated_decl, 1,
- N_("Warn about uses of __attribute__((deprecated)) declarations") },
- {"missing-noreturn", &warn_missing_noreturn, 1,
-! N_("Warn about functions which might be candidates for attribute noreturn") },
-! {"stack-protector", &warn_stack_protector, 1,
-! N_("Warn when disabling stack protector for some reason")}
- };
-
- void
-*************** rest_of_compilation (decl)
-*** 2446,2451 ****
---- 2459,2466 ----
-
- insns = get_insns ();
-
-+ if (flag_propolice_protection) prepare_stack_protection (inlinable);
-+
- /* Dump the rtl code if we are dumping rtl. */
-
- if (open_dump_file (DFI_rtl, decl))
-Index: gcc/config/t-linux
-===================================================================
-RCS file: /home/cvsroot/gcc/gcc/config/t-linux,v
-retrieving revision 1.1.1.6
-retrieving revision 1.1.1.6.8.1
-diff -c -3 -p -r1.1.1.6 -r1.1.1.6.8.1
-*** gcc/config/t-linux 2002/07/29 05:12:32 1.1.1.6
---- gcc/config/t-linux 2003/02/26 08:01:04 1.1.1.6.8.1
-*************** STMP_FIXPROTO =
-*** 4,10 ****
- # Compile crtbeginS.o and crtendS.o with pic.
- CRTSTUFF_T_CFLAGS_S = -fPIC
- # Compile libgcc2.a with pic.
-! TARGET_LIBGCC2_CFLAGS = -fPIC
-
- # Override t-slibgcc-elf-ver to export some libgcc symbols with
- # the symbol versions that glibc used.
---- 4,10 ----
- # Compile crtbeginS.o and crtendS.o with pic.
- CRTSTUFF_T_CFLAGS_S = -fPIC
- # Compile libgcc2.a with pic.
-! TARGET_LIBGCC2_CFLAGS = -fPIC -DHAVE_SYSLOG
-
- # Override t-slibgcc-elf-ver to export some libgcc symbols with
- # the symbol versions that glibc used.
diff --git a/sys-devel/gcc/files/digest-gcc-3.1-r7 b/sys-devel/gcc/files/digest-gcc-3.1-r7
deleted file mode 100644
index fba8a6ab4cea..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.1-r7
+++ /dev/null
@@ -1 +0,0 @@
-MD5 605adcc9c90f1674043c8c3749f43636 gcc-3.1.tar.bz2 20445209
diff --git a/sys-devel/gcc/files/digest-gcc-3.2-r1 b/sys-devel/gcc/files/digest-gcc-3.2-r1
deleted file mode 100644
index 193f110de654..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2-r1
+++ /dev/null
@@ -1 +0,0 @@
-MD5 13f289fff789927b9b798bf37552019c gcc-3.2.tar.bz2 20523950
diff --git a/sys-devel/gcc/files/digest-gcc-3.2-r4 b/sys-devel/gcc/files/digest-gcc-3.2-r4
deleted file mode 100644
index cae83304b185..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2-r4
+++ /dev/null
@@ -1,2 +0,0 @@
-MD5 13f289fff789927b9b798bf37552019c gcc-3.2.tar.bz2 20523950
-MD5 3fd60ca7fc4e92a048d10f49b0ff769c gcc-3.2-patches-1.0.tar.bz2 100997
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.1 b/sys-devel/gcc/files/digest-gcc-3.2.1
deleted file mode 100644
index 6b6c1c67122b..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.1
+++ /dev/null
@@ -1 +0,0 @@
-MD5 94a4a76c602b422c8edd66433eeacb7f gcc-3.2.1.tar.bz2 20605134
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.1-r1 b/sys-devel/gcc/files/digest-gcc-3.2.1-r1
deleted file mode 100644
index bc91959d5eed..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.1-r1
+++ /dev/null
@@ -1,3 +0,0 @@
-MD5 94a4a76c602b422c8edd66433eeacb7f gcc-3.2.1.tar.bz2 20605134
-MD5 e363241306dc1a8ab10ac94171906e06 gcc-3.2.1-branch-update-20021208.patch.bz2 1049463
-MD5 b53b0c7527293d3ef2c42938d2558974 gcc-3.2.1-manpages.tar.bz2 127306
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.1-r5 b/sys-devel/gcc/files/digest-gcc-3.2.1-r5
deleted file mode 100644
index 6b6c1c67122b..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.1-r5
+++ /dev/null
@@ -1 +0,0 @@
-MD5 94a4a76c602b422c8edd66433eeacb7f gcc-3.2.1.tar.bz2 20605134
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.1-r6 b/sys-devel/gcc/files/digest-gcc-3.2.1-r6
deleted file mode 100644
index bc91959d5eed..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.1-r6
+++ /dev/null
@@ -1,3 +0,0 @@
-MD5 94a4a76c602b422c8edd66433eeacb7f gcc-3.2.1.tar.bz2 20605134
-MD5 e363241306dc1a8ab10ac94171906e06 gcc-3.2.1-branch-update-20021208.patch.bz2 1049463
-MD5 b53b0c7527293d3ef2c42938d2558974 gcc-3.2.1-manpages.tar.bz2 127306
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.2-r1 b/sys-devel/gcc/files/digest-gcc-3.2.2-r1
deleted file mode 100644
index cb247aa4b1d0..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.2-r1
+++ /dev/null
@@ -1,2 +0,0 @@
-MD5 962a2057a2572226bc99aaeba4255e9b gcc-3.2.2.tar.bz2 20311217
-MD5 74f9a0e9572b2ad94aebfc2540f93c39 gcc-3.2.2-tls-update.patch.bz2 603111
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.2-r3 b/sys-devel/gcc/files/digest-gcc-3.2.2-r3
deleted file mode 100644
index e5ecd54c1e58..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.2-r3
+++ /dev/null
@@ -1,4 +0,0 @@
-MD5 962a2057a2572226bc99aaeba4255e9b gcc-3.2.2.tar.bz2 20311217
-MD5 c71dd70b642cde15c96adaf87a429e3a gcc-3.2.2-branch-update-20030322.patch.bz2 72073
-MD5 1110bc0bb3196bc37c0cc347e43e4f83 protector-3.2.2-7.tar.gz 24190
-MD5 232534e6fbe25667b95c7f668f0d11ef gcc-3.2.2-tls-update2.patch.bz2 595649
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.3 b/sys-devel/gcc/files/digest-gcc-3.2.3
deleted file mode 100644
index c74bee64e8b5..000000000000
--- a/sys-devel/gcc/files/digest-gcc-3.2.3
+++ /dev/null
@@ -1,3 +0,0 @@
-MD5 23d1146d5efa0e0bfad9968dbb418e1e gcc-3.2.3.tar.bz2 20662887
-MD5 e3178370ff732a564e320f64fdd70861 protector-3.2.2-6.tar.gz 23963
-MD5 5d8493dd3e551344c9d5ac11afdc76e3 gcc-3.2.3-tls-update.patch.bz2 396362
diff --git a/sys-devel/gcc/gcc-3.1-r7.ebuild b/sys-devel/gcc/gcc-3.1-r7.ebuild
deleted file mode 100644
index ba57ffabe9f3..000000000000
--- a/sys-devel/gcc/gcc-3.1-r7.ebuild
+++ /dev/null
@@ -1,371 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# /space/gentoo/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.1.ebuild,v 1.1 2002/05/17 15:42:30 prez Exp
-
-IUSE="nls bootstrap static build"
-
-# NOTE TO MAINTAINER: Info pages get nuked for multiple version installs.
-# Ill fix it later if i get a chance.
-#
-# IMPORTANT: The versions of libs installed should be updated
-# in src_install() ... Ill implement auto-version detection
-# later on.
-
-inherit libtool
-
-GCC_SUFFIX=-3.1
-LOC=/usr
-# dont install in /usr/include/g++-v3/, as it will nuke gcc-3.0.x installs
-STDCXX_INCDIR="${LOC}/include/g++-v${PV/\./}"
-SLOT="3.1"
-S=${WORKDIR}/${P}
-SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2
- ftp://ftp.funet.fi/pub/mirrors/sourceware.cygnus.com/pub/gcc/releases/${P}/${P}.tar.bz2"
-DESCRIPTION="Modern GCC C/C++ compiler"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="x86 sparc -ppc"
-
-DEPEND="virtual/glibc"
-RDEPEND="virtual/glibc
- >=sys-libs/zlib-1.1.4"
-if [ -z "`use build`" ]
-then
- DEPEND="${DEPEND}
- nls? ( sys-devel/gettext )
- >=sys-libs/ncurses-5.2-r2"
- RDEPEND="${RDEPEND}
- >=sys-libs/ncurses-5.2-r2"
-fi
-
-build_multiple() {
- #try to make sure that we should build multiple
- #versions of gcc (dual install of gcc2 and gcc3)
- profile="`readlink /etc/make.profile`"
- # [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ]
- #
- # Check the major and minor versions only, and drop the micro version.
- # This is done, as compadibility only differ when major and minor differ.
- if [ -z "`use build`" ] && \
- [ -z "`use bootstrap`" ] && \
- [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ] && \
- [ "${profile/gcc3}" = "${profile}" ] && \
- [ "${GCCBUILD}" != "default" ]
- then
- return 0
- else
- return 1
- fi
-}
-
-# used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-src_unpack() {
- unpack ${P}.tar.bz2
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- # Only apply the portage patch, and only to ltmain.sh in ${S}/
- elibtoolize --portage --shallow
-
- # Red Hat patches
- for x in gcc31-boehm-gc-libs.patch.bz2 \
- gcc31-fde-merge-compat.patch.bz2 \
- gcc31-attr-visibility.patch.bz2 \
- gcc31-attr-visibility2.patch.bz2 \
- gcc31-trunc_int_for_mode.patch.bz2 \
- gcc31-dwarf2-pr6381.patch.bz2 \
- gcc31-dwarf2-pr6436-test.patch.bz2 \
- gcc31-c++-null-pm-init.patch.bz2 \
- gcc31-c++-tsubst-asm.patch.bz2 \
- gcc31-fdata-sections.patch.bz2 \
- gcc31-fold-const.patch.bz2 \
- gcc31-fold-const2.patch.bz2 \
- gcc31-i386-malign-double-doc.patch.bz2 \
- gcc31-libstdc++-pr6594.patch.bz2 \
- gcc31-libstdc++-pr6648.patch.bz2 \
- gcc31-libstdc++-setrlim.patch.bz2 \
- gcc31-pr6643.patch.bz2 \
- gcc31-test-rotate.patch.bz2
- do
- bzip2 -dc ${FILESDIR}/${PV}/${x} | \
- patch -p0 || die "failed with patch ${x}"
- done
-
- # SuSE patches
- bzip2 -dc ${FILESDIR}/${PV}/gcc31-i386-expand-clrstr.patch.bz2 | \
- patch -p1 || die "failed with patch gcc31-i386-expand-clrstr"
-
- # Mandrake patches
- # cp/lex.c (cxx_init_options): By default, don't wrap lines since the
- # C front-end operates that way, already.
- bzip2 -dc ${FILESDIR}/${PV}/gcc31-c++-diagnostic-no-line-wrapping.patch.bz2 | \
- patch -p1 || die "failed with patch gcc31-c++-diagnostic-no-line-wrapping"
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
-# cp ${x} ${x}.orig
- # Fix --datadir=
-# sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
-# ${x}.orig > ${x}
- cp ${x} ${x}.orig
- # Fix --with-gxx-include-dir=
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
- rm -f ${x}.orig
- done
-}
-
-src_compile() {
- local myconf=""
- # use the system zlib!!!
- myconf="--with-system-zlib"
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- else
- myconf="${myconf} --enable-languages=c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ] ; then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
-
- #only build with a program suffix if it is not our
- #default compiler. Also check $GCCBUILD until we got
- #compilers sorted out.
- #
- #NOTE: for software to detirmine gcc version, it will be easier
- # if we have gcc, gcc-3.0 and gcc-3.1, and NOT gcc-3.0.4.
- if build_multiple
- then
- myconf="${myconf} --program-suffix=${GCC_SUFFIX}"
- fi
-
- # gcc does not like optimization
-
- export CFLAGS="${CFLAGS/-O?/}"
- export CXXFLAGS="${CXXFLAGS/-O?/}"
-
- #build in a separate build tree
- cd ${WORKDIR}
- mkdir build
- cd build
-
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --mandir=${LOC}/share/man \
- --infodir=${LOC}/share/info \
- --enable-shared \
- --host=${CHOST} \
- --build=${CHOST} \
- --target=${CHOST} \
- --enable-threads=posix \
- --enable-long-long \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --disable-checking \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- if [ -z "`use static`" ]
- then
- emake bootstrap-lean || die
- else
- emake LDFLAGS=-static bootstrap || die
- fi
-}
-
-#thanks to mandrake for this function
-dispatch_libs() {
- libname=$1 libversion=$2
- rm -f $libname.so $libname.a
-
- if build_multiple
- then
- # If we have multiple versions of GCC, leave libraries in $FULLPATH
- chmod 0755 ../../../$libname.so.$libversion
- ln -s ../../../$libname.so.$libversion $libname.so
- rm -f ../../../$libname.so
- cp -f ../../../$libname.a $libname.a
- rm -f ../../../$libname.a
- else
- ln -sf ../../../$libname.so $libname.so
- ln -sf ../../../$libname.a $libname.a
- fi
-}
-
-src_install() {
- #make install from the build directory
- cd ${WORKDIR}/build
- make prefix=${D}${LOC} \
- mandir=${D}${LOC}/share/man \
- infodir=${D}${LOC}/share/info \
- FAKE_ROOT=${D} \
- install || die
-
- if ! build_multiple
- then
- GCC_SUFFIX=""
- fi
-
- [ -e ${D}${LOC}/bin/gcc${GCC_SUFFIX} ] || die "gcc not found in ${D}"
-
- FULLPATH=${LOC}/lib/gcc-lib/${CHOST}/${PV}
- FULLPATH_D=${D}${LOC}/lib/gcc-lib/${CHOST}/${PV}
- cd ${FULLPATH_D}
- dodir /lib
- dodir /etc/env.d
- echo "LDPATH=${FULLPATH}" > ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- if ! build_multiple
- then
- dosym /usr/bin/cpp /lib/cpp
- dosym gcc /usr/bin/cc
- fi
-
- #make sure we dont have stuff lying around that
- #can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${FULLPATH_D}
- #move symlinks to compiler-specific dir
- dispatch_libs libstdc++ 4.0.0
- mv ../../../libsupc++.a libsupc++.a
-
- dispatch_libs libgcj 3.0.0
- dispatch_libs libgcjgc 1.1.0
- #do not always get created.
- [ ! -e libgcjgc.so ] && rm -f libgcjgc.so
-
- dispatch_libs libg2c 0.0.0
- mv ../../../libfrtbegin.a libfrtbegin.a
-
- mv libobjc* ../../../
- dispatch_libs libobjc 1.0.0
- dispatch_libs libobjc_gc 1.0.0
- #do not always get created.
- [ ! -e libobjc_gc.so ] && rm -f libobjc_gc.so
-
- #Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la; do
- sed -e "s:/usr/lib:${FULLPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- cp ${LA} ${FULLPATH_D}
- done
-
- if build_multiple
- then
- #move libtool .la files to $FULLPATH till I figure
- #what to do with them. This needs to be done with
- #parallel installs, else gcc-2.95 tries to link with
- #the wrong libs.
- mv ${D}${LOC}/lib/*.la ${FULLPATH_D}
- fi
-
- #move Java headers to compiler-specific dir
- mv ${D}${LOC}/include/gc*.h ${FULLPATH_D}/include/
- mv ${D}${LOC}/include/j*.h ${FULLPATH_D}/include/
- for x in gcj gnu java javax org
- do
- mkdir -p ${FULLPATH_D}/include/${x}
- mv ${D}${LOC}/include/${x}/* ${FULLPATH_D}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- done
-
- #move libgcj.spec to compiler-specific directories
- mv ${D}${LOC}/lib/libgcj.spec ${FULLPATH_D}/libgcj.spec
-
- #there is already one with binutils
- mv ${D}${LOC}/lib/libiberty.a ${FULLPATH_D}/libiberty.a
-
- #rename jar because it could clash with Kaffe's jar if this gcc is
- #primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/bin
- mv jar${GCC_SUFFIX} gcj-jar${GCC_SUFFIX}
-
- #move <cxxabi.h> to compiler-specific directories
- mv ${D}${STDCXX_INCDIR}/cxxabi.h ${FULLPATH_D}/include/
-
- #now fix the manpages
- cd ${D}${LOC}/share/man/man1;
- mv cpp.1 cpp${GCC_SUFFIX}.1
- mv gcov.1 gcov${GCC_SUFFIX}.1
- fi
-
- #move libgcc_s.so.1 to /lib
- cd ${D}/lib
- chmod +x ${D}${LOC}/lib/libgcc_s.so.1
- mv -f ${D}${LOC}/lib/libgcc_s.so.1 libgcc_s-${PV}.so.1
- ln -sf libgcc_s-${PV}.so.1 libgcc_s.so.1
- ln -sf libgcc_s.so.1 libgcc_s.so
- rm -f ${D}${LOC}/lib/libgcc_s.so*
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /
- dodoc BUGS COPYING COPYING.LIB ChangeLog GNATS README* FAQ MAINTAINERS
- docinto html
- dodoc *.html
- cd ${S}/boehm-gc
- docinto boehm-gc
- dodoc ChangeLog README*
- cd ${S}/gcc
- docinto gcc
- dodoc ChangeLog* COPYING* FSFChangeLog* LANGUAGES NEWS ONEWS \
- README* SERVICE
- cd ${S}/fastjar
- docinto fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libf2c
- docinto libf2c
- dodoc ChangeLog README TODO changes.netlib disclaimer.netlib \
- permission.netlib readme.netlib
- cd ${S}/libffi
- docinto libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libjava
- docinto libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- cd ${S}/libiberty
- docinto libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto libstdc++-v3
- dodoc ChangeLog* README
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postrm() {
- if [ ! -L ${ROOT}/lib/cpp ]
- then
- ln -sf /usr/bin/cpp ${ROOT}/lib/cpp
- fi
- if [ ! -L ${ROOT}/usr/bin/cc ]
- then
- ln -sf gcc ${ROOT}/usr/bin/cc
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find /usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-
-}
-
diff --git a/sys-devel/gcc/gcc-3.2-r1.ebuild b/sys-devel/gcc/gcc-3.2-r1.ebuild
deleted file mode 100644
index 5c7970eee14f..000000000000
--- a/sys-devel/gcc/gcc-3.2-r1.ebuild
+++ /dev/null
@@ -1,408 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2-r1.ebuild,v 1.10 2003/02/13 16:30:44 vapier Exp $
-
-IUSE="static nls bootstrap java build"
-
-# NOTE TO MAINTAINER: Info pages get nuked for multiple version installs.
-# Ill fix it later if i get a chance.
-
-inherit flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the test to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-LOC="/usr"
-MY_PV="`echo ${PV/_pre} | cut -d. -f1,2`"
-GCC_SUFFIX="-${MY_PV}"
-# Dont install in /usr/include/g++-v3/, as it will nuke gcc-3.0.x installs
-STDCXX_INCDIR="${LOC}/include/g++-v${MY_PV/\./}"
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${P}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2"
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://ftp.mirror.ac.uk/sites/sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-
-DESCRIPTION="Modern GCC C/C++ compiler"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-SLOT="${MY_PV}"
-KEYWORDS="x86 ppc sparc alpha"
-
-DEPEND="virtual/glibc
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-
-build_multiple() {
- # Try to make sure that we should build multiple
- # versions of gcc (dual install of gcc2 and gcc3)
- profile="`readlink /etc/make.profile`"
- # [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ]
- #
- # Check the major and minor versions only, and drop the micro version.
- # This is done, as compadibility only differ when major and minor differ.
- if [ -z "`use build`" ] && \
- [ -z "`use bootstrap`" ] && \
- [ "`gcc -dumpversion | cut -d. -f1,2`" != "${MY_PV}" ] && \
- [ "${profile/gcc3}" = "${profile}" ] && \
- [ "${GCCBUILD}" != "default" ]
- then
- return 0
- else
- return 1
- fi
-}
-
-# Used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${P}.tar.bz2
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- # Fixes a bug in gcc-3.1 and above ... -maccumulate-outgoing-args flag (added
- # in gcc-3.1) causes gcc to misconstruct the function call frame in many cases.
- # Thanks to Ronald Hummelink <ronald@hummelink.xs4all.nl> for bringing it to
- # our attention.
- #
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0319.html
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0350.html
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0410.html
- # http://gcc.gnu.org/ml/gcc/2002-08/msg00731.html
- #
- # Also for the updated patches, see:
- #
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0588.html
- #
- patch -p1 < ${FILESDIR}/${PV}/${P}.fix-copy.patch || die
- patch -p1 < ${FILESDIR}/${PV}/${P}.fix-var.patch || die
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
-# cp ${x} ${x}.orig
- # Fix --datadir=
-# sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
-# ${x}.orig > ${x}
- cp ${x} ${x}.orig
- # Fix --with-gxx-include-dir=
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
- rm -f ${x}.orig
- done
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # Only build with a program suffix if it is not our
- # default compiler. Also check $GCCBUILD until we got
- # compilers sorted out.
- #
- # NOTE: for software to detirmine gcc version, it will be easier
- # if we have gcc, gcc-3.0 and gcc-3.1, and NOT gcc-3.0.4.
- if build_multiple
- then
- myconf="${myconf} --program-suffix=${GCC_SUFFIX}"
- fi
-
- # In general gcc does not like optimization
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --mandir=${LOC}/share/man \
- --infodir=${LOC}/share/info \
- --enable-shared \
- --host=${CHOST} \
- --build=${CHOST} \
- --target=${CHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- if [ -z "`use static`" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean || die
- else
- S="${WORKDIR}/build" \
- emake LDFLAGS=-static bootstrap || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- mandir=${D}${LOC}/share/man \
- infodir=${D}${LOC}/share/info \
- FAKE_ROOT=${D} \
- install || die
-
- if ! build_multiple
- then
- GCC_SUFFIX=""
- fi
-
- [ -e ${D}${LOC}/bin/gcc${GCC_SUFFIX} ] || die "gcc not found in ${D}"
-
- FULLPATH=${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- FULLPATH_D=${D}${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- cd ${FULLPATH_D}
- dodir /lib
- dodir /etc/env.d
- echo "LDPATH=\"${FULLPATH}\"" > ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/05gcc
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/05gcc
-
- if ! build_multiple
- then
- dosym /usr/bin/cpp /lib/cpp
- dosym gcc /usr/bin/cc
- fi
-
- # gcc-3.1 have a problem with the ordering of Search Directories. For
- # instance, if you have libreadline.so in /lib, and libreadline.a in
- # /usr/lib, then it will link with libreadline.a instead of .so. As far
- # as I can see from the source, /lib should be searched before /usr/lib,
- # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
- # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
- # bugzilla bug #4411
- #
- # Azarah - 3 Jul 2002
- #
- cd ${FULLPATH_D}
- dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
- ${FULLPATH}/specs
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${FULLPATH_D}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${FULLPATH_D}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${FULLPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${FULLPATH_D}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${FULLPATH_D}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- mkdir -p ${FULLPATH_D}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${FULLPATH_D}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${FULLPATH_D}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/bin
- [ -f jar${GCC_SUFFIX} ] && mv -f jar${GCC_SUFFIX} gcj-jar${GCC_SUFFIX}
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${FULLPATH_D}/include/
-
- if build_multiple
- then
- # Now fix the manpages
- cd ${D}${LOC}/share/man/man1
- mv cpp.1 cpp${GCC_SUFFIX}.1
- mv gcov.1 gcov${GCC_SUFFIX}.1
- fi
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto libstdc++-v3
- dodoc ChangeLog* README
- docinto libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postrm() {
- if [ ! -L ${ROOT}/lib/cpp ]
- then
- ln -sf /usr/bin/cpp ${ROOT}/lib/cpp
- fi
- if [ ! -L ${ROOT}/usr/bin/cc ]
- then
- ln -sf gcc ${ROOT}/usr/bin/cc
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2-r4.ebuild b/sys-devel/gcc/gcc-3.2-r4.ebuild
deleted file mode 100644
index 5140fcfed706..000000000000
--- a/sys-devel/gcc/gcc-3.2-r4.ebuild
+++ /dev/null
@@ -1,423 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2-r4.ebuild,v 1.9 2003/02/13 16:30:58 vapier Exp $
-
-IUSE="static nls bootstrap java build"
-
-# NOTE TO MAINTAINER: Info pages get nuked for multiple version installs.
-# Ill fix it later if i get a chance.
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-LOC="/usr"
-MY_PV="`echo ${PV/_pre} | cut -d. -f1,2`"
-GCC_SUFFIX="-${MY_PV}"
-# Dont install in /usr/include/g++-v3/, as it will nuke gcc-3.0.x installs
-STDCXX_INCDIR="${LOC}/include/g++-v${MY_PV/\./}"
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${P}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2
- mirror://gentoo/distfiles/${P}-patches-1.0.tar.bz2"
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-
-DESCRIPTION="Modern GCC C/C++ compiler"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-SLOT="${MY_PV}"
-KEYWORDS="x86 ppc sparc alpha"
-
-DEPEND="virtual/glibc
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-
-build_multiple() {
- # Try to make sure that we should build multiple
- # versions of gcc (dual install of gcc2 and gcc3)
- profile="`readlink /etc/make.profile`"
- # [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ]
- #
- # Check the major and minor versions only, and drop the micro version.
- # This is done, as compadibility only differ when major and minor differ.
- if [ -z "`use build`" ] && \
- [ -z "`use bootstrap`" ] && \
- [ "`gcc -dumpversion | cut -d. -f1,2`" != "${MY_PV}" ] && \
- [ "${profile/gcc3}" = "${profile}" ] && \
- [ "${GCCBUILD}" != "default" ]
- then
- return 0
- else
- return 1
- fi
-}
-
-# Used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${P}.tar.bz2 ${P}-patches-1.0.tar.bz2
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- # Various patches from all over
- epatch ${WORKDIR}/patch
-
- # Fixes a bug in gcc-3.1 and above ... -maccumulate-outgoing-args flag (added
- # in gcc-3.1) causes gcc to misconstruct the function call frame in many cases.
- # Thanks to Ronald Hummelink <ronald@hummelink.xs4all.nl> for bringing it to
- # our attention.
- #
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0319.html
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0350.html
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0410.html
- # http://gcc.gnu.org/ml/gcc/2002-08/msg00731.html
- #
- # Also for the updated patches, see:
- #
- # http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0588.html
- #
- epatch ${FILESDIR}/${PV}/${P}.fix-copy.patch
- epatch ${FILESDIR}/${PV}/${P}.fix-var.patch
-
- # Fixes to get gcc to compile under glibc-2.3*
- epatch ${FILESDIR}/${PV}/${P}-glibc-2.3-compat.diff
- # This one is thanks to cretin@gentoo.org
- epatch ${FILESDIR}/${PV}/${P}.ctype.patch
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
-# cp ${x} ${x}.orig
- # Fix --datadir=
-# sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
-# ${x}.orig > ${x}
- cp ${x} ${x}.orig
- # Fix --with-gxx-include-dir=
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
- rm -f ${x}.orig
- done
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # Only build with a program suffix if it is not our
- # default compiler. Also check $GCCBUILD until we got
- # compilers sorted out.
- #
- # NOTE: for software to detirmine gcc version, it will be easier
- # if we have gcc, gcc-3.0 and gcc-3.1, and NOT gcc-3.0.4.
- if build_multiple
- then
- myconf="${myconf} --program-suffix=${GCC_SUFFIX}"
- fi
-
- # In general gcc does not like optimization
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --mandir=${LOC}/share/man \
- --infodir=${LOC}/share/info \
- --enable-shared \
- --host=${CHOST} \
- --build=${CHOST} \
- --target=${CHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- if [ -z "`use static`" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- S="${WORKDIR}/build" \
- emake LDFLAGS=-static bootstrap \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- mandir=${D}${LOC}/share/man \
- infodir=${D}${LOC}/share/info \
- FAKE_ROOT=${D} \
- install || die
-
- if ! build_multiple
- then
- GCC_SUFFIX=""
- fi
-
- [ -e ${D}${LOC}/bin/gcc${GCC_SUFFIX} ] || die "gcc not found in ${D}"
-
- FULLPATH=${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- FULLPATH_D=${D}${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- cd ${FULLPATH_D}
- dodir /lib
- dodir /etc/env.d
- echo "LDPATH=\"${FULLPATH}\"" > ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/05gcc
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/05gcc
-
- if ! build_multiple
- then
- dosym /usr/bin/cpp /lib/cpp
- dosym gcc /usr/bin/cc
- fi
-
-# This is fixed via the linker scripts (bug #4411) ....
-#
-# # gcc-3.1 have a problem with the ordering of Search Directories. For
-# # instance, if you have libreadline.so in /lib, and libreadline.a in
-# # /usr/lib, then it will link with libreadline.a instead of .so. As far
-# # as I can see from the source, /lib should be searched before /usr/lib,
-# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
-# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
-# # bugzilla bug #4411
-# #
-# # Azarah - 3 Jul 2002
-# #
-# cd ${FULLPATH_D}
-# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
-# ${FULLPATH}/specs
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${FULLPATH_D}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${FULLPATH_D}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${FULLPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${FULLPATH_D}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${FULLPATH_D}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- mkdir -p ${FULLPATH_D}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${FULLPATH_D}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${FULLPATH_D}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/bin
- [ -f jar${GCC_SUFFIX} ] && mv -f jar${GCC_SUFFIX} gcj-jar${GCC_SUFFIX}
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${FULLPATH_D}/include/
-
- if build_multiple
- then
- # Now fix the manpages
- cd ${D}${LOC}/share/man/man1
- mv cpp.1 cpp${GCC_SUFFIX}.1
- mv gcov.1 gcov${GCC_SUFFIX}.1
- fi
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto libstdc++-v3
- dodoc ChangeLog* README
- docinto libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postrm() {
- if [ ! -L ${ROOT}/lib/cpp ]
- then
- ln -sf /usr/bin/cpp ${ROOT}/lib/cpp
- fi
- if [ ! -L ${ROOT}/usr/bin/cc ]
- then
- ln -sf gcc ${ROOT}/usr/bin/cc
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2-r5.ebuild b/sys-devel/gcc/gcc-3.2-r5.ebuild
index 5718edd27e47..94e03a535b52 100644
--- a/sys-devel/gcc/gcc-3.2-r5.ebuild
+++ b/sys-devel/gcc/gcc-3.2-r5.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2-r5.ebuild,v 1.8 2003/04/28 02:40:34 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2-r5.ebuild,v 1.9 2003/05/17 00:18:44 azarah Exp $
IUSE="static nls bootstrap java build"
@@ -65,7 +65,7 @@ DESCRIPTION="Modern C/C++ compiler written by the GNU people"
HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha"
+KEYWORDS="x86 ppc sparc alpha"
# Ok, this is a hairy one again, but lets assume that we
# are not cross compiling, than we want SLOT to only contain
diff --git a/sys-devel/gcc/gcc-3.2.1-r1.ebuild b/sys-devel/gcc/gcc-3.2.1-r1.ebuild
deleted file mode 100644
index 1e45ca8a446a..000000000000
--- a/sys-devel/gcc/gcc-3.2.1-r1.ebuild
+++ /dev/null
@@ -1,475 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1-r1.ebuild,v 1.5 2003/02/13 16:31:08 vapier Exp $
-
-IUSE="static nls bootstrap java build"
-
-# NOTE TO MAINTAINER: Info pages get nuked for multiple version installs.
-# Ill fix it later if i get a chance.
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-LOC="/usr"
-MY_PV="`echo ${PV/_pre} | cut -d. -f1,2`"
-GCC_SUFFIX="-${MY_PV}"
-# Dont install in /usr/include/g++-v3/, as it will nuke gcc-3.0.x installs
-STDCXX_INCDIR="${LOC}/include/g++-v${MY_PV/\./}"
-
-# Patch tarball support ...
-#PATCH_VER="1.0"
-PATCH_VER=""
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-
-# Branch update support ...
-#BRANCH_UPDATE="20021208"
-BRANCH_UPDATE="20021208"
-
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${P}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2"
-
- if [ -n "${PATCH_VER}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
- fi
-
- if [ -n "${BRANCH_UPDATE}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-branch-update-${BRANCH_UPDATE}.patch.bz2"
- fi
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
-
-DESCRIPTION="Modern C/C++ compiler written by the GNU people"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-SLOT="${MY_PV}"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips"
-
-DEPEND="virtual/glibc
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-
-build_multiple() {
- # Try to make sure that we should build multiple
- # versions of gcc (dual install of gcc2 and gcc3)
- profile="`readlink /etc/make.profile`"
- # [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ]
- #
- # Check the major and minor versions only, and drop the micro version.
- # This is done, as compadibility only differ when major and minor differ.
- if [ -z "`use build`" ] && \
- [ -z "`use bootstrap`" ] && \
- [ "`gcc -dumpversion | cut -d. -f1,2`" != "${MY_PV}" ] && \
- [ "${profile/gcc3}" = "${profile}" ] && \
- [ "${GCCBUILD}" != "default" ]
- then
- return 0
- else
- return 1
- fi
-}
-
-# Used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${P}.tar.bz2
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- # Branch update ...
- if [ -n "${BRANCH_UPDATE}" ]
- then
- epatch ${DISTDIR}/${P}-branch-update-${BRANCH_UPDATE}.patch.bz2
- fi
-
- # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
- if [ -n "${PATCH_VER}" ]
- then
- epatch ${WORKDIR}/patch
- fi
-
- # Fix bug URL
- epatch ${FILESDIR}/${PV}/${P}-bug-url.patch
-
- # Patches from Redhat ...
- epatch ${FILESDIR}/${PV}/gcc32-ada-make.patch
- epatch ${FILESDIR}/${PV}/gcc32-shared-pthread.patch
- use sparc && epatch ${FILESDIR}/${PV}/gcc32-sparc32-hack.patch
- epatch ${FILESDIR}/${PV}/gcc32-testsuite.patch
- epatch ${FILESDIR}/${PV}/gcc32-tls-reload-fix.patch
-
- # Install our pre generated manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- cd ${S}; unpack ${P}-manpages.tar.bz2
- fi
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
-# cp ${x} ${x}.orig
- # Fix --datadir=
-# sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
-# ${x}.orig > ${x}
- cp ${x} ${x}.orig
- # Fix --with-gxx-include-dir=
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
- rm -f ${x}.orig
- done
-
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${PV/_pre}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # Only build with a program suffix if it is not our
- # default compiler. Also check $GCCBUILD until we got
- # compilers sorted out.
- #
- # NOTE: for software to detirmine gcc version, it will be easier
- # if we have gcc, gcc-3.0 and gcc-3.1, and NOT gcc-3.0.4.
- if build_multiple
- then
- myconf="${myconf} --program-suffix=${GCC_SUFFIX}"
- fi
-
- # In general gcc does not like optimization
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --mandir=${LOC}/share/man \
- --infodir=${LOC}/share/info \
- --enable-shared \
- --host=${CHOST} \
- --build=${CHOST} \
- --target=${CHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- # Do not make manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- find ${S} -name '*.[17]' -exec touch {} \; || :
- fi
-
- # Setup -j in MAKEOPTS
- get_number_of_jobs
-
- if [ -z "`use static`" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- S="${WORKDIR}/build" \
- emake LDFLAGS=-static bootstrap \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- mandir=${D}${LOC}/share/man \
- infodir=${D}${LOC}/share/info \
- FAKE_ROOT=${D} \
- install || die
-
- if ! build_multiple
- then
- GCC_SUFFIX=""
- fi
-
- [ -e ${D}${LOC}/bin/gcc${GCC_SUFFIX} ] || die "gcc not found in ${D}"
-
- FULLPATH=${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- FULLPATH_D=${D}${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- cd ${FULLPATH_D}
- dodir /lib
- dodir /etc/env.d
- echo "LDPATH=\"${FULLPATH}\"" > ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/05gcc${GCC_SUFFIX}
-
- # Install wrappers
- exeinto /lib
- doexe ${FILESDIR}/cpp
- exeinto /usr/bin
- doexe ${FILESDIR}/cc
-
-# This is fixed via the linker scripts (bug #4411) ....
-#
-# # gcc-3.1 have a problem with the ordering of Search Directories. For
-# # instance, if you have libreadline.so in /lib, and libreadline.a in
-# # /usr/lib, then it will link with libreadline.a instead of .so. As far
-# # as I can see from the source, /lib should be searched before /usr/lib,
-# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
-# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
-# # bugzilla bug #4411
-# #
-# # Azarah - 3 Jul 2002
-# #
-# cd ${FULLPATH_D}
-# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
-# ${FULLPATH}/specs
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${FULLPATH_D}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${FULLPATH_D}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${FULLPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${FULLPATH_D}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${FULLPATH_D}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- mkdir -p ${FULLPATH_D}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${FULLPATH_D}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${FULLPATH_D}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/bin
- [ -f jar${GCC_SUFFIX} ] && mv -f jar${GCC_SUFFIX} gcj-jar${GCC_SUFFIX}
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${FULLPATH_D}/include/
-
- if build_multiple
- then
- # Now fix the manpages
- cd ${D}${LOC}/share/man/man1
- mv cpp.1 cpp${GCC_SUFFIX}.1
- mv gcov.1 gcov${GCC_SUFFIX}.1
- fi
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto libstdc++-v3
- dodoc ChangeLog* README
- docinto libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postinst() {
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
- chmod +x ${T}/fix_libtool_files.sh
- ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-}
-
-pkg_postrm() {
- if [ ! -L ${ROOT}/lib/cpp ]
- then
- ln -sf /usr/bin/cpp ${ROOT}/lib/cpp
- fi
- if [ ! -L ${ROOT}/usr/bin/cc ]
- then
- ln -sf gcc ${ROOT}/usr/bin/cc
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2.1-r5.ebuild b/sys-devel/gcc/gcc-3.2.1-r5.ebuild
deleted file mode 100644
index 6598eb8b3ab4..000000000000
--- a/sys-devel/gcc/gcc-3.2.1-r5.ebuild
+++ /dev/null
@@ -1,449 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1-r5.ebuild,v 1.9 2003/02/13 16:31:14 vapier Exp $
-
-IUSE="static nls bootstrap java build"
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-# Theoretical cross compiler support
-[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
-
-LOC="/usr"
-MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
-MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
-
-LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
-BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
-DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
-# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
-# We will handle /usr/include/g++-v3/ with gcc-config ...
-STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
-
-# Patch tarball support ...
-#PATCH_VER="1.0"
-PATCH_VER=""
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${P}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2"
-
- if [ -n "${PATCH_VER}" ]
- then
- SRC_URI="${SRC_URI} mirror://gentoo/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
- fi
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-
-DESCRIPTION="Modern C/C++ compiler written by the GNU people"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha"
-
-# Ok, this is a hairy one again, but lets assume that we
-# are not cross compiling, than we want SLOT to only contain
-# $PV, as people upgrading to new gcc layout will not have
-# their old gcc unmerged ...
-if [ "${CHOST}" = "${CCHOST}" ]
-then
- SLOT="${MY_PV}"
-else
- SLOT="${CCHOST}-${MY_PV}"
-fi
-
-DEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.2
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.2
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-
-# Hack used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-pkg_setup() {
- echo
- eerror "This is a very alpha ebuild and changes in here"
- eerror "are not yet set in stone! Please do NOT merge"
- eerror "this if you are not a developer!"
-# die
-}
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${P}.tar.bz2
-
- if [ -n "${PATCH_VER}" ]
- then
- unpack ${P}-patches-${PATCH_VER}.tar.bz2
- fi
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
- if [ -n "${PATCH_VER}" ]
- then
- epatch ${WORKDIR}/patch
- fi
-
- # Fixes to get gcc to compile under glibc-2.3*
-# epatch ${FILESDIR}/${MY_PV}/${PN}-${MY_PV}-glibc-2.3-compat.diff
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
- # Fix --datadir=
- cp ${x} ${x}.orig
- sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
- ${x}.orig > ${x}
-
- # Fix --bindir=
- cp ${x} ${x}.orig
- sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
- ${x}.orig > ${x}
-
- # Fix --with-gxx-include-dir=
- cp ${x} ${x}.orig
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
-
- # Where java security stuff should be installed
- cp ${x} ${x}.orig
- sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
- ${x}.orig > ${x}
-
- rm -f ${x}.orig
- done
-
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # In general gcc does not like optimization, and add -O2 where
- # it is safe.
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- einfo "Configuring GCC..."
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --bindir=${BINPATH} \
- --datadir=${DATAPATH} \
- --mandir=${DATAPATH}/man \
- --infodir=${DATAPATH}/info \
- --enable-shared \
- --host=${CHOST} \
- --target=${CCHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- einfo "Building GCC..."
- if [ -z "`use static`" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- S="${WORKDIR}/build" \
- emake LDFLAGS=-static bootstrap \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- einfo "Installing GCC..."
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- bindir=${D}${BINPATH} \
- datadir=${D}${DATAPATH} \
- mandir=${D}${DATAPATH}/man \
- infodir=${D}${DATAPATH}/info \
- LIBPATH="${LIBPATH}" \
- FAKE_ROOT="${D}" \
- install || die
-
- [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
-
- dodir /lib /usr/bin
- dodir /etc/env.d/gcc
- echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
-
- # Install wrappers
- exeinto /lib
- doexe ${FILESDIR}/cpp
- exeinto /usr/bin
- doexe ${FILESDIR}/cc
-
-# This should be invalidated by the linker scripts we have as the latest
-# fix for bug #4411
-#
-# # gcc-3.1 have a problem with the ordering of Search Directories. For
-# # instance, if you have libreadline.so in /lib, and libreadline.a in
-# # /usr/lib, then it will link with libreadline.a instead of .so. As far
-# # as I can see from the source, /lib should be searched before /usr/lib,
-# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
-# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
-# # bugzilla bug #4411
-# #
-# # Azarah - 3 Jul 2002
-# #
-# cd ${D}${LIBPATH}
-# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
-# ${LIBPATH}/specs
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${D}${LIBPATH}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${D}${LIBPATH}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- dodir /${LIBPATH}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
- [ -f jar ] && mv -f jar gcj-jar
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
-
- # These should be symlinks
- cd ${D}${BINPATH}
- rm -f ${CCHOST}-{gcc,g++,c++,g77}
- [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
- [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
- [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
- [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /${CCHOST}
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto ${CCHOST}/html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto ${CCHOST}/boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto ${CCHOST}/boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto ${CCHOST}/gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto ${CCHOST}/libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto ${CCHOST}/libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto ${CCHOST}/libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto ${CCHOST}/libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto ${CCHOST}/libstdc++-v3
- dodoc ChangeLog* README
- docinto ${CCHOST}/libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto ${CCHOST}/fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto ${CCHOST}/libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postinst() {
-
- if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" ]
- then
- gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
- fi
-
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
- chmod +x ${T}/fix_libtool_files.sh
- ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2.1-r6.ebuild b/sys-devel/gcc/gcc-3.2.1-r6.ebuild
deleted file mode 100644
index f316d9bd9dc7..000000000000
--- a/sys-devel/gcc/gcc-3.2.1-r6.ebuild
+++ /dev/null
@@ -1,499 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1-r6.ebuild,v 1.13 2003/03/24 19:49:06 azarah Exp $
-
-IUSE="static nls bootstrap java build"
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Some odd problems with -march=k6[-2] (bug #12791)
-replace-flags "-march=k6-2" "-march=i586"
-replace-flags "-march=k6" "-march=i586"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-# Theoretical cross compiler support
-[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
-
-LOC="/usr"
-MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
-MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
-
-LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
-BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
-DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
-# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
-# We will handle /usr/include/g++-v3/ with gcc-config ...
-STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
-
-# Patch tarball support ...
-#PATCH_VER="1.0"
-PATCH_VER=""
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-
-# Branch update support ...
-#BRANCH_UPDATE="20021208"
-BRANCH_UPDATE="20021208"
-
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${P}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2"
-
- if [ -n "${PATCH_VER}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
- fi
-
- if [ -n "${BRANCH_UPDATE}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-branch-update-${BRANCH_UPDATE}.patch.bz2"
- fi
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
-
-DESCRIPTION="Modern C/C++ compiler written by the GNU people"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="x86 ppc sparc alpha mips hppa"
-
-# Ok, this is a hairy one again, but lets assume that we
-# are not cross compiling, than we want SLOT to only contain
-# $PV, as people upgrading to new gcc layout will not have
-# their old gcc unmerged ...
-if [ "${CHOST}" == "${CCHOST}" ]
-then
- SLOT="${MY_PV}"
-else
- SLOT="${CCHOST}-${MY_PV}"
-fi
-
-DEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.2
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.2.7
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-PDEPEND=">=sys-devel/gcc-config-1.2.7"
-
-
-# Hack used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${P}.tar.bz2
-
- if [ -n "${PATCH_VER}" ]
- then
- unpack ${P}-patches-${PATCH_VER}.tar.bz2
- fi
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- # Branch update ...
- if [ -n "${BRANCH_UPDATE}" ]
- then
- epatch ${DISTDIR}/${P}-branch-update-${BRANCH_UPDATE}.patch.bz2
- fi
-
- # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
- if [ -n "${PATCH_VER}" ]
- then
- epatch ${WORKDIR}/patch
- fi
-
- # Fix bug URL
- epatch ${FILESDIR}/${PV}/${P}-bug-url.patch
-
- # Patches from Redhat ...
- epatch ${FILESDIR}/${PV}/gcc32-ada-make.patch
- epatch ${FILESDIR}/${PV}/gcc32-shared-pthread.patch
- use sparc && epatch ${FILESDIR}/${PV}/gcc32-sparc32-hack.patch
- epatch ${FILESDIR}/${PV}/gcc32-testsuite.patch
- epatch ${FILESDIR}/${PV}/gcc32-tls-reload-fix.patch
-
- # Install our pre generated manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- cd ${S}; unpack ${P}-manpages.tar.bz2
- fi
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- einfo "Fixing Makefiles..."
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
- # Fix --datadir=
- cp ${x} ${x}.orig
- sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
- ${x}.orig > ${x}
-
- # Fix --bindir=
- cp ${x} ${x}.orig
- sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
- ${x}.orig > ${x}
-
- # Fix --includedir=
- cp ${x} ${x}.orig
- sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
- ${x}.orig > ${x}
-
- # Fix --with-gxx-include-dir=
- cp ${x} ${x}.orig
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
-
- # Where java security stuff should be installed
- cp ${x} ${x}.orig
- sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
- ${x}.orig > ${x}
-
- rm -f ${x}.orig
- done
-
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
-
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # In general gcc does not like optimization, and add -O2 where
- # it is safe.
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- einfo "Configuring GCC..."
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --bindir=${BINPATH} \
- --includedir=${LIBPATH}/include \
- --datadir=${DATAPATH} \
- --mandir=${DATAPATH}/man \
- --infodir=${DATAPATH}/info \
- --enable-shared \
- --host=${CHOST} \
- --target=${CCHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- # Do not make manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- find ${S} -name '*.[17]' -exec touch {} \; || :
- fi
-
- # Setup -j in MAKEOPTS
- get_number_of_jobs
-
- einfo "Building GCC..."
- # Only build it static if we are just building the C frontend, else
- # a lot of things break because there are not libstdc++.so ....
- if [ -n "`use static`" -a "${gcc_lang}" = "c" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake LDFLAGS="-static" bootstrap \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- einfo "Installing GCC..."
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- bindir=${D}${BINPATH} \
- includedir=${D}${LIBPATH}/include \
- datadir=${D}${DATAPATH} \
- mandir=${D}${DATAPATH}/man \
- infodir=${D}${DATAPATH}/info \
- LIBPATH="${LIBPATH}" \
- FAKE_ROOT="${D}" \
- install || die
-
- [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
-
- dodir /lib /usr/bin
- dodir /etc/env.d/gcc
- echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
-
- # Install wrappers
- exeinto /lib
- doexe ${FILESDIR}/cpp
- exeinto /usr/bin
- doexe ${FILESDIR}/cc
-
-# This should be invalidated by the linker scripts we have as the latest
-# fix for bug #4411
-#
-# # gcc-3.1 have a problem with the ordering of Search Directories. For
-# # instance, if you have libreadline.so in /lib, and libreadline.a in
-# # /usr/lib, then it will link with libreadline.a instead of .so. As far
-# # as I can see from the source, /lib should be searched before /usr/lib,
-# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
-# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
-# # bugzilla bug #4411
-# #
-# # Azarah - 3 Jul 2002
-# #
-# cd ${D}${LIBPATH}
-# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
-# ${LIBPATH}/specs
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${D}${LIBPATH}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${D}${LIBPATH}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- dodir /${LIBPATH}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
- [ -f jar ] && mv -f jar gcj-jar
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
-
- # These should be symlinks
- cd ${D}${BINPATH}
- rm -f ${CCHOST}-{gcc,g++,c++,g77}
- [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
- [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
- [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
- [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /${CCHOST}
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto ${CCHOST}/html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto ${CCHOST}/boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto ${CCHOST}/boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto ${CCHOST}/gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto ${CCHOST}/libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto ${CCHOST}/libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto ${CCHOST}/libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto ${CCHOST}/libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto ${CCHOST}/libstdc++-v3
- dodoc ChangeLog* README
- docinto ${CCHOST}/libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto ${CCHOST}/fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto ${CCHOST}/libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postinst() {
-
- if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" == "${CCHOST}" ]
- then
- gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
- fi
-
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
- chmod +x ${T}/fix_libtool_files.sh
- ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2.1-r7.ebuild b/sys-devel/gcc/gcc-3.2.1-r7.ebuild
index 5560ec9685eb..c8cb86d6dbc6 100644
--- a/sys-devel/gcc/gcc-3.2.1-r7.ebuild
+++ b/sys-devel/gcc/gcc-3.2.1-r7.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1-r7.ebuild,v 1.4 2003/03/24 19:49:06 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1-r7.ebuild,v 1.5 2003/05/17 00:18:44 azarah Exp $
IUSE="static nls bootstrap java build"
@@ -87,7 +87,7 @@ DESCRIPTION="Modern C/C++ compiler written by the GNU people"
HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa"
+KEYWORDS="x86 ppc sparc alpha hppa"
# Ok, this is a hairy one again, but lets assume that we
# are not cross compiling, than we want SLOT to only contain
diff --git a/sys-devel/gcc/gcc-3.2.1.ebuild b/sys-devel/gcc/gcc-3.2.1.ebuild
deleted file mode 100644
index be567d9a6bc9..000000000000
--- a/sys-devel/gcc/gcc-3.2.1.ebuild
+++ /dev/null
@@ -1,414 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1.ebuild,v 1.14 2003/02/13 16:31:31 vapier Exp $
-
-IUSE="static nls bootstrap java build"
-
-# NOTE TO MAINTAINER: Info pages get nuked for multiple version installs.
-# Ill fix it later if i get a chance.
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-LOC="/usr"
-MY_PV="`echo ${PV/_pre} | cut -d. -f1,2`"
-GCC_SUFFIX="-${MY_PV}"
-# Dont install in /usr/include/g++-v3/, as it will nuke gcc-3.0.x installs
-STDCXX_INCDIR="${LOC}/include/g++-v${MY_PV/\./}"
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${P}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2"
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-
-DESCRIPTION="Modern C/C++ compiler written by the GNU people"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-SLOT="${MY_PV}"
-KEYWORDS="x86 ppc sparc alpha mips"
-
-DEPEND="virtual/glibc
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-
-build_multiple() {
- # Try to make sure that we should build multiple
- # versions of gcc (dual install of gcc2 and gcc3)
- profile="`readlink /etc/make.profile`"
- # [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ]
- #
- # Check the major and minor versions only, and drop the micro version.
- # This is done, as compadibility only differ when major and minor differ.
- if [ -z "`use build`" ] && \
- [ -z "`use bootstrap`" ] && \
- [ "`gcc -dumpversion | cut -d. -f1,2`" != "${MY_PV}" ] && \
- [ "${profile/gcc3}" = "${profile}" ] && \
- [ "${GCCBUILD}" != "default" ]
- then
- return 0
- else
- return 1
- fi
-}
-
-# Used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${P}.tar.bz2
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- # Fixes to get gcc to compile under glibc-2.3*
-# epatch ${FILESDIR}/${PV}/${P}-glibc-2.3-compat.diff
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
-# cp ${x} ${x}.orig
- # Fix --datadir=
-# sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
-# ${x}.orig > ${x}
- cp ${x} ${x}.orig
- # Fix --with-gxx-include-dir=
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
- rm -f ${x}.orig
- done
-
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${PV/_pre}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # Only build with a program suffix if it is not our
- # default compiler. Also check $GCCBUILD until we got
- # compilers sorted out.
- #
- # NOTE: for software to detirmine gcc version, it will be easier
- # if we have gcc, gcc-3.0 and gcc-3.1, and NOT gcc-3.0.4.
- if build_multiple
- then
- myconf="${myconf} --program-suffix=${GCC_SUFFIX}"
- fi
-
- # In general gcc does not like optimization
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --mandir=${LOC}/share/man \
- --infodir=${LOC}/share/info \
- --enable-shared \
- --host=${CHOST} \
- --build=${CHOST} \
- --target=${CHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- # Setup -j in MAKEOPTS
- get_number_of_jobs
-
- if [ -z "`use static`" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- S="${WORKDIR}/build" \
- emake LDFLAGS=-static bootstrap \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- mandir=${D}${LOC}/share/man \
- infodir=${D}${LOC}/share/info \
- FAKE_ROOT=${D} \
- install || die
-
- if ! build_multiple
- then
- GCC_SUFFIX=""
- fi
-
- [ -e ${D}${LOC}/bin/gcc${GCC_SUFFIX} ] || die "gcc not found in ${D}"
-
- FULLPATH=${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- FULLPATH_D=${D}${LOC}/lib/gcc-lib/${CHOST}/${PV/_pre}
- cd ${FULLPATH_D}
- dodir /lib
- dodir /etc/env.d
- echo "LDPATH=\"${FULLPATH}\"" > ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/05gcc${GCC_SUFFIX}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/05gcc${GCC_SUFFIX}
-
- # Install wrappers
- exeinto /lib
- doexe ${FILESDIR}/cpp
- exeinto /usr/bin
- doexe ${FILESDIR}/cc
-
-# This is fixed via the linker scripts (bug #4411) ....
-#
-# # gcc-3.1 have a problem with the ordering of Search Directories. For
-# # instance, if you have libreadline.so in /lib, and libreadline.a in
-# # /usr/lib, then it will link with libreadline.a instead of .so. As far
-# # as I can see from the source, /lib should be searched before /usr/lib,
-# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
-# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
-# # bugzilla bug #4411
-# #
-# # Azarah - 3 Jul 2002
-# #
-# cd ${FULLPATH_D}
-# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
-# ${FULLPATH}/specs
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${FULLPATH_D}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${FULLPATH_D}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${FULLPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${FULLPATH_D}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${FULLPATH_D}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${FULLPATH_D}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- mkdir -p ${FULLPATH_D}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${FULLPATH_D}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${FULLPATH_D}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/bin
- [ -f jar${GCC_SUFFIX} ] && mv -f jar${GCC_SUFFIX} gcj-jar${GCC_SUFFIX}
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${FULLPATH_D}/include/
-
- if build_multiple
- then
- # Now fix the manpages
- cd ${D}${LOC}/share/man/man1
- mv cpp.1 cpp${GCC_SUFFIX}.1
- mv gcov.1 gcov${GCC_SUFFIX}.1
- fi
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto libstdc++-v3
- dodoc ChangeLog* README
- docinto libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_postinst() {
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
- chmod +x ${T}/fix_libtool_files.sh
- ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-}
-
-pkg_postrm() {
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2.2-r1.ebuild b/sys-devel/gcc/gcc-3.2.2-r1.ebuild
deleted file mode 100644
index 2d7708e6684f..000000000000
--- a/sys-devel/gcc/gcc-3.2.2-r1.ebuild
+++ /dev/null
@@ -1,519 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2-r1.ebuild,v 1.7 2003/04/12 19:47:21 azarah Exp $
-
-IUSE="static nls bootstrap java build"
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-# Theoretical cross compiler support
-[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
-
-LOC="/usr"
-MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
-MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
-
-LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
-BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
-DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
-# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
-# We will handle /usr/include/g++-v3/ with gcc-config ...
-STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
-
-# Patch tarball support ...
-#PATCH_VER="1.0"
-PATCH_VER=""
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-
-# Branch update support ...
-MAIN_BRANCH="${PV}" # Tarball, etc used ...
-#BRANCH_UPDATE="20021208"
-BRANCH_UPDATE=""
-
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${PN}-${MAIN_BRANCH}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${PN}-${MAIN_BRANCH}.tar.bz2"
-
- if [ -n "${PATCH_VER}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
- fi
-
- if [ -n "${BRANCH_UPDATE}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2"
- fi
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-#SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
-SRC_URI="${SRC_URI} mirror://gentoo/${P}-tls-update.patch.bz2"
-
-DESCRIPTION="The GNU Compiler Collection. Includes C/C++ and java compilers"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips"
-
-# Ok, this is a hairy one again, but lets assume that we
-# are not cross compiling, than we want SLOT to only contain
-# $PV, as people upgrading to new gcc layout will not have
-# their old gcc unmerged ...
-if [ "${CHOST}" == "${CCHOST}" ]
-then
- SLOT="${MY_PV}"
-else
- SLOT="${CCHOST}-${MY_PV}"
-fi
-
-DEPEND="virtual/glibc
- mips? >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18
- >=sys-devel/gcc-config-1.3.1
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.3.1
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-PDEPEND="sys-devel/gcc-config"
-
-
-# Hack used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-chk_gcc_version() {
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-
- # Did we check the version ?
- touch ${WORKDIR}/.chkgccversion
-}
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${PN}-${MAIN_BRANCH}.tar.bz2
-
- if [ -n "${PATCH_VER}" ]
- then
- unpack ${P}-patches-${PATCH_VER}.tar.bz2
- fi
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- echo
-
- # Branch update ...
- if [ -n "${BRANCH_UPDATE}" ]
- then
- epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2
- fi
-
- # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
- if [ -n "${PATCH_VER}" ]
- then
- epatch ${WORKDIR}/patch
- fi
-
- # Update to support TLS and __thread
- epatch ${DISTDIR}/${P}-tls-update.patch.bz2
-
- # Patches from Redhat ...
-# epatch ${FILESDIR}/3.2.1/gcc32-ada-make.patch
-# epatch ${FILESDIR}/3.2.1/gcc32-shared-pthread.patch
- use sparc && epatch ${FILESDIR}/3.2.1/gcc32-sparc32-hack.patch
-
- # Patches from Mandrake/Suse ...
- epatch ${FILESDIR}/3.2.1/gcc31-loop-load-final-value.patch
- epatch ${FILESDIR}/3.2.1/gcc32-pr8213.patch
- epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch
- epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch
-
- # Patches from debian-arm
- if [ "${ARCH}" = "arm" ]; then
- epatch ${FILESDIR}/3.2.1/gcc32-arm-disable-mathf.patch
- epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch
- fi
-
- # Install our pre generated manpages if we do not have perl ...
-# if [ ! -x /usr/bin/perl ]
-# then
-# cd ${S}; unpack ${P}-manpages.tar.bz2
-# fi
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- einfo "Fixing Makefiles..."
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
- # Fix --datadir=
- cp ${x} ${x}.orig
- sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
- ${x}.orig > ${x}
-
- # Fix --bindir=
- cp ${x} ${x}.orig
- sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
- ${x}.orig > ${x}
-
- # Fix --includedir=
- cp ${x} ${x}.orig
- sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
- ${x}.orig > ${x}
-
- # Fix --with-gxx-include-dir=
- cp ${x} ${x}.orig
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
-
- # Where java security stuff should be installed
- cp ${x} ${x}.orig
- sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
- ${x}.orig > ${x}
-
- rm -f ${x}.orig
- done
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
-
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # In general gcc does not like optimization, and add -O2 where
- # it is safe.
- export CFLAGS="${CFLAGS//-O?}"
- export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- einfo "Configuring GCC..."
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --bindir=${BINPATH} \
- --includedir=${LIBPATH}/include \
- --datadir=${DATAPATH} \
- --mandir=${DATAPATH}/man \
- --infodir=${DATAPATH}/info \
- --enable-shared \
- --host=${CHOST} \
- --target=${CCHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- # Do not make manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- find ${S} -name '*.[17]' -exec touch {} \; || :
- fi
-
- # Setup -j in MAKEOPTS
- get_number_of_jobs
-
- einfo "Building GCC..."
- # Only build it static if we are just building the C frontend, else
- # a lot of things break because there are not libstdc++.so ....
- if [ -n "`use static`" -a "${gcc_lang}" = "c" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake LDFLAGS="-static" bootstrap \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- einfo "Installing GCC..."
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- bindir=${D}${BINPATH} \
- includedir=${D}${LIBPATH}/include \
- datadir=${D}${DATAPATH} \
- mandir=${D}${DATAPATH}/man \
- infodir=${D}${DATAPATH}/info \
- LIBPATH="${LIBPATH}" \
- FAKE_ROOT="${D}" \
- install || die
-
- [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
-
- dodir /lib /usr/bin
- dodir /etc/env.d/gcc
- echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
-
- # Install wrappers
-# Handled by gcc-config now ...
-# exeinto /lib
-# doexe ${FILESDIR}/cpp
-# exeinto /usr/bin
-# doexe ${FILESDIR}/cc
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${D}${LIBPATH}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${D}${LIBPATH}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- dodir /${LIBPATH}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
- [ -f jar ] && mv -f jar gcj-jar
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
-
- # These should be symlinks
- cd ${D}${BINPATH}
- rm -f ${CCHOST}-{gcc,g++,c++,g77}
- [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
- [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
- [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
- [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /${CCHOST}
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto ${CCHOST}/html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto ${CCHOST}/boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto ${CCHOST}/boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto ${CCHOST}/gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto ${CCHOST}/libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto ${CCHOST}/libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto ${CCHOST}/libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto ${CCHOST}/libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto ${CCHOST}/libstdc++-v3
- dodoc ChangeLog* README
- docinto ${CCHOST}/libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto ${CCHOST}/fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto ${CCHOST}/libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Rather install the script, else portage with changing $FILESDIR
- # between binary and source package borks things ....
- insinto /lib/rcscripts/awk
- doins ${FILESDIR}/awk/fixlafiles.awk
- exeinto /sbin
- doexe ${FILESDIR}/fix_libtool_files.sh
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_preinst() {
-
- if [ ! -f "${WORKDIR}/.chkgccversion" ]
- then
- chk_gcc_version
- fi
-
- # Make again sure that the linker "should" be able to locate
- # libstdc++.so ...
- export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
- ${ROOT}/sbin/ldconfig
-}
-
-pkg_postinst() {
-
- export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
-
- if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" = "${CCHOST}" ]
- then
- gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
- fi
-
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- /sbin/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-
diff --git a/sys-devel/gcc/gcc-3.2.2-r3.ebuild b/sys-devel/gcc/gcc-3.2.2-r3.ebuild
deleted file mode 100644
index 31ad44142235..000000000000
--- a/sys-devel/gcc/gcc-3.2.2-r3.ebuild
+++ /dev/null
@@ -1,555 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2-r3.ebuild,v 1.18 2003/05/16 06:01:38 frogger Exp $
-
-IUSE="static nls bootstrap java build"
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-# We don't need these since we strip-flags below -- Joshua
-#filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-
-# We allow known good gcc optimizations now (only for x86)
-# Joshua Brindle <method@gentoo.org> (04 Mar 2003)
-if [ "${ARCH}" = "x86" ]; then
- ALLOWED_FLAGS="-O -O1 -O2 -Os -O3 -mcpu -march -pipe -g -freorder-blocks -fprefetch-loop-arrays"
- #Bug #16867, -march=pentium4 does not work, we'll replace it with -march=pentium3
- replace-flags "-march=pentium4" "-march=pentium3"
-fi
-
-strip-flags
-
-# Theoretical cross compiler support
-[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
-
-LOC="/usr"
-MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
-MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
-
-LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
-BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
-DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
-# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
-# We will handle /usr/include/g++-v3/ with gcc-config ...
-STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
-
-# ProPolice version
-PP_VER1="3_2_2"
-PP_VER2="3.2.2-7"
-
-# Patch tarball support ...
-#PATCH_VER="1.0"
-PATCH_VER=""
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-
-# Branch update support ...
-MAIN_BRANCH="${PV}" # Tarball, etc used ...
-#BRANCH_UPDATE="20021208"
-BRANCH_UPDATE="20030322"
-
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${PN}-${MAIN_BRANCH}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${PN}-${MAIN_BRANCH}.tar.bz2"
-
- if [ -n "${PATCH_VER}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
- fi
-
- if [ -n "${BRANCH_UPDATE}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2"
- fi
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-#SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
-SRC_URI="${SRC_URI}
- http://www.trl.ibm.com/projects/security/ssp/gcc${PP_VER1}/protector-${PP_VER2}.tar.gz
- mirror://gentoo/${P}-tls-update2.patch.bz2"
-
-DESCRIPTION="The GNU Compiler Collection. Includes C/C++ and java compilers"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips"
-
-# Ok, this is a hairy one again, but lets assume that we
-# are not cross compiling, than we want SLOT to only contain
-# $PV, as people upgrading to new gcc layout will not have
-# their old gcc unmerged ...
-if [ "${CHOST}" == "${CCHOST}" ]
-then
- SLOT="${MY_PV}"
-else
- SLOT="${CCHOST}-${MY_PV}"
-fi
-
-DEPEND="virtual/glibc
- mips? >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18
- >=sys-devel/gcc-config-1.3.1
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.3.1
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-PDEPEND="sys-devel/gcc-config"
-
-
-# Hack used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-chk_gcc_version() {
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-
- # Did we check the version ?
- touch ${WORKDIR}/.chkgccversion
-}
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${PN}-${MAIN_BRANCH}.tar.bz2
-
- if [ -n "${PATCH_VER}" ]
- then
- unpack ${P}-patches-${PATCH_VER}.tar.bz2
- fi
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- unpack protector-${PP_VER2}.tar.gz
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- echo
-
- # Branch update ...
- if [ -n "${BRANCH_UPDATE}" ]
- then
- epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2
- fi
-
- # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
- if [ -n "${PATCH_VER}" ]
- then
- epatch ${WORKDIR}/patch
- fi
-
- # Update to support TLS and __thread
- epatch ${DISTDIR}/${P}-tls-update2.patch.bz2
-
- # Patches from Redhat ...
-# epatch ${FILESDIR}/3.2.1/gcc32-ada-make.patch
-# epatch ${FILESDIR}/3.2.1/gcc32-shared-pthread.patch
- use sparc && epatch ${FILESDIR}/3.2.1/gcc32-sparc32-hack.patch
-
- # Patches from Mandrake/Suse ...
- epatch ${FILESDIR}/3.2.1/gcc31-loop-load-final-value.patch
- epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch
- epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch
-
- # ProPolice Stack Smashing protection - protector-3.2.2-7
- epatch ${WORKDIR}/protector.dif
- cp ${WORKDIR}/protector.c ${WORKDIR}/${P}/gcc/ || die "protector.c not found"
- cp ${WORKDIR}/protector.h ${WORKDIR}/${P}/gcc/ || die "protector.h not found"
- epatch ${FILESDIR}/3.2.2/gcc-322-r3-propolice-version.patch
-
- # GCC bugfixes ...
- epatch ${FILESDIR}/3.2.2/gcc32-pr7768.patch
- epatch ${FILESDIR}/3.2.2/gcc32-pr8213.patch
-# epatch ${FILESDIR}/3.2.2/gcc32-pr9732.patch
-# epatch ${FILESDIR}/3.2.2/gcc322-pr9888.patch
- epatch ${FILESDIR}/3.2.2/gcc322-pr8746.patch
-
- # Patches from debian-arm
- if [ "${ARCH}" = "arm" ]
- then
- epatch ${FILESDIR}/3.2.1/gcc32-arm-disable-mathf.patch
- epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch
- fi
-
- # Get gcc to decreases the number of times the collector has to be run
- # by increasing its memory workspace, bug #16548.
- epatch ${FILESDIR}/3.2.2/gcc322-ggc_page-speedup.patch
-
- # Install our pre generated manpages if we do not have perl ...
-# if [ ! -x /usr/bin/perl ]
-# then
-# cd ${S}; unpack ${P}-manpages.tar.bz2
-# fi
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- einfo "Fixing Makefiles..."
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
- # Fix --datadir=
- cp ${x} ${x}.orig
- sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
- ${x}.orig > ${x}
-
- # Fix --bindir=
- cp ${x} ${x}.orig
- sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
- ${x}.orig > ${x}
-
- # Fix --includedir=
- cp ${x} ${x}.orig
- sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
- ${x}.orig > ${x}
-
- # Fix --with-gxx-include-dir=
- cp ${x} ${x}.orig
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
-
- # Where java security stuff should be installed
- cp ${x} ${x}.orig
- sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
- ${x}.orig > ${x}
-
- rm -f ${x}.orig
- done
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
-
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # In general gcc does not like optimization, and add -O2 where
- # it is safe.
- # These aren't needed since we strip-flags above -- Joshua
- #export CFLAGS="${CFLAGS//-O?}"
- #export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- einfo "Configuring GCC..."
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --bindir=${BINPATH} \
- --includedir=${LIBPATH}/include \
- --datadir=${DATAPATH} \
- --mandir=${DATAPATH}/man \
- --infodir=${DATAPATH}/info \
- --enable-shared \
- --host=${CHOST} \
- --target=${CCHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- # Do not make manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- find ${S} -name '*.[17]' -exec touch {} \; || :
- fi
-
- # Setup -j in MAKEOPTS
- get_number_of_jobs
-
- einfo "Building GCC..."
- # Only build it static if we are just building the C frontend, else
- # a lot of things break because there are not libstdc++.so ....
- if [ -n "`use static`" -a "${gcc_lang}" = "c" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake LDFLAGS="-static" bootstrap \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- eerror "CFLAGS = ${CFLAGS}"
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- einfo "Installing GCC..."
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- bindir=${D}${BINPATH} \
- includedir=${D}${LIBPATH}/include \
- datadir=${D}${DATAPATH} \
- mandir=${D}${DATAPATH}/man \
- infodir=${D}${DATAPATH}/info \
- LIBPATH="${LIBPATH}" \
- FAKE_ROOT="${D}" \
- install || die
-
- [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
-
- dodir /lib /usr/bin
- dodir /etc/env.d/gcc
- echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
-
- # Install wrappers
-# Handled by gcc-config now ...
-# exeinto /lib
-# doexe ${FILESDIR}/cpp
-# exeinto /usr/bin
-# doexe ${FILESDIR}/cc
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${D}${LIBPATH}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${D}${LIBPATH}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- dodir /${LIBPATH}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
- [ -f jar ] && mv -f jar gcj-jar
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
-
- # These should be symlinks
- cd ${D}${BINPATH}
- rm -f ${CCHOST}-{gcc,g++,c++,g77}
- [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
- [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
- [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
- [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /${CCHOST}
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto ${CCHOST}/html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto ${CCHOST}/boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto ${CCHOST}/boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto ${CCHOST}/gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto ${CCHOST}/libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto ${CCHOST}/libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto ${CCHOST}/libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto ${CCHOST}/libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto ${CCHOST}/libstdc++-v3
- dodoc ChangeLog* README
- docinto ${CCHOST}/libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto ${CCHOST}/fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto ${CCHOST}/libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Rather install the script, else portage with changing $FILESDIR
- # between binary and source package borks things ....
- insinto /lib/rcscripts/awk
- doins ${FILESDIR}/awk/fixlafiles.awk
- exeinto /sbin
- doexe ${FILESDIR}/fix_libtool_files.sh
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_preinst() {
-
- if [ ! -f "${WORKDIR}/.chkgccversion" ]
- then
- chk_gcc_version
- fi
-
- # Make again sure that the linker "should" be able to locate
- # libstdc++.so ...
- export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
- ${ROOT}/sbin/ldconfig
-}
-
-pkg_postinst() {
-
- export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
-
- if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" = "${CCHOST}" ]
- then
- gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
- fi
-
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- /sbin/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
diff --git a/sys-devel/gcc/gcc-3.2.3.ebuild b/sys-devel/gcc/gcc-3.2.3.ebuild
deleted file mode 100644
index 23086f32a946..000000000000
--- a/sys-devel/gcc/gcc-3.2.3.ebuild
+++ /dev/null
@@ -1,556 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.3.ebuild,v 1.1 2003/04/28 02:40:34 azarah Exp $
-
-IUSE="static nls bootstrap java build"
-
-inherit eutils flag-o-matic libtool
-
-# Compile problems with these (bug #6641 among others)...
-# We don't need these since we strip-flags below -- Joshua
-#filter-flags "-fno-exceptions -fomit-frame-pointer"
-
-# Recently there has been a lot of stability problem in Gentoo-land. Many
-# things can be the cause to this, but I believe that it is due to gcc3
-# still having issues with optimizations, or with it not filtering bad
-# combinations (protecting the user maybe from himeself) yet.
-#
-# This can clearly be seen in large builds like glibc, where too aggressive
-# CFLAGS cause the tests to fail miserbly.
-#
-# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
-# knows what he is talking about:
-#
-# People really shouldn't force code-specific options on... It's a
-# bad idea. The -march options aren't just to look pretty. They enable
-# options that are sensible (and include sse,mmx,3dnow when apropriate).
-#
-# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
-# you do not like it, comment it, but do not bugreport if you run into
-# problems.
-#
-# <azarah@gentoo.org> (13 Oct 2002)
-strip-flags
-
-# Theoretical cross compiler support
-[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
-
-LOC="/usr"
-MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
-MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
-
-LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
-BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
-DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
-# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
-# We will handle /usr/include/g++-v3/ with gcc-config ...
-STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
-
-# ProPolice version
-PP_VER1="3_2_2"
-PP_VER2="3.2.2-6"
-
-# Patch tarball support ...
-#PATCH_VER="1.0"
-PATCH_VER=""
-
-# Snapshot support ...
-#SNAPSHOT="2002-08-12"
-SNAPSHOT=""
-
-# Branch update support ...
-MAIN_BRANCH="${PV}" # Tarball, etc used ...
-
-#BRANCH_UPDATE="20021208"
-BRANCH_UPDATE=""
-
-if [ -z "${SNAPSHOT}" ]
-then
- S="${WORKDIR}/${PN}-${MAIN_BRANCH}"
- SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${PN}-${MAIN_BRANCH}.tar.bz2"
-
- if [ -n "${PATCH_VER}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
- fi
-
- if [ -n "${BRANCH_UPDATE}" ]
- then
- SRC_URI="${SRC_URI}
- mirror://gentoo/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2"
- fi
-else
- S="${WORKDIR}/gcc-${SNAPSHOT//-}"
- SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
-fi
-#SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
-SRC_URI="${SRC_URI}
- http://www.trl.ibm.com/projects/security/ssp/gcc${PP_VER1}/protector-${PP_VER2}.tar.gz
- mirror://gentoo/${P}-tls-update.patch.bz2"
-
-DESCRIPTION="The GNU Compiler Collection. Includes C/C++ and java compilers"
-HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
-
-LICENSE="GPL-2 LGPL-2.1"
-KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips"
-
-# Ok, this is a hairy one again, but lets assume that we
-# are not cross compiling, than we want SLOT to only contain
-# $PV, as people upgrading to new gcc layout will not have
-# their old gcc unmerged ...
-if [ "${CHOST}" == "${CCHOST}" ]
-then
- SLOT="${MY_PV}"
-else
- SLOT="${CCHOST}-${MY_PV}"
-fi
-
-DEPEND="virtual/glibc
- mips? >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18
- >=sys-devel/gcc-config-1.3.1
- !build? ( >=sys-libs/ncurses-5.2-r2
- nls? ( sys-devel/gettext ) )"
-
-RDEPEND="virtual/glibc
- >=sys-devel/gcc-config-1.3.1
- >=sys-libs/zlib-1.1.4
- >=sys-apps/texinfo-4.2-r4
- !build? ( >=sys-libs/ncurses-5.2-r2 )"
-
-PDEPEND="sys-devel/gcc-config"
-
-
-# Hack used to patch Makefiles to install into the build dir
-FAKE_ROOT=""
-
-chk_gcc_version() {
- # This next bit is for updating libtool linker scripts ...
- OLD_GCC_VERSION="`gcc -dumpversion`"
-
- if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
- then
- echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
- fi
-
- # Did we check the version ?
- touch ${WORKDIR}/.chkgccversion
-}
-
-version_patch() {
- [ ! -f "$1" ] && return 1
-
- sed -e "s:@PV@:${PVR}:g" ${1} > ${T}/${1##*/}
- epatch ${T}/${1##*/}
-}
-
-src_unpack() {
- if [ -z "${SNAPSHOT}" ]
- then
- unpack ${PN}-${MAIN_BRANCH}.tar.bz2
-
- if [ -n "${PATCH_VER}" ]
- then
- unpack ${P}-patches-${PATCH_VER}.tar.bz2
- fi
- else
- unpack gcc-${SNAPSHOT//-}.tar.bz2
- fi
-
- unpack protector-${PP_VER2}.tar.gz
-
- cd ${S}
- # Fixup libtool to correctly generate .la files with portage
- elibtoolize --portage --shallow
-
- echo
-
- # Branch update ...
- if [ -n "${BRANCH_UPDATE}" ]
- then
- epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2
- fi
-
- # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
- if [ -n "${PATCH_VER}" ]
- then
- epatch ${WORKDIR}/patch
- fi
-
- # Update to support TLS and __thread
- epatch ${DISTDIR}/${P}-tls-update.patch.bz2
-
- # Make gcc's version info specific to Gentoo
- version_patch ${FILESDIR}/3.2.3/gcc323-gentoo-branding.patch
-
- # ProPolice Stack Smashing protection - protector-3.2.2-6
- cd ${WORKDIR}; epatch ${FILESDIR}/3.2.3/protector-3.2.2-6-PPC.patch; cd ${S}
- epatch ${WORKDIR}/protector.dif
- epatch ${FILESDIR}/3.2.2/protector_parallel_make.patch
- cp ${WORKDIR}/protector.c ${WORKDIR}/${P}/gcc/ || die "protector.c not found"
- cp ${WORKDIR}/protector.h ${WORKDIR}/${P}/gcc/ || die "protector.h not found"
- version_patch ${FILESDIR}/3.2.3/gcc-323-propolice-version.patch
-
- # Patches from Mandrake/Suse ...
- epatch ${FILESDIR}/3.2.1/gcc31-loop-load-final-value.patch
- epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch
- epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch
- epatch ${FILESDIR}/3.2.3/gcc32-c++-classfn-member-template.patch
- epatch ${FILESDIR}/3.2.3/gcc32-mklibgcc-serialize-crtfiles.patch
-
- # GCC bugfixes ...
- epatch ${FILESDIR}/3.2.2/gcc32-pr7768.patch
- epatch ${FILESDIR}/3.2.2/gcc32-pr8213.patch
-
- # Get gcc to decreases the number of times the collector has to be run
- # by increasing its memory workspace, bug #16548.
- epatch ${FILESDIR}/3.2.2/gcc322-ggc_page-speedup.patch
-
- # sparc patches from Redhat ...
- use sparc && epatch ${FILESDIR}/3.2.1/gcc32-sparc32-hack.patch
-
- # Patches from debian-arm
- if use arm
- then
- epatch ${FILESDIR}/3.2.1/gcc32-arm-disable-mathf.patch
- epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch
- fi
-
- # Install our pre generated manpages if we do not have perl ...
-# if [ ! -x /usr/bin/perl ]
-# then
-# cd ${S}; unpack ${P}-manpages.tar.bz2
-# fi
-
- # Currently if any path is changed via the configure script, it breaks
- # installing into ${D}. We should not patch it in src_install() with
- # absolute paths, as some modules then gets rebuild with the wrong
- # paths. Thus we use $FAKE_ROOT.
- einfo "Fixing Makefiles..."
- cd ${S}
- for x in $(find . -name Makefile.in)
- do
- # Fix --datadir=
- cp ${x} ${x}.orig
- sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
- ${x}.orig > ${x}
-
- # Fix --bindir=
- cp ${x} ${x}.orig
- sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
- ${x}.orig > ${x}
-
- # Fix --includedir=
- cp ${x} ${x}.orig
- sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
- ${x}.orig > ${x}
-
- # Fix --with-gxx-include-dir=
- cp ${x} ${x}.orig
- sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
- -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
- ${x}.orig > ${x}
-
- # Where java security stuff should be installed
- cp ${x} ${x}.orig
- sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
- ${x}.orig > ${x}
-
- rm -f ${x}.orig
- done
-}
-
-src_compile() {
- local myconf=""
- local gcc_lang=""
-
- if [ -z "`use build`" ]
- then
- myconf="${myconf} --enable-shared"
- gcc_lang="c,c++,ada,f77,objc"
- else
- gcc_lang="c"
- fi
- if [ -z "`use nls`" ] || [ "`use build`" ]
- then
- myconf="${myconf} --disable-nls"
- else
- myconf="${myconf} --enable-nls --without-included-gettext"
- fi
- if [ -n "`use java`" ] && [ -z "`use build`" ]
- then
- gcc_lang="${gcc_lang},java"
- fi
-
- # In general gcc does not like optimization, and add -O2 where
- # it is safe.
- # These aren't needed since we strip-flags above -- Joshua
- #export CFLAGS="${CFLAGS//-O?}"
- #export CXXFLAGS="${CXXFLAGS//-O?}"
-
- # Build in a separate build tree
- mkdir -p ${WORKDIR}/build
- cd ${WORKDIR}/build
-
- einfo "Configuring GCC..."
- addwrite "/dev/zero"
- ${S}/configure --prefix=${LOC} \
- --bindir=${BINPATH} \
- --includedir=${LIBPATH}/include \
- --datadir=${DATAPATH} \
- --mandir=${DATAPATH}/man \
- --infodir=${DATAPATH}/info \
- --enable-shared \
- --host=${CHOST} \
- --target=${CCHOST} \
- --with-system-zlib \
- --enable-languages=${gcc_lang} \
- --enable-threads=posix \
- --enable-long-long \
- --disable-checking \
- --enable-cstdio=stdio \
- --enable-clocale=generic \
- --enable-__cxa_atexit \
- --enable-version-specific-runtime-libs \
- --with-gxx-include-dir=${STDCXX_INCDIR} \
- --with-local-prefix=${LOC}/local \
- ${myconf} || die
-
- touch ${S}/gcc/c-gperf.h
-
- # Do not make manpages if we do not have perl ...
- if [ ! -x /usr/bin/perl ]
- then
- find ${S} -name '*.[17]' -exec touch {} \; || :
- fi
-
- # Setup -j in MAKEOPTS
- get_number_of_jobs
-
- einfo "Building GCC..."
- # Only build it static if we are just building the C frontend, else
- # a lot of things break because there are not libstdc++.so ....
- if [ -n "`use static`" -a "${gcc_lang}" = "c" ]
- then
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake LDFLAGS="-static" bootstrap \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- # Above FLAGS optimize and speedup build, thanks
- # to Jeff Garzik <jgarzik@mandrakesoft.com>
- else
- # Fix for our libtool-portage.patch
- S="${WORKDIR}/build" \
- emake bootstrap-lean \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
- fi
-}
-
-src_install() {
- # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
- # this can break the build.
- for x in cd ${WORKDIR}/build/gcc/include/*
- do
- if [ -L ${x} ]
- then
- rm -f ${x}
- fi
- done
-
- einfo "Installing GCC..."
- # Do the 'make install' from the build directory
- cd ${WORKDIR}/build
- S="${WORKDIR}/build" \
- make prefix=${D}${LOC} \
- bindir=${D}${BINPATH} \
- includedir=${D}${LIBPATH}/include \
- datadir=${D}${DATAPATH} \
- mandir=${D}${DATAPATH}/man \
- infodir=${D}${DATAPATH}/info \
- LIBPATH="${LIBPATH}" \
- FAKE_ROOT="${D}" \
- install || die
-
- [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
-
- dodir /lib /usr/bin
- dodir /etc/env.d/gcc
- echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- # Also set CC and CXX
- echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
- echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
-
- # Install wrappers
-# Handled by gcc-config now ...
-# exeinto /lib
-# doexe ${FILESDIR}/cpp
-# exeinto /usr/bin
-# doexe ${FILESDIR}/cc
-
- # Make sure we dont have stuff lying around that
- # can nuke multiple versions of gcc
- if [ -z "`use build`" ]
- then
- cd ${D}${LIBPATH}
-
- # Tell libtool files where real libraries are
- for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
- do
- if [ -f ${LA} ]
- then
- sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
- mv ${LA}.hacked ${LA}
- mv ${LA} ${D}${LIBPATH}
- fi
- done
-
- # Move all the libraries to version specific libdir.
- for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
- done
-
- # Move Java headers to compiler-specific dir
- for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
- do
- [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
- done
- for x in gcj gnu java javax org
- do
- if [ -d ${D}${LOC}/include/${x} ]
- then
- dodir /${LIBPATH}/include/${x}
- mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
- rm -rf ${D}${LOC}/include/${x}
- fi
- done
-
- # Move libgcj.spec to compiler-specific directories
- [ -f ${D}${LOC}/lib/libgcj.spec ] && \
- mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
- cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
- [ -f jar ] && mv -f jar gcj-jar
-
- # Move <cxxabi.h> to compiler-specific directories
- [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
- mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
-
- # These should be symlinks
- cd ${D}${BINPATH}
- rm -f ${CCHOST}-{gcc,g++,c++,g77}
- [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
- [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
- [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
- [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
- fi
-
- # This one comes with binutils
- if [ -f ${D}${LOC}/lib/libiberty.a ]
- then
- rm -f ${D}${LOC}/lib/libiberty.a
- fi
-
- cd ${S}
- if [ -z "`use build`" ]
- then
- cd ${S}
- docinto /${CCHOST}
- dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
- docinto ${CCHOST}/html
- dohtml *.html
- cd ${S}/boehm-gc
- docinto ${CCHOST}/boehm-gc
- dodoc ChangeLog doc/{README*,barrett_diagram}
- docinto ${CCHOST}/boehm-gc/html
- dohtml doc/*.html
- cd ${S}/gcc
- docinto ${CCHOST}/gcc
- dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
- cd ${S}/libf2c
- docinto ${CCHOST}/libf2c
- dodoc ChangeLog README TODO *.netlib
- cd ${S}/libffi
- docinto ${CCHOST}/libffi
- dodoc ChangeLog* LICENSE README
- cd ${S}/libiberty
- docinto ${CCHOST}/libiberty
- dodoc ChangeLog COPYING.LIB README
- cd ${S}/libobjc
- docinto ${CCHOST}/libobjc
- dodoc ChangeLog README* THREADS*
- cd ${S}/libstdc++-v3
- docinto ${CCHOST}/libstdc++-v3
- dodoc ChangeLog* README
- docinto ${CCHOST}/libstdc++-v3/html
- dohtml -r -a css,diff,html,txt,xml docs/html/*
- cp -f docs/html/17_intro/[A-Z]* \
- ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
-
- if [ -n "`use java`" ]
- then
- cd ${S}/fastjar
- docinto ${CCHOST}/fastjar
- dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
- cd ${S}/libjava
- docinto ${CCHOST}/libjava
- dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
- fi
- else
- rm -rf ${D}/usr/share/{man,info}
- fi
-
- # Rather install the script, else portage with changing $FILESDIR
- # between binary and source package borks things ....
- insinto /lib/rcscripts/awk
- doins ${FILESDIR}/awk/fixlafiles.awk
- exeinto /sbin
- doexe ${FILESDIR}/fix_libtool_files.sh
-
- # Fix ncurses b0rking
- find ${D}/ -name '*curses.h' -exec rm -f {} \;
-}
-
-pkg_preinst() {
-
- if [ ! -f "${WORKDIR}/.chkgccversion" ]
- then
- chk_gcc_version
- fi
-
- # Make again sure that the linker "should" be able to locate
- # libstdc++.so ...
- export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
- ${ROOT}/sbin/ldconfig
-}
-
-pkg_postinst() {
-
- export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}"
-
- if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" = "${CCHOST}" ]
- then
- gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
- fi
-
- # Update libtool linker scripts to reference new gcc version ...
- if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
- then
- OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
-
- /sbin/fix_libtool_files.sh ${OLD_GCC_VERSION}
- fi
-
- # Fix ncurses b0rking (if r5 isn't unmerged)
- find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
-}
-