diff -ur ./gcc-3.4.0/gcc/ChangeLog~ ./gcc-3.4.0/gcc/ChangeLog --- ./gcc-3.4.0/gcc/ChangeLog~ 2004-04-19 02:58:10.000000000 +0100 +++ ./gcc-3.4.0/gcc/ChangeLog 2007-01-09 06:52:02.000000000 +0000 @@ -1,3 +1,46 @@ +2006-12-25 George Helffrich + + * config/i386/i386.c: Parse addresses better in order to be able + to handle adds with base, index and displacement in any order + (addition is commutative, after all). Allows for Fortran arrays + located in COMMON or SAVE areas to work properly. + + * config/darwin.c: Enable DWARF-2 debugging info, but leave STABS as + default. Note: DWARF-2 does not work with MacOS X 10.4 GDB, so using + this feature is pointless. + * config/darwin.h: Ditto. + + * version.c: Bump version. + +2006-12-13 George Helffrich + + * recog.c: Fix problems with i386 insn recognition of SETs that + use array indices located in Fortran common to index an array also in + Fortran common. insn not properly recognized because it caused + CLOBBERS of hard regs that weren't allowed for at recognition time. + + * function.c: Ditto. + + * version.c: Identify changes. + +2006-09-30 George Helffrich + + * config/i386/i386.c: Handle i386 builds with new Xcode release with + NASM assembler. jmp instruction syntax is more strict. + +2006-06-17 George Helffrich + + * config/darwin-crt2.c: Handle i386 builds; _init_keymgr not + defined in ABI and call not needed on i386 arch. + +2004-07-26 George Helffrich + + * dbxout.c: Change .stabs output for symbols in .comm (Fortran common) + to 1) bracket .stabs group of symbols with N_BCOMM/N_ECOMM; and + 2) change N_LCSYM to N_GSYM for .comm symbols for compatibility with + Sun Fortran and "official" .stabs documentation. + * xcoffout.h: Add check for symbol scope in DBX_FINISH_SYMBOL. + 2004-04-18 Release Manager * GCC 3.4.0 released. diff -ur ./gcc-3.4.0/gcc/config/darwin-crt2.c~ ./gcc-3.4.0/gcc/config/darwin-crt2.c --- ./gcc-3.4.0/gcc/config/darwin-crt2.c~ 2002-11-07 06:00:05.000000000 +0000 +++ ./gcc-3.4.0/gcc/config/darwin-crt2.c 2007-01-09 06:52:02.000000000 +0000 @@ -47,7 +47,12 @@ extern void __darwin_gcc3_preregister_frame_info (void); /* These are from "keymgr.h". */ +#if defined(__ppc__) extern void _init_keymgr (void); +#endif +#if defined(__i386__) +#define _init_keymgr(a) /* NULL */ +#endif extern void *_keymgr_get_and_lock_processwide_ptr (unsigned key); extern void _keymgr_set_and_unlock_processwide_ptr (unsigned key, void *ptr); diff -ur ./gcc-3.4.0/gcc/config/darwin-protos.h~ ./gcc-3.4.0/gcc/config/darwin-protos.h --- ./gcc-3.4.0/gcc/config/darwin-protos.h~ 2003-11-10 23:07:09.000000000 +0000 +++ ./gcc-3.4.0/gcc/config/darwin-protos.h 2007-01-09 06:52:02.000000000 +0000 @@ -119,5 +119,6 @@ extern void darwin_eh_frame_section (void); extern void darwin_globalize_label (FILE *, const char *); extern void darwin_assemble_visibility (tree, int); +extern void darwin_asm_named_section (const char *, unsigned int); extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *, const char *); diff -ur ./gcc-3.4.0/gcc/config/darwin.c~ ./gcc-3.4.0/gcc/config/darwin.c --- ./gcc-3.4.0/gcc/config/darwin.c~ 2003-11-14 01:47:55.000000000 +0000 +++ ./gcc-3.4.0/gcc/config/darwin.c 2007-01-09 06:52:02.000000000 +0000 @@ -1348,6 +1348,17 @@ "in this configuration; ignored"); } +void +darwin_asm_named_section (const char *name, unsigned int flags) +{ + const char *type = ""; + + if (flags & SECTION_DEBUG) + type = ", no_dead_strip"; + + fprintf (asm_out_file, "\t.section\t__TEXT, %s, regular%s\n", name, type); +} + /* Output a difference of two labels that will be an assembly time constant if the two labels are local. (.long lab1-lab2 will be very different if lab1 is at the boundary between two sections; it diff -ur ./gcc-3.4.0/gcc/config/darwin.h~ ./gcc-3.4.0/gcc/config/darwin.h --- ./gcc-3.4.0/gcc/config/darwin.h~ 2004-04-06 19:32:59.000000000 +0100 +++ ./gcc-3.4.0/gcc/config/darwin.h 2007-01-09 07:39:21.000000000 +0000 @@ -293,6 +293,13 @@ #define DBX_DEBUGGING_INFO 1 +/* We also use DWARF-2 symbol format. */ + +#define DWARF2_DEBUGGING_INFO 1 + +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + /* When generating stabs debugging, use N_BINCL entries. */ #define DBX_USE_BINCL @@ -331,6 +338,9 @@ #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE #define TARGET_ASM_FILE_START_FILE_DIRECTIVE false +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION darwin_asm_named_section + #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END darwin_file_end diff -ur ./gcc-3.4.0/gcc/config/i386/i386.c~ ./gcc-3.4.0/gcc/config/i386/i386.c --- ./gcc-3.4.0/gcc/config/i386/i386.c~ 2004-02-25 00:40:54.000000000 +0000 +++ ./gcc-3.4.0/gcc/config/i386/i386.c 2007-01-09 06:52:02.000000000 +0000 @@ -5515,6 +5515,7 @@ else if (GET_CODE (addr) == PLUS) { rtx addends[4], op; +#if 0 /* *** GRH MODS *** */ int n = 0, i; op = addr; @@ -5526,6 +5527,23 @@ op = XEXP (op, 0); } while (GET_CODE (op) == PLUS); +#else + int n = 0, i, adding = 1; + + op = addr; + do + { + if (n >= 4) + return 0; + if (GET_CODE (XEXP (op, 0)) == PLUS) + addends[n++] = XEXP (op, 1), op = XEXP (op, 0); + else if (GET_CODE (XEXP (op, 1)) == PLUS) + addends[n++] = XEXP (op, 0), op = XEXP (op, 1); + else + adding = 0, addends[n++] = XEXP (op, 0), op = XEXP (op, 1); + } + while (adding); +#endif if (n >= 4) return 0; addends[n] = op; @@ -15286,7 +15304,7 @@ { fprintf (file, "\tcall LPC$%d\nLPC$%d:\tpopl %%eax\n", label, label); fprintf (file, "\tmovl %s-LPC$%d(%%eax),%%edx\n", lazy_ptr_name, label); - fprintf (file, "\tjmp %%edx\n"); + fprintf (file, "\tjmp *%%edx\n"); } else fprintf (file, "\tjmp *%s\n", lazy_ptr_name); diff -ur ./gcc-3.4.0/gcc/dbxout.c~ ./gcc-3.4.0/gcc/dbxout.c --- ./gcc-3.4.0/gcc/dbxout.c~ 2004-01-16 01:44:06.000000000 +0000 +++ ./gcc-3.4.0/gcc/dbxout.c 2007-01-09 06:52:02.000000000 +0000 @@ -355,6 +355,8 @@ static void dbxout_class_name_qualifiers (tree); static int dbxout_symbol_location (tree, tree, const char *, rtx); static void dbxout_symbol_name (tree, const char *, int); +static void dbxout_common_name (tree, const char *, STAB_CODE_TYPE); +static const char *dbxout_common_check (tree, int *); static void dbxout_prepare_symbol (tree); static void dbxout_finish_symbol (tree); static void dbxout_block (tree, int, tree); @@ -2383,6 +2385,7 @@ { int letter = 0; int regno = -1; + int offs; emit_pending_bincls_if_required (); @@ -2446,7 +2449,15 @@ if (DECL_INITIAL (decl) == 0 || (!strcmp (lang_hooks.name, "GNU C++") && DECL_INITIAL (decl) == error_mark_node)) - current_sym_code = N_LCSYM; + { + current_sym_code = N_LCSYM; + if (NULL != dbxout_common_check (decl, &offs)) + { + current_sym_addr = 0; + current_sym_value = offs; + current_sym_code = N_GSYM; + } + } else if (DECL_IN_TEXT_SECTION (decl)) /* This is not quite right, but it's the closest of all the codes that Unix defines. */ @@ -2554,7 +2565,14 @@ this variable was itself `static'. */ current_sym_code = N_LCSYM; letter = 'V'; - current_sym_addr = XEXP (XEXP (home, 0), 0); + if (NULL == dbxout_common_check (decl, &offs)) + current_sym_addr = XEXP (XEXP (home, 0), 0); + else + { + current_sym_addr = 0; + current_sym_value = offs; + current_sym_code = N_GSYM; + } } else if (GET_CODE (home) == CONCAT) { @@ -2591,7 +2609,7 @@ /* Ok, start a symtab entry and output the variable name. */ FORCE_TEXT; - + #ifdef DBX_STATIC_BLOCK_START DBX_STATIC_BLOCK_START (asmfile, current_sym_code); #endif @@ -2603,6 +2621,7 @@ #ifdef DBX_STATIC_BLOCK_END DBX_STATIC_BLOCK_END (asmfile, current_sym_code); #endif + return 1; } @@ -2635,6 +2654,104 @@ if (letter) putc (letter, asmfile); } + +/* Output the common block name for DECL in a stabs. + + Symbols in global common (.comm) get wrapped with an N_BCOMM/N_ECOMM pair + around each group of symbols in the same .comm area. The N_GSYM stabs + that are emitted only contain the offset in the common area. This routine + emits the N_BCOMM and N_ECOMM stabs. */ + +static void +dbxout_common_name (tree decl, const char *name, STAB_CODE_TYPE op) +{ + fprintf (asmfile, "%s\"%s", ASM_STABS_OP, name); + current_sym_addr = NULL_RTX; + current_sym_value = 0; + current_sym_code = op; + dbxout_finish_symbol (decl); +} + +/* Check decl to determine whether it is a VAR_DECL destined for storage in a + common area. If it is, the return value will be a non-null string giving + the name of the common storage block it will go into. If non-null, the + value is the offset into the common block for that symbol's storage. */ + +static const char * +dbxout_common_check(tree decl, int *value) +{ + rtx home; + rtx sym_addr; + const char *name = NULL; + + if (TREE_CODE (decl) != VAR_DECL + || !DECL_COMMON (decl) + || !TREE_STATIC (decl)) + return NULL; + + home = DECL_RTL (decl); + if (GET_CODE (home) != MEM) + return NULL; + + sym_addr = XEXP (home, 0); + if (GET_CODE (sym_addr) == CONST) + sym_addr = XEXP (sym_addr, 0); + if ((GET_CODE (sym_addr) == SYMBOL_REF || GET_CODE (sym_addr) == PLUS) + && !TREE_PUBLIC (decl) + && (DECL_INITIAL (decl) == 0 + || (!strcmp (lang_hooks.name, "GNU C++") + && DECL_INITIAL (decl) == error_mark_node))) + { + + /* We have sym that will go into a common area, meaning that it + will get storage reserved with a .comm/.lcomm assembler pseudo-op. + + Determine name of common area this symbol will be an offset into, + and offset into that area. Also retrieve the decl for the area + that the symbol is offset into. */ + tree cdecl = NULL; + + switch (GET_CODE (sym_addr)) + { + case PLUS: + if (GET_CODE (XEXP (sym_addr, 0)) == CONST_INT) + { + name = + (* targetm.strip_name_encoding)(XSTR (XEXP (sym_addr, 1), 0)); + *value = INTVAL (XEXP (sym_addr, 0)); + cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 1)); + } + else + { + name = + (* targetm.strip_name_encoding)(XSTR (XEXP (sym_addr, 0), 0)); + *value = INTVAL (XEXP (sym_addr, 1)); + cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 0)); + } + break; + + case SYMBOL_REF: + name = (* targetm.strip_name_encoding)(XSTR (sym_addr, 0)); + *value = 0; + cdecl = SYMBOL_REF_DECL (sym_addr); + break; + + default: + error ("common symbol debug info is not structured as " + "symbol+offset"); + } + + /* Check area common symbol is offset into. If this is not public, then + it is not a symbol in a common block. It must be a .lcomm symbol, not + a .comm symbol. */ + if (cdecl == NULL || !TREE_PUBLIC(cdecl)) + name = NULL; + } + else + name = NULL; + + return name; +} static void dbxout_prepare_symbol (tree decl ATTRIBUTE_UNUSED) @@ -2673,18 +2790,45 @@ #endif } -/* Output definitions of all the decls in a chain. Return nonzero if - anything was output */ +/* Output definitions of all the decls in a chain. Bracket each group of + common symbols with N_BCOMM/N_ECOMM bracketing stabs. Return nonzero if + anything was output. */ int dbxout_syms (tree syms) { int result = 0; + const char *comm_prev = NULL; + tree syms_prev = NULL; while (syms) { + int temp, copen, cclos; + const char *comm_new; + + /* Check for common symbol, and then progression into a new/different + block of common symbols. Emit closing/opening common bracket if + necessary. */ + comm_new = dbxout_common_check (syms, &temp); + copen = comm_new != NULL + && (comm_prev == NULL || strcmp (comm_new, comm_prev)); + cclos = comm_prev != NULL + && (comm_new == NULL || strcmp (comm_new, comm_prev)); + if (cclos) + dbxout_common_name (syms, comm_prev, N_ECOMM); + if (copen) + { + dbxout_common_name (syms, comm_new, N_BCOMM); + syms_prev = syms; + } + comm_prev = comm_new; + result += dbxout_symbol (syms, 1); syms = TREE_CHAIN (syms); } + + if (comm_prev != NULL) + dbxout_common_name (syms_prev, comm_prev, N_ECOMM); + return result; } diff -ur ./gcc-3.4.0/gcc/function.c~ ./gcc-3.4.0/gcc/function.c --- ./gcc-3.4.0/gcc/function.c~ 2004-03-15 23:22:47.000000000 +0000 +++ ./gcc-3.4.0/gcc/function.c 2007-01-09 06:52:02.000000000 +0000 @@ -290,7 +290,7 @@ static void prepare_function_start (tree); static void do_clobber_return_reg (rtx, void *); static void do_use_return_reg (rtx, void *); -static void instantiate_virtual_regs_lossage (rtx); +static void instantiate_virtual_regs_lossage (rtx, char *); static tree split_complex_args (tree); static void set_insn_locators (rtx, int) ATTRIBUTE_UNUSED; @@ -3571,7 +3571,7 @@ to avoid failures later in the compilation process. */ if (asm_noperands (PATTERN (insn)) >= 0 && ! check_asm_operands (PATTERN (insn))) - instantiate_virtual_regs_lossage (insn); + instantiate_virtual_regs_lossage (insn, "scan"); } /* Instantiate the stack slots for the parm registers, for later use in @@ -3735,15 +3735,17 @@ Usually this means that non-matching instruction has been emit, however for asm statements it may be the problem in the constraints. */ static void -instantiate_virtual_regs_lossage (rtx insn) +instantiate_virtual_regs_lossage (rtx insn, char *note) { if (asm_noperands (PATTERN (insn)) >= 0) { error_for_asm (insn, "impossible constraint in `asm'"); delete_insn (insn); } - else + else { + warning ("Lossage type is %s", note); abort (); + } } /* Given a pointer to a piece of rtx and an optional pointer to the containing object, instantiate any virtual registers present in it. @@ -3820,7 +3822,7 @@ the simplest possible thing to handle them. */ if (GET_CODE (src) != REG && GET_CODE (src) != PLUS) { - instantiate_virtual_regs_lossage (object); + instantiate_virtual_regs_lossage (object, "SET PLUS/REG"); return 1; } @@ -3838,7 +3840,7 @@ if (! validate_change (object, &SET_SRC (x), temp, 0) || ! extra_insns) - instantiate_virtual_regs_lossage (object); + instantiate_virtual_regs_lossage (object, "SET SET_SRC"); return 1; } @@ -3949,7 +3951,8 @@ if (! validate_change (object, loc, temp, 0) && ! validate_replace_rtx (x, temp, object)) { - instantiate_virtual_regs_lossage (object); + print_rtl_single (stderr, x); + instantiate_virtual_regs_lossage (object, "PLUS"); return 1; } } @@ -4018,7 +4021,9 @@ if (temp == virtual_stack_vars_rtx || temp == virtual_incoming_args_rtx || (GET_CODE (temp) == PLUS - && CONSTANT_ADDRESS_P (XEXP (temp, 1)) + /* && CONSTANT_ADDRESS_P (XEXP (temp, 1)) ***GRH EDIT*** */ + && (CONSTANT_ADDRESS_P (XEXP (temp, 1)) + || CONSTANT_P (XEXP (temp, 1))) && (XEXP (temp, 0) == virtual_stack_vars_rtx || XEXP (temp, 0) == virtual_incoming_args_rtx))) { @@ -4107,7 +4112,7 @@ emit_insn_before (seq, object); if (! validate_change (object, loc, temp, 0) && ! validate_replace_rtx (x, temp, object)) - instantiate_virtual_regs_lossage (object); + instantiate_virtual_regs_lossage (object, "REGS"); } } diff -ur ./gcc-3.4.0/gcc/recog.c~ ./gcc-3.4.0/gcc/recog.c --- ./gcc-3.4.0/gcc/recog.c~ 2004-01-23 23:49:54.000000000 +0000 +++ ./gcc-3.4.0/gcc/recog.c 2007-01-09 06:52:02.000000000 +0000 @@ -260,14 +260,23 @@ { rtx pat = PATTERN (insn); int num_clobbers = 0; + /* If we are before reload and the pattern is a SET, see if we can add clobbers. */ +#if 0 /* *** GRH MODS *** */ int icode = recog (pat, insn, (GET_CODE (pat) == SET && ! reload_completed && ! reload_in_progress) ? &num_clobbers : 0); int is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0; - +#else + int icode, is_asm; + if (GET_CODE (pat) != SET || reload_completed || reload_in_progress) + icode = recog (pat, insn, 0); + else + icode = recog (pat, insn, &num_clobbers); + is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0; +#endif /* If this is an asm and the operand aren't legal, then fail. Likewise if this is not an asm and the insn wasn't recognized. */ @@ -282,6 +291,7 @@ { rtx newpat; +#if 0 /* *** GRH MODS *** */ if (added_clobbers_hard_reg_p (icode)) return 1; @@ -289,6 +299,21 @@ XVECEXP (newpat, 0, 0) = pat; add_clobbers (newpat, icode); PATTERN (insn) = pat = newpat; +#else + /* Check whether clobber is due to CC register being affected by a SET + in an unoptimized routine. If it is, we judge the clobber to be + harmless and turn the insn into a parallel that declares the clobber. + */ + if (added_clobbers_hard_reg_p (icode) && (num_clobbers > 1 || optimize)) + return 1; + + newpat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (num_clobbers + 1)); + XVECEXP (newpat, 0, 0) = pat; + add_clobbers (newpat, icode); + if (GET_MODE (XEXP (XVECEXP (newpat, 0, 1), 0)) != CCmode) + return 1; + PATTERN (insn) = pat = newpat; +#endif } /* After reload, verify that all constraints are satisfied. */ @@ -2079,8 +2104,14 @@ and get the constraints. */ icode = recog_memoized (insn); - if (icode < 0) - fatal_insn_not_found (insn); + if (icode < 0) { /* *** GRH MOD *** */ + /* Try re-recognizing with clobbers allowed. recog_memoized does not + provide for handling of hard reg clobbers, so will not recognize + an insn that generates one. */ + if (insn_invalid_p (insn) || + (icode = recog_memoized (insn)) < 0) + fatal_insn_not_found (insn); + } recog_data.n_operands = noperands = insn_data[icode].n_operands; recog_data.n_alternatives = insn_data[icode].n_alternatives; diff -ur ./gcc-3.4.0/gcc/version.c~ ./gcc-3.4.0/gcc/version.c --- ./gcc-3.4.0/gcc/version.c~ 2004-04-19 03:00:25.000000000 +0100 +++ ./gcc-3.4.0/gcc/version.c 2007-01-09 06:52:02.000000000 +0000 @@ -5,7 +5,7 @@ please modify this string to indicate that, e.g. by putting your organization's name in parentheses at the end of the string. */ -const char version_string[] = "3.4.0"; +const char version_string[] = "3.4.0 (grh-5)"; /* This is the location of the online document giving instructions for reporting bugs. If you distribute a modified version of GCC, diff -ur ./gcc-3.4.0/gcc/xcoffout.h~ ./gcc-3.4.0/gcc/xcoffout.h --- ./gcc-3.4.0/gcc/xcoffout.h~ 2003-07-06 17:53:23.000000000 +0100 +++ ./gcc-3.4.0/gcc/xcoffout.h 2007-01-09 06:52:02.000000000 +0000 @@ -97,7 +97,7 @@ } \ else if (current_sym_addr) \ output_addr_const (asmfile, current_sym_addr); \ - else if (current_sym_code == N_GSYM) \ + else if (current_sym_code == N_GSYM && TREE_PUBLIC (SYM)) \ assemble_name (asmfile, XSTR (XEXP (DECL_RTL (sym), 0), 0)); \ else \ fprintf (asmfile, "%d", current_sym_value); \