diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/Makefile.in gcc-4.0.1/gcc/Makefile.in --- gcc-4.0.1-orig/gcc/Makefile.in 2005-04-04 19:45:13.000000000 +0000 +++ gcc-4.0.1/gcc/Makefile.in 2005-08-19 09:32:59.000000000 +0000 @@ -451,9 +451,9 @@ # -------- # Directory in which the compiler finds libraries etc. -libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version) +libsubdir = $(libdir)/gcc-lib/$(target_noncanonical)/$(version) # Directory in which the compiler finds executables -libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version) +libexecsubdir = $(libexecdir)/gcc-lib/$(target_noncanonical)/$(version) # Used to produce a relative $(gcc_tooldir) in gcc.o unlibsubdir = ../../.. # Directory in which to find other cross-compilation tools and headers. @@ -1186,6 +1186,7 @@ cc1$(exeext): $(C_OBJS) $(BACKEND) $(LIBDEPS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1$(exeext) \ $(C_OBJS) $(BACKEND) $(LIBS) + ixstack 2000000 cc1$(exeext) # Build the version of limits.h that we will install. xlimits.h: glimits.h limitx.h limity.h diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/c-common.c gcc-4.0.1/gcc/c-common.c --- gcc-4.0.1-orig/gcc/c-common.c 2005-06-06 19:20:09.000000000 +0000 +++ gcc-4.0.1/gcc/c-common.c 2005-08-26 15:46:10.000000000 +0000 @@ -502,7 +502,7 @@ /* The three ways of getting then name of the current function. */ -const struct fname_var_t fname_vars[] = +/*const (Emm)*/ struct fname_var_t fname_vars[] = { /* C99 compliant __func__, must be first. */ {&c99_function_name_decl_node, RID_C99_FUNCTION_NAME, 0}, diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/c-decl.c gcc-4.0.1/gcc/c-decl.c --- gcc-4.0.1-orig/gcc/c-decl.c 2005-06-06 19:20:16.000000000 +0000 +++ gcc-4.0.1/gcc/c-decl.c 2005-08-26 00:13:57.000000000 +0000 @@ -3187,7 +3187,8 @@ && !initialized && TREE_PUBLIC (decl) && !DECL_THREAD_LOCAL (decl) - && !flag_no_common) + && !flag_no_common + && !TREE_READONLY (decl) /* Emm: for -mresident32 */) DECL_COMMON (decl) = 1; /* Set attributes here so if duplicate decl, will have proper attributes. */ diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/c-format.c gcc-4.0.1/gcc/c-format.c --- gcc-4.0.1-orig/gcc/c-format.c 2005-04-27 00:00:44.000000000 +0000 +++ gcc-4.0.1/gcc/c-format.c 2005-08-26 15:53:53.000000000 +0000 @@ -480,7 +480,7 @@ }; -static const format_char_info print_char_table[] = +static /*const (Emm)*/ format_char_info print_char_table[] = { /* C89 conversion specifiers. */ { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "-wp0 +'I", "i", NULL }, @@ -503,7 +503,7 @@ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; -static const format_char_info asm_fprintf_char_table[] = +static /*const (Emm)*/ format_char_info asm_fprintf_char_table[] = { /* C89 conversion specifiers. */ { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +", "i", NULL }, @@ -523,7 +523,7 @@ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; -static const format_char_info gcc_diag_char_table[] = +static /*const (Emm)*/ format_char_info gcc_diag_char_table[] = { /* C89 conversion specifiers. */ { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, @@ -546,7 +546,7 @@ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; -static const format_char_info gcc_cdiag_char_table[] = +static /*const (Emm)*/ format_char_info gcc_cdiag_char_table[] = { /* C89 conversion specifiers. */ { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, @@ -569,7 +569,7 @@ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; -static const format_char_info gcc_cxxdiag_char_table[] = +static /*const (Emm)*/ format_char_info gcc_cxxdiag_char_table[] = { /* C89 conversion specifiers. */ { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, @@ -595,7 +595,7 @@ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; -static const format_char_info scan_char_table[] = +static /*const (Emm)*/ format_char_info scan_char_table[] = { /* C89 conversion specifiers. */ { "di", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "*w'I", "W", NULL }, @@ -642,14 +642,14 @@ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; -static const format_char_info monetary_char_table[] = +static /*const (Emm)*/ format_char_info monetary_char_table[] = { { "in", 0, STD_C89, { T89_D, BADLEN, BADLEN, BADLEN, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "=^+(!-w#p", "", NULL }, { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; /* This must be in the same order as enum format_type. */ -static const format_kind_info format_types_orig[] = +static /*const (Emm)*/ format_kind_info format_types_orig[] = { { "printf", printf_length_specs, print_char_table, " +#0-'I", NULL, printf_flag_specs, printf_flag_pairs, diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/c-pch.c gcc-4.0.1/gcc/c-pch.c --- gcc-4.0.1-orig/gcc/c-pch.c 2004-11-09 10:12:15.000000000 +0000 +++ gcc-4.0.1/gcc/c-pch.c 2005-08-26 15:54:14.000000000 +0000 @@ -39,7 +39,7 @@ names for the error message. The possible values for *flag_var must fit in a 'signed char'. */ -static const struct c_pch_matching +static /*const (Emm)*/ struct c_pch_matching { int *flag_var; const char *flag_name; diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/morphos.h gcc-4.0.1/gcc/config/rs6000/morphos.h --- gcc-4.0.1-orig/gcc/config/rs6000/morphos.h 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/morphos.h 2005-09-09 09:46:41.000000000 +0000 @@ -0,0 +1,406 @@ + +#undef PROCESSOR_DEFAULT +#define PROCESSOR_DEFAULT PROCESSOR_PPC750 + +#undef DEFAULT_ABI +#define DEFAULT_ABI ABI_V4 + +/* Put jump tables in text section to suppress some relocations */ +#undef JUMP_TABLES_IN_TEXT_SECTION +#define JUMP_TABLES_IN_TEXT_SECTION 1 + + +#undef TARGET_OS_CPP_BUILTINS +/* __POWERPC__ must be defined for some header files. */ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__MORPHOS__"); \ + builtin_define ("__amigaos__"); \ + builtin_define ("__PPC__"); \ + builtin_define ("__powerpc__"); \ + builtin_assert ("system=morphos"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ + } \ + while (0) + +#undef CPP_OS_DEFAULT_SPEC +#define CPP_OS_DEFAULT_SPEC "%(cpp_os_morphos)" + +#undef CC1_DEFAULT_SPEC +#define CC1_DEFAULT_SPEC "%(cc1_morphos)" + +#undef ASM_DEFAULT_SPEC +#define ASM_DEFAULT_SPEC "-mppc %{fvec: -maltivec} %{mvec: -maltivec}" + +#undef STARTFILE_DEFAULT_SPEC +#define STARTFILE_DEFAULT_SPEC "%(startfile_morphos)" + +#undef ENDFILE_DEFAULT_SPEC +#define ENDFILE_DEFAULT_SPEC "%(endfile_morphos)" + +#undef LIB_DEFAULT_SPEC +#define LIB_DEFAULT_SPEC "%(lib_morphos)" + +#undef LINK_START_DEFAULT_SPEC +#define LINK_START_DEFAULT_SPEC "%(link_start_morphos)" + +#undef LINK_OS_DEFAULT_SPEC +#define LINK_OS_DEFAULT_SPEC "%(link_os_morphos)" + + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (MorphOS/PowerPC ELF)"); + + +#undef GPLUSPLUS_INCLUDE_DIR +#define GPLUSPLUS_INCLUDE_DIR "/gg/cxxinclude" + +#undef GPLUSPLUS_TOOL_INCLUDE_DIR +#undef GPLUSPLUS_BACKWARD_INCLUDE_DIR + +#undef LOCAL_INCLUDE_DIR +#define LOCAL_INCLUDE_DIR "/gg/usr/include" + +#undef STANDARD_INCLUDE_DIR +#define STANDARD_INCLUDE_DIR "/gg/include" + +#undef SYSTEM_INCLUDE_DIR +#define SYSTEM_INCLUDE_DIR "/gg/os-include" + +#undef STANDARD_EXEC_PREFIX +#define STANDARD_EXEC_PREFIX "/gg/lib/gcc-lib/" + +#undef STANDARD_LIBEXEC_PREFIX +#define STANDARD_LIBEXEC_PREFIX "/gg/lib/gcc-lib/" + +#undef STANDARD_BINDIR_PREFIX +#define STANDARD_BINDIR_PREFIX "/gg/bin/" + +#undef STANDARD_STARTFILE_PREFIX +#define STANDARD_STARTFILE_PREFIX "/gg/lib/" + +#undef TOOLDIR_BASE_PREFIX +#define TOOLDIR_BASE_PREFIX "/gg/" + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX +#undef MD_STARTFILE_PREFIX_1 + +#undef MULTILIB_DEFAULTS + +#define SUB3TARGET_OVERRIDE_OPTIONS (rs6000_altivec_vrsave = 1) + +/* We can't use 'bl' from .init/.fini to .text, so use a trampoline. */ + +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ +static void __attribute__((__used__)) \ +call_ ## FUNC (void); \ +asm(SECTION_OP "\n" \ + "lis 11," #FUNC "@ha\n" \ + "addi 11,11," #FUNC "@l\n" \ + "mtctr 11\n" \ + "bctrl\n" \ + TEXT_SECTION_ASM_OP); + + +#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL +#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ +do { \ + if (TREE_READONLY(DECL)) \ + { \ + readonly_data_section (); \ + ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + ASM_OUTPUT_SKIP (FILE, SIZE); \ + if (!flag_inhibit_size_directive && (SIZE) > 0) \ + ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ + } \ + else if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \ + && (SIZE) <= g_switch_value) \ + { \ + sbss_section (); \ + ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + ASM_OUTPUT_SKIP (FILE, SIZE); \ + if (!flag_inhibit_size_directive && (SIZE) > 0) \ + ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ + } \ + else \ + { \ + fprintf (FILE, "%s", LCOMM_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ + (SIZE), (ALIGN) / BITS_PER_UNIT); \ + } \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ +} while (0) + +#undef ASM_OUTPUT_ALIGNED_BSS +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ +do { \ + ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE,DECL, NAME, SIZE, ALIGN); \ +} while (0) + +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ + do \ + { \ + fprintf ((FILE), "%s", TREE_READONLY(DECL)?".rodata":COMMON_ASM_OP);\ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ + (SIZE), (ALIGN) / BITS_PER_UNIT); \ + } \ + while (0) + + +#if 0 +/* Compile with stack extension. */ + +#define MASK_STACKEXTEND 0x00800000 +#define TARGET_STACKEXTEND ((target_flags & MASK_STACKEXTEND) \ + || lookup_attribute ("stackext", \ + TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) + +/* Compile with stack checking. */ + +#define MASK_STACKCHECK 0x00400000 +#define TARGET_STACKCHECK ((target_flags & MASK_STACKCHECK) \ + && !(target_flags & MASK_STACKEXTEND) \ + && !lookup_attribute ("stackext", \ + TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) + +/* Compile with r13 restoring in public functions. */ + +#define MASK_RESTORE_R13 0x00200000 +#define TARGET_RESTORE_R13 \ + ((target_flags & MASK_RESTORE_R13) && TREE_PUBLIC (current_function_decl)) + +/* Compile with r13 restoring in all functions. */ + +#define MASK_ALWAYS_RESTORE_R13 0x00100000 +#define TARGET_ALWAYS_RESTORE_R13 (target_flags & MASK_ALWAYS_RESTORE_R13) +#endif + +#undef EXTRA_SUBTARGET_SWITCHES +#define EXTRA_SUBTARGET_SWITCHES \ + { "baserel32", 0, N_("32-bits relative data access")}, \ + { "resident32", 0, N_("make a reentrant executable")}, \ + +#if 0 + { "baserel", 0, N_("16-bits relative data access")}, \ + { "resident", 0, N_("make a reentrant executable with <= 64k data")},\ + { "stackcheck", MASK_STACKCHECK, "check for stack overflow"}, \ + { "no-stackcheck", - MASK_STACKCHECK, "don't check for stack overflow"}, \ + { "stackextend", MASK_STACKEXTEND, "automatically extend stack"}, \ + { "no-stackextend", - MASK_STACKEXTEND, "don't extend stack"}, \ + { "fixedstack", - (MASK_STACKCHECK|MASK_STACKEXTEND), "don't extend the stack" },\ + { "restore-r13", MASK_RESTORE_R13}, \ + { "no-restore-r13", - MASK_RESTORE_R13}, \ + { "always-restore-r13", MASK_ALWAYS_RESTORE_R13}, \ + { "no-always-restore-r13", - MASK_ALWAYS_RESTORE_R13}, \ + { "restore-a4", MASK_RESTORE_R13}, \ + { "no-restore-a4", - MASK_RESTORE_R13}, \ + { "always-restore-a4", MASK_ALWAYS_RESTORE_R13}, \ + { "no-always-restore-a4", - MASK_ALWAYS_RESTORE_R13}, +#endif + +#undef HAVE_MMAP_FILE +#undef HAVE_MMAP_ANON +#undef HAVE_MMAP_DEV_ZERO + +#if 0 +/* This macro generates the assembly code for function entry. + FILE is a stdio stream to output the code to. + SIZE is an int: how many units of temporary storage to allocate. + Refer to the array `regs_ever_live' to determine which registers + to save; `regs_ever_live[I]' is nonzero if register number I + is ever used in the function. This macro is responsible for + knowing which registers should not be saved even if used. */ + +#undef FUNCTION_PROLOGUE +#define FUNCTION_PROLOGUE(FILE, SIZE) morphos_output_prolog (FILE, SIZE) + + +/* This is (almost;-)) BSD, so it wants DBX format. */ + +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +#define DBX_DEBUGGING_INFO +#define DWARF_DEBUGGING_INFO + +/* Accesses to floats must be at least 4 bytes-aligned */ +#define GET_MIN_MODE_ALIGNMENT(mode) (mode == DImode || FLOAT_MODE_P(mode) ? 32 : 8) +#define GET_MIN_TYPE_ALIGNMENT(type) (FLOAT_TYPE_P(type) ? 32 : 8) + +/* Use sjlj exceptions until DWARF2 unwind info works */ +#undef DWARF2_UNWIND_INFO + +/* If defined, a C expression whose value is nonzero if IDENTIFIER + with arguments ARGS is a valid machine specific attribute for TYPE. + The attributes in ATTRIBUTES have previously been assigned to TYPE. */ + +#undef VALID_MACHINE_TYPE_ATTRIBUTE +#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ + (morphos_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) + +#define EXTRA_STACK_INFO \ + if (morphos_restore_r13()) { \ + info_ptr->calls_p = 1; \ + info_ptr->lr_save_p = 1; \ + regs_ever_live[65] = 1; \ + if (info_ptr->first_gp_reg_save > 13) { \ + info_ptr->gp_size += reg_size; \ + if (info_ptr->first_gp_reg_save == 14) \ + --info_ptr->first_gp_reg_save; \ + } \ + } + +#define EXTRA_PROLOG \ + if (morphos_restore_r13() && info->first_gp_reg_save > 14) \ + asm_fprintf (file, store_reg, \ + reg_names[13], \ + info->gp_save_offset + sp_offset + (32 - info->first_gp_reg_save) * reg_size, \ + reg_names[sp_reg]); + +#define EXTRA_PROLOG_END \ + if (morphos_restore_r13()) \ + asm_fprintf (file, "\tbl __restore_r13\n"); + +#define EXTRA_EPILOG \ + if (morphos_restore_r13() && info->first_gp_reg_save > 14) \ + asm_fprintf (file, load_reg, \ + reg_names[13], \ + info->gp_save_offset + sp_offset + (32 - info->first_gp_reg_save) * info->reg_size, \ + reg_names[sp_reg]); + + +#define CALL_VARARGS68K 0x80000000 /* Use 68k-style varargs */ + + +/* Initialize a variable CUM of type CUMULATIVE_ARGS + for a call to a function whose data type is FNTYPE. + For a library call, FNTYPE is 0. */ + +#undef INIT_CUMULATIVE_ARGS +#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ + morphos_init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE) + +/* Similar, but when scanning the definition of a procedure. We always + set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */ + +#undef INIT_CUMULATIVE_INCOMING_ARGS +#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,LIBNAME) \ + morphos_init_cumulative_args (&CUM, FNTYPE, LIBNAME, TRUE) + +/* Update the data in CUM to advance over an argument + of mode MODE and data type TYPE. + (TYPE is null for libcalls where that information may not be available.) */ + +#undef FUNCTION_ARG_ADVANCE +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ + morphos_function_arg_advance (&CUM, MODE, TYPE, NAMED) + +/* Determine where to put an argument to a function. + Value is zero to push the argument on the stack, + or a hard register in which to store the argument. + + MODE is the argument's machine mode. + TYPE is the data type of the argument (as a tree). + This is null for libcalls where that information may + not be available. + CUM is a variable of type CUMULATIVE_ARGS which gives info about + the preceding args and about the function being called. + NAMED is nonzero if this argument is a named parameter + (otherwise it is an extra parameter matching an ellipsis). + + On RS/6000 the first eight words of non-FP are normally in registers + and the rest are pushed. The first 13 FP args are in registers. + + If this is floating-point and no prototype is specified, we use + both an FP and integer register (or possibly FP reg and stack). Library + functions (when TYPE is zero) always have the proper types for args, + so we can pass the FP value just in one register. emit_library_function + doesn't support EXPR_LIST anyway. */ + +#undef FUNCTION_ARG +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ + morphos_function_arg (&CUM, MODE, TYPE, NAMED) + +/* Perform any needed actions needed for a function that is receiving a + variable number of arguments. + + CUM is as above. + + MODE and TYPE are the mode and type of the current parameter. + + PRETEND_SIZE is a variable that should be set to the amount of stack + that must be pushed by the prolog to pretend that our caller pushed + it. + + Normally, this macro will push all remaining incoming registers on the + stack and set PRETEND_SIZE to the length of the registers pushed. */ + +#undef SETUP_INCOMING_VARARGS +#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ + morphos_setup_incoming_varargs (&CUM, MODE, TYPE, &PRETEND_SIZE, NO_RTL) + +/* If defined, is a C expression that produces the machine-specific + code for a call to `__builtin_saveregs'. This code will be moved + to the very beginning of the function, before any parameter access + are made. The return value of this function should be an RTX that + contains the value to use as the return of `__builtin_saveregs'. + + The argument ARGS is a `tree_list' containing the arguments that + were passed to `__builtin_saveregs'. + + If this macro is not defined, the compiler will output an ordinary + call to the library function `__builtin_saveregs'. */ + +#undef EXPAND_BUILTIN_SAVEREGS +#define EXPAND_BUILTIN_SAVEREGS(ARGS) \ + morphos_expand_builtin_saveregs (ARGS) + + +/* begin-GG-local: dynamic libraries */ + +/* This macro is used to check if all collect2 facilities should be used. + We need a few special ones, like stripping after linking. */ + +#define DO_COLLECTING (do_collecting || morphos_do_collecting()) + +/* This macro is called in collect2 for every GCC argument name. + ARG is a part of commandline (without '\0' at the end). */ + +#define COLLECT2_GCC_OPTIONS_HOOK(ARG) morphos_gccopts_hook(ARG) + +/* This macro is called in collect2 for every ld's "-l" or "*.o" or "*.a" + argument. ARG is a complete argument, with '\0' at the end. */ + +#define COLLECT2_LIBNAME_HOOK(ARG) morphos_libname_hook(ARG) + +/* This macro is called at collect2 exit, to clean everything up. */ + +#define COLLECT2_EXTRA_CLEANUP morphos_collect2_cleanup + +/* This macro is called just before the first linker invocation. + LD1_ARGV is "char** argv", which will be passed to "ld". STRIP is an + *address* of "strip_flag" variable. */ + +#define COLLECT2_PRELINK_HOOK(LD1_ARGV, STRIP) \ + morphos_prelink_hook((LD1_ARGV), (STRIP)) + +/* This macro is called just after the first linker invocation, in place of + "nm" and "ldd". OUTPUT_FILE is the executable's filename. */ + +#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE) morphos_postlink_hook(OUTPUT_FILE) +/* end-GG-local */ + + +extern void morphos_init_cumulative_args (); +extern void morphos_function_arg_advance (); +extern struct rtx_def *morphos_function_arg (); +extern void morphos_setup_incoming_varargs (); +extern struct rtx_def *morphos_expand_builtin_saveregs (); +#endif diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/rs6000-protos.h gcc-4.0.1/gcc/config/rs6000/rs6000-protos.h --- gcc-4.0.1-orig/gcc/config/rs6000/rs6000-protos.h 2005-03-08 00:34:19.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/rs6000-protos.h 2005-08-20 11:09:53.000000000 +0000 @@ -202,11 +202,14 @@ enum reg_class, enum reg_class); extern int rs6000_memory_move_cost (enum machine_mode, enum reg_class, int); extern bool rs6000_tls_referenced_p (rtx); +extern bool rs6000_tls_or_brel_referenced_p (rtx); extern int rs6000_tls_symbol_ref (rtx, enum machine_mode); extern void rs6000_output_dwarf_dtprel (FILE*, int, rtx); extern int rs6000_hard_regno_nregs (int, enum machine_mode); extern void rs6000_conditional_register_usage (void); +extern int baserel_data_operand(rtx); /* Emm */ + /* Declare functions in rs6000-c.c */ extern void rs6000_pragma_longcall (struct cpp_reader *); diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/rs6000.c gcc-4.0.1/gcc/config/rs6000/rs6000.c --- gcc-4.0.1-orig/gcc/config/rs6000/rs6000.c 2005-05-07 16:49:58.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/rs6000.c 2005-08-27 11:07:21.000000000 +0000 @@ -673,6 +673,7 @@ #if TARGET_MACHO static bool rs6000_binds_local_p (tree); #endif +const char * rs6000_strip_name_encoding (const char *); static int rs6000_variable_issue (FILE *, int, rtx, int); static bool rs6000_rtx_costs (rtx, int, int, int *); static int rs6000_adjust_cost (rtx, rtx, rtx, int); @@ -744,6 +745,7 @@ static rtx rs6000_tls_get_addr (void); static rtx rs6000_got_sym (void); static inline int rs6000_tls_symbol_ref_1 (rtx *, void *); +static inline int rs6000_tls_or_brel_symbol_ref_1 (rtx *, void *); static const char *rs6000_get_some_local_dynamic_name (void); static int rs6000_get_some_local_dynamic_name_1 (rtx *, void *); static rtx rs6000_complex_function_value (enum machine_mode); @@ -866,8 +868,15 @@ /* Return 1 for a symbol ref for a thread-local storage symbol. */ #define RS6000_SYMBOL_REF_TLS_P(RTX) \ + (rs6000_sdata != SDATA_BREL && GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0) + +/* Return 1 for a symbol ref for a thread-local storage symbol or a symbol + * ref for a baserel data. + */ +#define RS6000_SYMBOL_REF_TLS_OR_BREL_P(RTX) \ (GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0) + /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE rs6000_attribute_table @@ -916,7 +925,7 @@ #define TARGET_HAVE_TLS HAVE_AS_TLS #undef TARGET_CANNOT_FORCE_CONST_MEM -#define TARGET_CANNOT_FORCE_CONST_MEM rs6000_tls_referenced_p +#define TARGET_CANNOT_FORCE_CONST_MEM rs6000_tls_or_brel_referenced_p #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE rs6000_output_function_prologue @@ -1775,6 +1784,7 @@ case SDATA_DATA: fprintf (file, "%s -msdata=data", start); start = ""; break; case SDATA_SYSV: fprintf (file, "%s -msdata=sysv", start); start = ""; break; case SDATA_EABI: fprintf (file, "%s -msdata=eabi", start); start = ""; break; + case SDATA_BREL: fprintf (file, "%s -msdata=brel", start); start = ""; break; } if (rs6000_sdata && g_switch_value) @@ -3197,7 +3207,7 @@ switch (GET_CODE(op)) { case SYMBOL_REF: - if (RS6000_SYMBOL_REF_TLS_P (op)) + if (RS6000_SYMBOL_REF_TLS_OR_BREL_P (op)) return 0; else if (CONSTANT_POOL_ADDRESS_P (op)) { @@ -3532,6 +3542,7 @@ emit_insn (gen_elf_high (reg, x)); return gen_rtx_LO_SUM (Pmode, reg, x); } +#if 0 // Emm else if (TARGET_MACHO && TARGET_32BIT && TARGET_NO_TOC && ! flag_pic #if TARGET_MACHO @@ -3548,6 +3559,7 @@ emit_insn (gen_macho_high (reg, x)); return gen_rtx_LO_SUM (Pmode, reg, x); } +#endif else if (TARGET_TOC && constant_pool_expr_p (x) && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (x), Pmode)) @@ -3816,6 +3828,26 @@ return RS6000_SYMBOL_REF_TLS_P (*x); } +/* Return 1 if X contains a thread-local symbol. */ + +bool +rs6000_tls_or_brel_referenced_p (rtx x) +{ + if (! TARGET_HAVE_TLS && rs6000_sdata != SDATA_BREL) + return false; + + return for_each_rtx (&x, &rs6000_tls_or_brel_symbol_ref_1, 0); +} + +/* Return 1 if *X is a thread-local symbol. This is the same as + rs6000_tls_symbol_ref except for the type of the unused argument. */ + +static inline int +rs6000_tls_or_brel_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED) +{ + return RS6000_SYMBOL_REF_TLS_OR_BREL_P (*x); +} + /* The convention appears to be to define this wherever it is used. With legitimize_reload_address now defined here, REG_MODE_OK_FOR_BASE_P is now used here. */ @@ -4573,6 +4605,7 @@ operands[1] = new_ref; } +#if 0 // Emm if (DEFAULT_ABI == ABI_DARWIN) { #if TARGET_MACHO @@ -4591,6 +4624,7 @@ emit_insn (gen_macho_low (operands[0], target, operands[1])); return; } +#endif emit_insn (gen_elf_high (target, operands[1])); emit_insn (gen_elf_low (operands[0], target, operands[1])); @@ -11317,6 +11351,9 @@ && CONSTANT_P (XEXP (x, 1))) { output_addr_const (file, XEXP (x, 1)); + if (baserel_data_operand(XEXP (x, 1))) + fprintf (file, "@drel@l(%s)", reg_names[ REGNO (XEXP (x, 0)) ]); + else fprintf (file, "@l(%s)", reg_names[ REGNO (XEXP (x, 0)) ]); } #endif @@ -17528,6 +17565,53 @@ memcpy (str + 1, XSTR (sym_ref, 0), len + 1); XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1); } + else if (rs6000_sdata == SDATA_BREL + && TREE_CODE (decl) == VAR_DECL) + { + rtx sym_ref = XEXP (rtl, 0); +//fprintf(stderr, "encode info: first %d\n",first); +//print_rtl(stderr, rtl); +//debug_tree(decl); + if (SYMBOL_REF_TLS_MODEL(sym_ref) == 0) + { + int brel_access = 0; + +//fprintf(stderr,"readonly %d, side effect %d, initial %p, constant %d, section %p\n",TREE_READONLY(decl),TREE_SIDE_EFFECTS(decl),DECL_INITIAL(decl),TREE_CONSTANT(DECL_INITIAL(decl)),DECL_SECTION_NAME(decl)); +//if (DECL_INITIAL(decl))fprintf(stderr,"initial: "),debug_tree(DECL_INITIAL(decl)); + if (DECL_SECTION_NAME (decl)) + { + const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); +//fprintf(stderr,"section <%s>\n", section); + if (strcmp (section, ".sdata") == 0 + || strcmp (section, ".data") == 0 + || strcmp (section, ".sbss") == 0 + || strcmp (section, ".bss") == 0) + { + brel_access = 1; + } + } + else if (! TREE_READONLY (decl) + || TREE_SIDE_EFFECTS (decl) + || (DECL_INITIAL (decl) && ! TREE_CONSTANT (DECL_INITIAL (decl)))) + { + const char* name = XSTR (sym_ref, 0); +//fprintf(stderr,"name <%s>\n", name); + /* vtables are in the .readonly section. Ugly, but we might be called when the vtable + * definition is not complete, and the TREE_CONSTANT() check fails. */ + if (!VTABLE_NAME_P(name)) + brel_access = 1; + } + +//fprintf(stderr,"brel access %d\n", brel_access); + if (brel_access) + { + if (XSTR (sym_ref, 0)[0] != '*') + { + SYMBOL_REF_FLAGS(sym_ref) |= TLS_MODEL_LOCAL_EXEC << SYMBOL_FLAG_TLS_SHIFT; + } + } + } + } } static bool @@ -17563,7 +17647,7 @@ && (unsigned HOST_WIDE_INT) size <= g_switch_value /* If it's not public, and we're not going to reference it there, there's no need to put it in the small data section. */ - && (rs6000_sdata != SDATA_DATA || TREE_PUBLIC (decl))) + && ((rs6000_sdata != SDATA_DATA && rs6000_sdata != SDATA_BREL) || TREE_PUBLIC (decl))) return true; } @@ -18309,6 +18393,12 @@ } #endif +const char * +rs6000_strip_name_encoding (const char *name) +{ + return name + (*name == '*'); +} + /* Compute a (partial) cost for rtx X. Return true if the complete cost has been computed, and false if subexpressions should be scanned. In either case, *TOTAL contains the cost result. */ @@ -18999,4 +19089,43 @@ return false; } +/* Emm: Return 1 for an operand in data memory */ + +int +baserel_data_operand (rtx op ATTRIBUTE_UNUSED) +{ +#if TARGET_ELF + rtx sym_ref; + +//int r; +//fprintf(stderr, "baserel_data_operand: \n"); +//print_rtl(stderr, op); + if (rs6000_sdata != SDATA_BREL) + return 0; + + if (DEFAULT_ABI != ABI_V4) + return 0; + + if (GET_CODE (op) == SYMBOL_REF) + sym_ref = op; + + else if (GET_CODE (op) != CONST + || GET_CODE (XEXP (op, 0)) != PLUS + || GET_CODE (XEXP (XEXP (op, 0), 0)) != SYMBOL_REF + || GET_CODE (XEXP (XEXP (op, 0), 1)) != CONST_INT) + return 0; + + else + sym_ref = XEXP (XEXP (op, 0), 0); + +//r= SYMBOL_REF_TLS_MODEL(sym_ref) == TLS_MODEL_LOCAL_EXEC; +//fprintf(stderr, "return %d\n", r); +//return r; + return SYMBOL_REF_TLS_MODEL(sym_ref) == TLS_MODEL_LOCAL_EXEC; + +#else + return 0; +#endif +} + #include "gt-rs6000.h" diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/rs6000.h gcc-4.0.1/gcc/config/rs6000/rs6000.h --- gcc-4.0.1-orig/gcc/config/rs6000/rs6000.h 2005-03-01 06:26:20.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/rs6000.h 2005-08-20 12:29:00.000000000 +0000 @@ -104,7 +104,38 @@ %{maltivec: -maltivec} \ -many" -#define CPP_DEFAULT_SPEC "" +#define CPP_DEFAULT_SPEC "\ +%{mcpu=401: -D__401__} \ +%{mcpu=403: -D__403__} \ +%{mcpu=405: -D__405__} \ +%{mcpu=405fp: -D__405fp__} \ +%{mcpu=440: -D__440__} \ +%{mcpu=440fp: -D__440fp__} \ +%{mcpu=505: -D__505__} \ +%{mcpu=601: -D__601__} \ +%{mcpu=602: -D__602__} \ +%{mcpu=603: -D__603__} \ +%{mcpu=603e: -D__603e__} \ +%{mcpu=ec603e: -D__ec603e__} \ +%{mcpu=604: -D__604__} \ +%{mcpu=604e: -D__604e__} \ +%{mcpu=620: -D__620__} \ +%{mcpu=630: -D__630__} \ +%{mcpu=740: -D__740__} \ +%{mcpu=750: -D__750__} \ +%{mcpu=G3: -D__G3__} \ +%{mcpu=7400: -D__7400__ -D__VEC__} \ +%{mcpu=7450: -D__7450__ -D__VEC__} \ +%{mcpu=G4: -D__G4__ -D__VEC__} \ +%{mcpu=801: -D__801__} \ +%{mcpu=821: -D__821__} \ +%{mcpu=823: -D__823__} \ +%{mcpu=860: -D__860__} \ +%{mcpu=970: -D__870__ -D__VEC__} \ +%{mcpu=G5: -D__G5__ -D__VEC__} \ +%{mcpu=8540: -D__8540__} \ +%{maltivec: -D__VEC__} \ +" #define ASM_DEFAULT_SPEC "" @@ -1932,7 +1963,7 @@ || (TARGET_POWERPC64 && GET_MODE (X) == DImode) \ || easy_fp_constant (X, GET_MODE (X)) \ || easy_vector_constant (X, GET_MODE (X))) \ - && !rs6000_tls_referenced_p (X)) + && !rs6000_tls_or_brel_referenced_p (X)) /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. @@ -2317,6 +2348,8 @@ } \ while (0) +#define TARGET_STRIP_NAME_ENCODING rs6000_strip_name_encoding +#define ASM_OUTPUT_LABELREF(file, name) asm_fprintf ((file), "%U%s", rs6000_strip_name_encoding(name)) #define TARGET_ASM_FILE_START rs6000_file_start /* Output to assembler file text saying following lines diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/rs6000.md gcc-4.0.1/gcc/config/rs6000/rs6000.md --- gcc-4.0.1-orig/gcc/config/rs6000/rs6000.md 2005-03-31 11:39:27.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/rs6000.md 2005-08-19 20:10:58.000000000 +0000 @@ -88,20 +88,20 @@ (automata_option "ndfa") -(include "rios1.md") -(include "rios2.md") -(include "rs64.md") -(include "mpc.md") -(include "40x.md") -(include "440.md") +;;(include "rios1.md") +;;(include "rios2.md") +;;(include "rs64.md") +;;(include "mpc.md") +;;(include "40x.md") +;;(include "440.md") (include "603.md") (include "6xx.md") (include "7xx.md") (include "7450.md") -(include "8540.md") -(include "power4.md") -(include "power5.md") -(include "darwin.md") +;;(include "8540.md") +;;(include "power4.md") +;;(include "power5.md") +;;(include "darwin.md") ;; This mode macro allows :P to be used for patterns that operate on @@ -7657,20 +7657,31 @@ ;; The output of this could be r0, but we make a very strong ;; preference for a base register because it will usually ;; be needed there. +;; Emm: handle base-relative addressing. (define_insn "elf_high" [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r") (high:SI (match_operand 1 "" "")))] "TARGET_ELF && ! TARGET_64BIT" - "{liu|lis} %0,%1@ha") + "* +{ + return baserel_data_operand(operands[1]) ? \"{addiu|addis} %0,13,%1@drel@ha\" : \"{liu|lis} %0,%1@ha\"; +}") (define_insn "elf_low" [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r") (match_operand 2 "" "")))] "TARGET_ELF && ! TARGET_64BIT" - "@ - {cal|la} %0,%2@l(%1) - {ai|addic} %0,%1,%K2") + "* +{ + switch (which_alternative) + { + case 0: + return baserel_data_operand(operands[2]) ? \"{cal|la} %0,%2@drel@l(%1)\" : \"{cal|la} %0,%2@l(%1)\"; + case 1: + return \"{ai|addic} %0,%1,%K2\"; + } +}") ;; Set up a register with a value from the GOT table diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/sysv4.h gcc-4.0.1/gcc/config/rs6000/sysv4.h --- gcc-4.0.1-orig/gcc/config/rs6000/sysv4.h 2005-02-15 15:53:52.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/sysv4.h 2005-08-25 08:10:55.000000000 +0000 @@ -41,7 +41,8 @@ SDATA_NONE, /* No small data support. */ SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */ SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */ - SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */ + SDATA_EABI, /* Use r13 like above, r2 points to .sdata2/.sbss2. */ + SDATA_BREL /* Use r13 like above, merge .data and .sdata, an access everything via r13. */ }; extern enum rs6000_sdata_type rs6000_sdata; @@ -231,6 +232,8 @@ rs6000_sdata = SDATA_SYSV; \ else if (!strcmp (rs6000_sdata_name, "eabi")) \ rs6000_sdata = SDATA_EABI; \ + else if (!strcmp (rs6000_sdata_name, "brel")) \ + rs6000_sdata = SDATA_BREL; \ else \ error ("bad value for -msdata=%s", rs6000_sdata_name); \ } \ @@ -767,7 +770,7 @@ /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ #define RS6000_OUTPUT_BASENAME(FILE, NAME) \ - assemble_name (FILE, NAME) + assemble_name ((FILE), (*targetm.strip_name_encoding) (NAME)) /* We have to output the stabs for the function name *first*, before outputting its label. */ @@ -827,6 +830,7 @@ mbig|mbig-endian :-mbig; \ mcall-aixdesc | \ mcall-freebsd | \ + mcall-morphos | \ mcall-netbsd | \ mcall-openbsd | \ mcall-linux | \ @@ -850,6 +854,7 @@ mbig |mbig-endian : %(cc1_endian_big); \ mcall-aixdesc | \ mcall-freebsd | \ + mcall-morphos | \ mcall-netbsd | \ mcall-openbsd | \ mcall-linux | \ @@ -868,7 +873,15 @@ %{mcall-openbsd: -mno-eabi }}} \ %{msdata: -msdata=default} \ %{mno-sdata: -msdata=none} \ -%{profile: -p}" +%{profile: -p} \ +%{mbaserel32:-msdata=brel -G 0} \ +%{mresident32:-msdata=brel -G 0} \ +%{mcall-morphos : %(cc1_morphos); \ + : %(cc1_default)}" +/*%{mbaserel:-msdata=sysv -G 1000000}*/ +/*%{mresident:-msdata=sysv -G 1000000}*/ + +#define CC1_DEFAULT_SPEC "" /* Don't put -Y P, for cross compilers. */ #ifndef CROSS_COMPILE @@ -897,6 +910,7 @@ mcall-freebsd: %(link_start_freebsd) ; \ mcall-linux : %(link_start_linux) ; \ mcall-gnu : %(link_start_gnu) ; \ + mcall-morphos: %(link_start_morphos) ; \ mcall-netbsd : %(link_start_netbsd) ; \ mcall-openbsd: %(link_start_openbsd) ; \ : %(link_start_default) }" @@ -957,6 +971,7 @@ mcall-gnu : %(link_os_gnu) ; \ mcall-netbsd : %(link_os_netbsd) ; \ mcall-openbsd: %(link_os_openbsd) ; \ + mcall-morphos: %(link_os_morphos) ; \ : %(link_os_default) }" #define LINK_OS_DEFAULT_SPEC "" @@ -974,6 +989,7 @@ mcall-gnu : %(cpp_os_gnu) ; \ mcall-netbsd : %(cpp_os_netbsd) ; \ mcall-openbsd: %(cpp_os_openbsd) ; \ + mcall-morphos: %(cpp_os_morphos) ; \ : %(cpp_os_default) }" #define CPP_OS_DEFAULT_SPEC "" @@ -991,6 +1007,7 @@ mcall-gnu : %(startfile_gnu) ; \ mcall-netbsd : %(startfile_netbsd) ; \ mcall-openbsd: %(startfile_openbsd) ; \ + mcall-morphos: %(startfile_morphos) ; \ : %(startfile_default) }" #define STARTFILE_DEFAULT_SPEC "" @@ -1006,6 +1023,7 @@ mcall-freebsd: %(lib_freebsd) ; \ mcall-linux : %(lib_linux) ; \ mcall-gnu : %(lib_gnu) ; \ + mcall-morphos: %(lib_morphos) ; \ mcall-netbsd : %(lib_netbsd) ; \ mcall-openbsd: %(lib_openbsd) ; \ : %(lib_default) }" @@ -1023,6 +1041,7 @@ mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \ mcall-linux : crtsavres.o%s %(endfile_linux) ; \ mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \ + mcall-morphos: crtsavres.o%s %(endfile_morphos) ; \ mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \ mcall-openbsd: crtsavres.o%s %(endfile_openbsd) ; \ : %(crtsavres_default) %(endfile_default) }" @@ -1097,7 +1116,6 @@ #define LINK_OS_FREEBSD_SPEC "\ %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ %{Wl,*:%*} \ - %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ %{shared:-Bshareable %{h*} %{soname*}} \ %{!shared: \ @@ -1107,6 +1125,62 @@ %{static:-Bstatic}} \ %{symbolic:-Bsymbolic}" +/* MorphOS support. */ + +#define CPP_OS_MORPHOS_SPEC "\ + -D__MORPHOS__ -D__amigaos__ -D__PPC__ -D__powerpc__ \ + %{!ansi: \ + %{!noixemul:-Dixemul} \ + %{noixemul:-Dlibnix} \ + -Damiga -Damigaos -DMCH_AMIGA -DAMIGA} \ + %{!noixemul:-D__ixemul__ -D__ixemul -I/gg/ixemul-include} \ + %{noixemul:-D__libnix__ -D__libnix -I/gg/libnix-include} \ + %{msoft-float: -D_SOFT_FLOAT} \ + %{fvec: -D__VEC__}" + +#define CC1_MORPHOS_SPEC "\ + %{!mabi=*: %{maltivec:-mabi=altivec}} \ + %{fvec: -maltivec -mabi=altivec} \ + %{!mcpu=*: -mcpu=750}" + + /* "%{malways-restore-r13:-Derrno=(*ixemul_errno)} " + // "%{malways-restore-a4:-Derrno=(*ixemul_errno)} " + // "%{mrestore-r13:-Derrno=(*ixemul_errno)} " + // "%{mrestore-a4:-Derrno=(*ixemul_errno)} " +// -Acpu=powerpc -Amachine=powerpc -Asystem=morphos +// -Asystem(morphos) -Acpu(powerpc) -Amachine(powerpc) +// -D__varargs68k__ -D__varargs68k=__attribute__((varargs68k)) +// -D__saveds=__attribute__((__saveds__)) +// -D__stackext=__attribute__((__stackext__))*/ + +#define STARTFILE_MORPHOS_SPEC "\ + %{!noixemul: \ + %{mbaserel32:%{!mresident32:lcrt0i.o%s}} \ + %{mresident32:scrt0i.o%s} \ + %{!mresident32:%{!mbaserel32:crt0i.o%s}}} \ + %{noixemul:libnix/startupi.o%s}\ + ecrti.o%s \ + crtbegin.o%s" + +#define ENDFILE_MORPHOS_SPEC "\ + crtend.o%s \ + ecrtn.o%s" + +#define LIB_MORPHOS_SPEC "\ + %{!noixemul: \ + %{!p:%{!pg:-lc -labox -laboxstubs -lc}} \ + %{p:-lc_p}%{pg:-lc_p}} \ + %{noixemul:-lc -labox -laboxstubs -lc -lauto \ + %{mstackcheck:-lstack} \ + %{mstackextend:-lstack}}" + +#define LINK_START_MORPHOS_SPEC "" + +#define LINK_OS_MORPHOS_SPEC "\ + %{noixemul: -fl libnix} \ + %{mbaserel32:%{!mresident32:-m morphos_baserel -G 0 -fl libb32}} \ + %{mresident32:-m morphos_baserel -datadata-reloc -G 0 -fl libb32}" + /* GNU/Linux support. */ #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \ %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ @@ -1255,6 +1329,7 @@ { "lib_netbsd", LIB_NETBSD_SPEC }, \ { "lib_openbsd", LIB_OPENBSD_SPEC }, \ { "lib_windiss", LIB_WINDISS_SPEC }, \ + { "lib_morphos", LIB_MORPHOS_SPEC }, \ { "lib_default", LIB_DEFAULT_SPEC }, \ { "startfile_ads", STARTFILE_ADS_SPEC }, \ { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \ @@ -1266,6 +1341,7 @@ { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \ { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \ { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \ + { "startfile_morphos", STARTFILE_MORPHOS_SPEC }, \ { "startfile_default", STARTFILE_DEFAULT_SPEC }, \ { "endfile_ads", ENDFILE_ADS_SPEC }, \ { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \ @@ -1277,6 +1353,7 @@ { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \ { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \ { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \ + { "endfile_morphos", ENDFILE_MORPHOS_SPEC }, \ { "endfile_default", ENDFILE_DEFAULT_SPEC }, \ { "link_path", LINK_PATH_SPEC }, \ { "link_shlib", LINK_SHLIB_SPEC }, \ @@ -1292,6 +1369,7 @@ { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \ { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \ { "link_start_windiss", LINK_START_WINDISS_SPEC }, \ + { "link_start_morphos", LINK_START_MORPHOS_SPEC }, \ { "link_start_default", LINK_START_DEFAULT_SPEC }, \ { "link_os", LINK_OS_SPEC }, \ { "link_os_ads", LINK_OS_ADS_SPEC }, \ @@ -1304,10 +1382,13 @@ { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \ + { "link_os_morphos", LINK_OS_MORPHOS_SPEC }, \ { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \ { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \ { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \ + { "cc1_morphos", CC1_MORPHOS_SPEC }, \ + { "cc1_default", CC1_DEFAULT_SPEC }, \ { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ @@ -1318,6 +1399,7 @@ { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \ { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \ { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \ + { "cpp_os_morphos", CPP_OS_MORPHOS_SPEC }, \ { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \ SUBSUBTARGET_EXTRA_SPECS diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/t-morphos gcc-4.0.1/gcc/config/rs6000/t-morphos --- gcc-4.0.1-orig/gcc/config/rs6000/t-morphos 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/t-morphos 2005-08-22 11:13:46.000000000 +0000 @@ -0,0 +1,8 @@ + +NATIVE_SYSTEM_HEADER_DIR = /ram/include2 + +MULTILIB_OPTIONS = mbaserel32 maltivec +MULTILIB_DIRNAMES = libb32 libvec +MULTILIB_MATCHES = mbaserel32=mresident32 \ + mbaserel32=msdata=brel \ + maltivec=fvec diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/t-morphos2 gcc-4.0.1/gcc/config/rs6000/t-morphos2 --- gcc-4.0.1-orig/gcc/config/rs6000/t-morphos2 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/t-morphos2 2005-08-19 09:32:06.000000000 +0000 @@ -0,0 +1,5 @@ +CRTSTUFF_T_CFLAGS = +CRTSTUFF_T_CFLAGS_S = +TARGET_LIBGCC2_CFLAGS = +MULTILIB_EXTRA_OPTS = mstrict-align + diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config/rs6000/xm-morphos.h gcc-4.0.1/gcc/config/rs6000/xm-morphos.h --- gcc-4.0.1-orig/gcc/config/rs6000/xm-morphos.h 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.0.1/gcc/config/rs6000/xm-morphos.h 2005-08-18 09:39:47.000000000 +0000 @@ -0,0 +1 @@ + diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config.build gcc-4.0.1/gcc/config.build --- gcc-4.0.1-orig/gcc/config.build 2003-10-01 23:51:09.000000000 +0000 +++ gcc-4.0.1/gcc/config.build 2005-08-18 09:43:08.000000000 +0000 @@ -119,5 +119,9 @@ # All other System V variants. build_install_headers_dir=install-headers-cpio ;; + p*pc-*-morphos) + build_xm_file=rs6000/xm-morphos.h + build_install_headers_dir=install-headers-cp + ;; esac diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config.gcc gcc-4.0.1/gcc/config.gcc --- gcc-4.0.1-orig/gcc/config.gcc 2005-05-05 20:11:50.000000000 +0000 +++ gcc-4.0.1/gcc/config.gcc 2005-08-19 16:52:37.000000000 +0000 @@ -447,6 +447,11 @@ esac tmake_file="t-slibgcc-elf-ver t-linux" ;; +*-*-morphos*) + gas=yes + gnu_ld=yes + tmake_file="rs6000/t-morphos" + ;; *-*-gnu*) # On the Hurd, the setup is just about the same on # each different CPU. The specific machines that we @@ -1652,6 +1657,14 @@ ;; esac ;; +p*pc-*-morphos*) + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/morphos.h" + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm rs6000/t-morphos2" + prefix=/gg + local_prefix=/gg + libexecdir=/gg/lib + gcc_tooldir=/gg/ppc-morphos + ;; powerpc-*-gnu-gnualtivec*) tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h rs6000/gnu.h" tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-gnu rs6000/t-ppccomm" @@ -2758,7 +2771,7 @@ fi ;; - powerpc*-*-* | rs6000-*-*) + p*pc*-*-* | rs6000-*-*) # FIXME: The PowerPC port uses the value set at compile time, # although it's only cosmetic. if test "x$with_cpu" != x diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/config.host gcc-4.0.1/gcc/config.host --- gcc-4.0.1-orig/gcc/config.host 2005-03-07 22:46:12.000000000 +0000 +++ gcc-4.0.1/gcc/config.host 2005-08-18 10:59:42.000000000 +0000 @@ -176,6 +176,9 @@ out_host_hook_obj=host-darwin.o host_xmake_file=rs6000/x-darwin ;; + p*pc-*-morphos*) + target_noncanonical=ppc-morphos + ;; *-*-solaris2*) out_host_hook_obj=host-solaris.o host_xmake_file=x-solaris diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/cp/Make-lang.in gcc-4.0.1/gcc/cp/Make-lang.in --- gcc-4.0.1-orig/gcc/cp/Make-lang.in 2005-06-02 17:30:57.000000000 +0000 +++ gcc-4.0.1/gcc/cp/Make-lang.in 2005-08-19 09:26:05.000000000 +0000 @@ -94,6 +94,7 @@ cc1plus$(exeext): $(CXX_OBJS) $(BACKEND) $(LIBDEPS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ $(CXX_OBJS) $(BACKEND) $(LIBS) + ixstack 2000000 cc1plus # Special build rules. $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/cp/decl.c gcc-4.0.1/gcc/cp/decl.c --- gcc-4.0.1-orig/gcc/cp/decl.c 2005-06-03 16:18:26.000000000 +0000 +++ gcc-4.0.1/gcc/cp/decl.c 2005-08-26 15:29:04.000000000 +0000 @@ -2823,7 +2823,7 @@ const predefined_identifier *pid; /* A table of identifiers to create at startup. */ - static const predefined_identifier predefined_identifiers[] = { + static /*const (Emm)*/ predefined_identifier predefined_identifiers[] = { { "C++", &lang_name_cplusplus, 0 }, { "C", &lang_name_c, 0 }, { "Java", &lang_name_java, 0 }, diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/cp/rtti.c gcc-4.0.1/gcc/cp/rtti.c --- gcc-4.0.1-orig/gcc/cp/rtti.c 2005-05-20 17:28:46.000000000 +0000 +++ gcc-4.0.1/gcc/cp/rtti.c 2005-08-26 15:45:10.000000000 +0000 @@ -1318,7 +1318,7 @@ void emit_support_tinfos (void) { - static tree *const fundamentals[] = + static tree * /*const (Emm)*/ fundamentals[] = { &void_type_node, &boolean_type_node, diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/crtstuff.c gcc-4.0.1/gcc/crtstuff.c --- gcc-4.0.1-orig/gcc/crtstuff.c 2004-11-24 14:35:24.000000000 +0000 +++ gcc-4.0.1/gcc/crtstuff.c 2005-08-25 17:01:27.000000000 +0000 @@ -259,6 +259,7 @@ static func_ptr *p = __DTOR_LIST__ + 1; static _Bool completed; func_ptr f; + void (*dereg)(void *) = __deregister_frame_info; if (__builtin_expect (completed, 0)) return; @@ -281,8 +282,8 @@ if (__deregister_frame_info_bases) __deregister_frame_info_bases (__EH_FRAME_BEGIN__); #else - if (__deregister_frame_info) - __deregister_frame_info (__EH_FRAME_BEGIN__); + if (dereg) + dereg (__EH_FRAME_BEGIN__); #endif #endif @@ -302,6 +303,7 @@ { #ifdef USE_EH_FRAME_REGISTRY static struct object object; + void (*reg)(void *, const struct object *) = __register_frame_info; #ifdef CRT_GET_RFIB_DATA void *tbase, *dbase; tbase = 0; @@ -309,8 +311,8 @@ if (__register_frame_info_bases) __register_frame_info_bases (__EH_FRAME_BEGIN__, &object, tbase, dbase); #else - if (__register_frame_info) - __register_frame_info (__EH_FRAME_BEGIN__, &object); + if (reg) + reg(__EH_FRAME_BEGIN__, &object); #endif /* CRT_GET_RFIB_DATA */ #endif /* USE_EH_FRAME_REGISTRY */ #ifdef JCR_SECTION_NAME @@ -378,13 +380,15 @@ void __do_global_dtors (void) { + void (*dereg)(void *) = __deregister_frame_info; + func_ptr *p, f; for (p = __DTOR_LIST__ + 1; (f = *p); p++) f (); #ifdef USE_EH_FRAME_REGISTRY - if (__deregister_frame_info) - __deregister_frame_info (__EH_FRAME_BEGIN__); + if (dereg) + dereg (__EH_FRAME_BEGIN__); #endif } @@ -398,8 +402,9 @@ { #ifdef USE_EH_FRAME_REGISTRY static struct object object; - if (__register_frame_info) - __register_frame_info (__EH_FRAME_BEGIN__, &object); + void (*reg)(void *, const struct object *) = __register_frame_info; + if (reg) + reg (__EH_FRAME_BEGIN__, &object); #endif #ifdef JCR_SECTION_NAME if (__JCR_LIST__[0]) diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/gcov-io.h gcc-4.0.1/gcc/gcov-io.h --- gcc-4.0.1-orig/gcc/gcov-io.h 2005-05-02 18:04:42.000000000 +0000 +++ gcc-4.0.1/gcc/gcov-io.h 2005-08-17 09:51:37.000000000 +0000 @@ -195,6 +195,7 @@ #endif +#undef TARGET_HAS_F_SETLKW // Emm #if defined (TARGET_HAS_F_SETLKW) #define GCOV_LOCKED 1 #else diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/gengtype.c gcc-4.0.1/gcc/gengtype.c --- gcc-4.0.1-orig/gcc/gengtype.c 2005-02-23 22:16:07.000000000 +0000 +++ gcc-4.0.1/gcc/gengtype.c 2005-08-26 14:04:27.000000000 +0000 @@ -2457,7 +2457,7 @@ if (bitmap & 1) { oprintf (base_files[fnum], - "extern const struct %s gt_%s_", + "extern /*const (Emm)*/ struct %s gt_%s_", tname, pfx); put_mangled_filename (base_files[fnum], fli2->name); oprintf (base_files[fnum], "[];\n"); @@ -2468,7 +2468,7 @@ size_t fnum; for (fnum = 0; fnum < NUM_BASE_FILES; fnum++) oprintf (base_files [fnum], - "const struct %s * const %s[] = {\n", + "const struct %s * /*const (Emm)*/ %s[] = {\n", tname, name); } @@ -2797,7 +2797,7 @@ { fli->started_p = 1; - oprintf (f, "const struct ggc_root_tab gt_ggc_r_"); + oprintf (f, "/*const (Emm)*/ struct ggc_root_tab gt_ggc_r_"); put_mangled_filename (f, v->line.file); oprintf (f, "[] = {\n"); } @@ -2831,7 +2831,7 @@ { fli->started_p = 1; - oprintf (f, "const struct ggc_root_tab gt_ggc_rd_"); + oprintf (f, "/*const (Emm)*/ struct ggc_root_tab gt_ggc_rd_"); put_mangled_filename (f, v->line.file); oprintf (f, "[] = {\n"); } @@ -2875,7 +2875,7 @@ { fli->started_p = 1; - oprintf (f, "const struct ggc_cache_tab gt_ggc_rc_"); + oprintf (f, "/*const (Emm)*/ struct ggc_cache_tab gt_ggc_rc_"); put_mangled_filename (f, v->line.file); oprintf (f, "[] = {\n"); } @@ -2911,7 +2911,7 @@ { fli->started_p = 1; - oprintf (f, "const struct ggc_root_tab gt_pch_rc_"); + oprintf (f, "/*const (Emm)*/ struct ggc_root_tab gt_pch_rc_"); put_mangled_filename (f, v->line.file); oprintf (f, "[] = {\n"); } @@ -2947,7 +2947,7 @@ { fli->started_p = 1; - oprintf (f, "const struct ggc_root_tab gt_pch_rs_"); + oprintf (f, "/*const (Emm)*/ struct ggc_root_tab gt_pch_rs_"); put_mangled_filename (f, v->line.file); oprintf (f, "[] = {\n"); } diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/ggc.h gcc-4.0.1/gcc/ggc.h --- gcc-4.0.1-orig/gcc/ggc.h 2004-09-02 18:32:49.000000000 +0000 +++ gcc-4.0.1/gcc/ggc.h 2005-08-26 14:11:31.000000000 +0000 @@ -74,10 +74,10 @@ }; #define LAST_GGC_ROOT_TAB { NULL, 0, 0, NULL, NULL } /* Pointers to arrays of ggc_root_tab, terminated by NULL. */ -extern const struct ggc_root_tab * const gt_ggc_rtab[]; -extern const struct ggc_root_tab * const gt_ggc_deletable_rtab[]; -extern const struct ggc_root_tab * const gt_pch_cache_rtab[]; -extern const struct ggc_root_tab * const gt_pch_scalar_rtab[]; +extern const struct ggc_root_tab * /*const (Emm)*/ gt_ggc_rtab[]; +extern const struct ggc_root_tab * /*const (Emm)*/ gt_ggc_deletable_rtab[]; +extern const struct ggc_root_tab * /*const (Emm)*/ gt_pch_cache_rtab[]; +extern const struct ggc_root_tab * /*const (Emm)*/ gt_pch_scalar_rtab[]; /* Structure for hash table cache marking. */ struct htab; @@ -91,7 +91,7 @@ }; #define LAST_GGC_CACHE_TAB { NULL, 0, 0, NULL, NULL, NULL } /* Pointers to arrays of ggc_cache_tab, terminated by NULL. */ -extern const struct ggc_cache_tab * const gt_ggc_cache_rtab[]; +extern const struct ggc_cache_tab * /*const (Emm)*/ gt_ggc_cache_rtab[]; /* If EXPR is not NULL and previously unmarked, mark it and evaluate to true. Otherwise evaluate to false. */ diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/optc-gen.awk gcc-4.0.1/gcc/optc-gen.awk --- gcc-4.0.1-orig/gcc/optc-gen.awk 2004-06-18 01:59:45.000000000 +0000 +++ gcc-4.0.1/gcc/optc-gen.awk 2005-08-26 13:00:04.000000000 +0000 @@ -92,7 +92,7 @@ print " 0\n};\n" print "const unsigned int cl_options_count = N_OPTS;\n" -print "const struct cl_option cl_options[] =\n{" +print "/*const (Emm)*/ struct cl_option cl_options[] =\n{" for (i = 0; i < n_opts; i++) back_chain[i] = "N_OPTS"; diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/opts.h gcc-4.0.1/gcc/opts.h --- gcc-4.0.1-orig/gcc/opts.h 2004-11-18 06:39:47.000000000 +0000 +++ gcc-4.0.1/gcc/opts.h 2005-08-26 12:59:58.000000000 +0000 @@ -35,7 +35,7 @@ int set_value; }; -extern const struct cl_option cl_options[]; +extern /*const (Emm)*/ struct cl_option cl_options[]; extern const unsigned int cl_options_count; extern const char *const lang_names[]; diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/passes.c gcc-4.0.1/gcc/passes.c --- gcc-4.0.1-orig/gcc/passes.c 2005-03-30 13:13:29.000000000 +0000 +++ gcc-4.0.1/gcc/passes.c 2005-08-25 18:59:46.000000000 +0000 @@ -42,6 +42,7 @@ #include "line-map.h" #include "input.h" +#define NULL 0 #include "tree.h" #include "rtl.h" #include "tm_p.h" diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/tlink.c gcc-4.0.1/gcc/tlink.c --- gcc-4.0.1-orig/gcc/tlink.c 2004-11-09 10:12:19.000000000 +0000 +++ gcc-4.0.1/gcc/tlink.c 2005-08-17 08:29:50.000000000 +0000 @@ -33,6 +33,9 @@ #include "collect2.h" #define MAX_ITERATIONS 17 +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif /* Defined in the automatically-generated underscore.c. */ extern int prepends_underscore; diff -N -r -u -w -x '*~' -x '*.swp' gcc-4.0.1-orig/gcc/toplev.c gcc-4.0.1/gcc/toplev.c --- gcc-4.0.1-orig/gcc/toplev.c 2005-04-26 00:30:16.000000000 +0000 +++ gcc-4.0.1/gcc/toplev.c 2005-08-26 13:02:30.000000000 +0000 @@ -42,6 +42,9 @@ #include "line-map.h" #include "input.h" +#ifndef NULL +#define NULL 0 +#endif #include "tree.h" #include "version.h" #include "rtl.h" @@ -391,7 +394,7 @@ /* This table is similar, but allows the switch to have a value. */ #ifdef TARGET_OPTIONS -static const struct +static /*const (Emm)*/ struct { const char *const prefix; const char **const variable;