summaryrefslogtreecommitdiff
path: root/m68k-unknown-amigaos/recipes/patches
diff options
context:
space:
mode:
Diffstat (limited to 'm68k-unknown-amigaos/recipes/patches')
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/configure.p12
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.Makefile.in.p133
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-decl.c.p87
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-incpath.c.p19
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-parse.in.p223
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-tree.h.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.calls.c.p24
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.collect2.c.p200
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.common.opt.p17
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.gcc.p16
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host-linux.c.p11
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host.p18
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k-protos.h.p14
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.c.p513
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.h.p175
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.md.p82
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.ac.p35
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.p61
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.cppfiles.c.p48
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.defaults.h.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.fixinc.mkfixinc.sh.p10
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.flow.c.p19
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.c.p31
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.h.p11
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.gcc.c.p63
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.ginclude.stdarg.h.p20
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.loop.c.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.mklibgcc.in.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.opts.c.p26
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.rtl.h.p11
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/gcc.toplev.c.p11
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/include.filenames.h.p14
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libgcc.config.host.p11
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libiberty.configure.p105
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libiberty.lbasename.c.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libiberty.make-temp-file.c.p27
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libiberty.pex-unix.c.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libiberty.strsignal.c.p13
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.config.cpu.m68k.atomicity.h.p25
-rw-r--r--m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.configure.p13
40 files changed, 2149 insertions, 27 deletions
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/configure.p b/m68k-unknown-amigaos/recipes/patches/gcc/configure.p
new file mode 100644
index 0000000..2561988
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/configure.p
@@ -0,0 +1,12 @@
+--- gcc-3.4.6/configure 2013-05-19 20:08:05.000000000 +0200
++++ configure 2013-05-19 20:23:32.000000000 +0200
+@@ -1060,6 +1060,9 @@
+ *-*-cygwin*)
+ noconfigdirs="autoconf automake send-pr rcs guile perl"
+ ;;
++ m68k-*-amigaos*)
++ noconfigdirs="$noconfigdirs texinfo"
++ ;;
+ *-*-netbsd*)
+ noconfigdirs="rcs"
+ ;;
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.Makefile.in.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.Makefile.in.p
new file mode 100644
index 0000000..2564f97
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.Makefile.in.p
@@ -0,0 +1,133 @@
+--- gcc-3.4.6/gcc/Makefile.in 2013-05-19 20:08:05.000000000 +0200
++++ gcc/Makefile.in 2013-05-19 20:23:32.000000000 +0200
+@@ -541,10 +541,36 @@
+ # List of additional header files to install.
+ EXTRA_HEADERS =@extra_headers_list@
+
++### begin-GG-local
++# List of extra targets that should be executed by make when building
++# the `doc' target.
++EXTRA_DOC_TARGETS =
++### end-GG-local
++
++### begin-GG-local
++# List of extra targets that should be executed by make when building
++# targets `stage1' to `stage4'.
++EXTRA_STAGE1_TARGETS =
++EXTRA_STAGE2_TARGETS =
++EXTRA_STAGE3_TARGETS =
++EXTRA_STAGE4_TARGETS =
++### end-GG-local
++
+ # It is convenient for configure to add the assignment at the beginning,
+ # so don't override it here.
+ USE_COLLECT2 = collect2$(exeext)
+
++### begin-GG-local: dynamic libraries
++# List of extra object files that should be compiled and linked with
++# collect2.
++EXTRA_COLLECT2_OBJS =
++### end-GG-local
++
++### begin-GG-local
++# List of extra targets that should be executed by make when installing.
++EXTRA_INSTALL_TARGETS =
++### end-GG-local
++
+ # List of extra C and assembler files to add to static and shared libgcc2.
+ # Assembler files should have names ending in `.asm'.
+ LIB2FUNCS_EXTRA =
+@@ -651,6 +677,11 @@
+ # at build time.
+ SPECS = specs
+
++# Even if ALLOCA is set, don't use it if compiling with GCC, unless
++# a configuration file overrides this default.
++USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo "${ALLOCA}" ;; esac `
++USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
++
+ # End of variables for you to override.
+
+ # GTM_H lists the config files that the generator files depend on,
+@@ -1186,6 +1217,7 @@
+ SHLIB_NM_FLAGS='$(SHLIB_NM_FLAGS)' \
+ MULTILIB_OSDIRNAMES='$(MULTILIB_OSDIRNAMES)' \
+ mkinstalldirs='$(SHELL) $(srcdir)/mkinstalldirs' \
++ LIBGCC_MULTI='$(LIBGCC_MULTI)' \
+ $(SHELL) mklibgcc > tmp-libgcc.mk
+ mv tmp-libgcc.mk libgcc.mk
+
+@@ -1351,7 +1383,9 @@
+ sbitmap.o: sbitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
+ hard-reg-set.h $(BASIC_BLOCK_H)
+
+-COLLECT2_OBJS = collect2.o tlink.o intl.o version.o
++### begin-GG-local: dynamic libraries
++COLLECT2_OBJS = collect2.o tlink.o intl.o version.o $(EXTRA_COLLECT2_OBJS)
++### end-GG-local
+ COLLECT2_LIBS = @COLLECT2_LIBS@
+ collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
+ # Don't try modifying collect2 (aka ld) in place--it might be linking this.
+@@ -2641,7 +2675,7 @@
+ #
+ # Remake the info files.
+
+-doc: $(BUILD_INFO) $(GENERATED_MANPAGES) gccbug
++doc: $(BUILD_INFO) $(GENERATED_MANPAGES) gccbug $(EXTRA_DOC_TARGETS)
+
+ INFOFILES = doc/cpp.info doc/gcc.info doc/gccint.info \
+ doc/gccinstall.info doc/cppinternals.info
+@@ -2810,7 +2844,7 @@
+ -rm -f config.h tconfig.h bconfig.h tm_p.h tm.h
+ -rm -f cs-*
+ -rm -rf libgcc
+- -rm -f doc/*.dvi
++ -rm -f doc/*.dvi doc/*.guide
+ # Delete the include directory.
+ -rm -rf include
+ # Delete files used by the "multilib" facility (including libgcc subdirs).
+@@ -2870,7 +2904,7 @@
+ # broken is small.
+ install: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
+ install-cpp install-man install-info install-@POSUB@ \
+- lang.install-normal install-driver
++ $(EXTRA_INSTALL_TARGETS) lang.install-normal install-driver
+
+ # Handle cpp installation.
+ install-cpp: cpp$(exeext)
+@@ -3647,7 +3681,7 @@
+ cp stage1/$${f} . ; \
+ else true; \
+ fi; done
+-stage1: force stage1-start lang.stage1
++stage1: force stage1-start lang.stage1 $(EXTRA_STAGE1_TARGETS)
+ -for dir in . $(SUBDIRS) ; \
+ do \
+ rm -f $$dir/*$(coverageexts) ; \
+@@ -3684,7 +3718,7 @@
+ cp stage2/$${f} . ; \
+ else true; \
+ fi; done
+-stage2: force stage2-start lang.stage2
++stage2: force stage2-start lang.stage2 $(EXTRA_STAGE2_TARGETS)
+
+ stage3-start:
+ -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
+@@ -3717,7 +3751,7 @@
+ cp stage3/$${f} . ; \
+ else true; \
+ fi; done
+-stage3: force stage3-start lang.stage3
++stage3: force stage3-start lang.stage3 $(EXTRA_STAGE3_TARGETS)
+
+ stage4-start:
+ -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
+@@ -3750,7 +3784,7 @@
+ cp stage4/$${f} . ; \
+ else true; \
+ fi; done
+-stage4: force stage4-start lang.stage4
++stage4: force stage4-start lang.stage4 $(EXTRA_STAGE4_TARGETS)
+
+ stageprofile-start:
+ -if [ -d stageprofile ] ; then true ; else mkdir stageprofile ; fi
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-decl.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-decl.c.p
new file mode 100644
index 0000000..6e7e353
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-decl.c.p
@@ -0,0 +1,87 @@
+--- gcc-3.4.6/gcc/c-decl.c 2013-05-19 20:09:27.000000000 +0200
++++ gcc/c-decl.c 2013-05-19 20:23:32.000000000 +0200
+@@ -2960,7 +2960,7 @@
+ and push that on the current scope. */
+
+ void
+-push_parm_decl (tree parm)
++push_parm_decl (tree parm, tree asmspec)
+ {
+ tree decl;
+ int old_dont_save_pending_sizes_p = 0;
+@@ -2983,6 +2983,75 @@
+ PARM, 0, NULL);
+ decl_attributes (&decl, TREE_VALUE (parm), 0);
+
++ /* begin-GG-local: explicit register specification for parameters */
++ if (asmspec)
++#ifdef TARGET_AMIGAOS
++ {
++ const char *regname=TREE_STRING_POINTER(asmspec);
++ int regnum;
++ if ((regnum=decode_reg_name(regname))>=0)
++ {
++ tree type=TREE_TYPE(decl);
++ if (HARD_REGNO_MODE_OK(regnum, TYPE_MODE(type)))
++ {
++ tree t, attrs;
++ /* Build tree for __attribute__ ((asm(regnum))). */
++#if 0
++ /* This doesn't work well because of a bug in
++ attribute_list_contained(), which passes list of arguments to
++ simple_cst_equal() instead of passing every argument
++ separately. */
++ attrs=tree_cons(get_identifier("asm"), tree_cons(NULL_TREE,
++ build_int_2_wide(regnum, 0), NULL_TREE), NULL_TREE);
++#else
++ attrs=tree_cons(get_identifier("asm"),
++ build_int_2_wide(regnum, 0), NULL_TREE);
++#endif
++#if 0
++ /* build_type_attribute_variant() would seem to be more
++ appropriate here. However, that function does not support
++ attributes for parameters properly. It modifies
++ TYPE_MAIN_VARIANT of a new type. As a result, comptypes()
++ thinks that types of parameters in prototype and definition
++ are different and issues error messages. See also comment
++ below. */
++ type=build_type_attribute_variant(type, attrs);
++#else
++ /* First check whether such a type already exists - if yes, use
++ that one. This is very important, since otherwise
++ common_type() would think that it sees two different
++ types and would try to merge them - this could result in
++ warning messages. */
++ for (t=TYPE_MAIN_VARIANT(type); t; t=TYPE_NEXT_VARIANT(t))
++ if (comptypes(t, type, COMPARE_STRICT)==1
++ && attribute_list_equal(TYPE_ATTRIBUTES(t), attrs))
++ break;
++ if (t)
++ type=t;
++ else
++ {
++ /* Create a new variant, with differing attributes.
++ (Hack! Type with differing attributes should no longer be
++ a variant of its main type. See comment above for
++ explanation why this was necessary). */
++ type=build_type_copy(type);
++ TYPE_ATTRIBUTES(type)=attrs;
++ }
++#endif
++ TREE_TYPE(decl)=type;
++ }
++ else
++ error ("%Jregister specified for '%D' isn't suitable for data type",
++ decl, decl);
++ }
++ else
++ error ("invalid register name `%s'", regname);
++ }
++#else /* !TARGET_AMIGAOS */
++ error("explicit register specification for parameters is not supported for this target");
++#endif /* !TARGET_AMIGAOS */
++ /* end-GG-local */
++
+ decl = pushdecl (decl);
+
+ finish_decl (decl, NULL_TREE, NULL_TREE);
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-incpath.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-incpath.c.p
new file mode 100644
index 0000000..9e91ea1
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-incpath.c.p
@@ -0,0 +1,19 @@
+--- gcc-3.4.6/gcc/c-incpath.c 2013-05-19 19:56:46.000000000 +0200
++++ gcc/c-incpath.c 2013-05-19 20:23:32.000000000 +0200
+@@ -28,14 +28,14 @@
+ #include "c-incpath.h"
+ #include "cppdefault.h"
+
+-/* Windows does not natively support inodes, and neither does MSDOS.
++/* Windows does not natively support inodes, and neither does MSDOS or AmigaOS.
+ Cygwin's emulation can generate non-unique inodes, so don't use it.
+ VMS has non-numeric inodes. */
+ #ifdef VMS
+ # define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A)))
+ # define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC))
+ #else
+-# if (defined _WIN32 && ! defined (_UWIN)) || defined __MSDOS__
++# if (defined _WIN32 && ! defined (_UWIN)) || defined __MSDOS__ || __amigaos__
+ # define INO_T_EQ(A, B) 0
+ # else
+ # define INO_T_EQ(A, B) ((A) == (B))
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-parse.in.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-parse.in.p
new file mode 100644
index 0000000..bedb438
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-parse.in.p
@@ -0,0 +1,223 @@
+--- c-parse.in 2004-10-15 00:12:53.000000000 +0100
++++ gcc/c-parse.in 2015-01-01 13:56:51.039003490 +0000
+@@ -29,7 +29,7 @@ Software Foundation, 59 Temple Place - S
+ written by AT&T, but I have never seen it. */
+
+ @@ifc
+-%expect 10 /* shift/reduce conflicts, and no reduce/reduce conflicts. */
++%expect 11 /* shift/reduce conflicts, and no reduce/reduce conflicts. */
+ @@end_ifc
+
+ %{
+@@ -1730,7 +1730,7 @@ enum_head:
+
+ structsp_attr:
+ struct_head identifier '{'
+- { $$ = start_struct (RECORD_TYPE, $2);
++ { $<ttype>$ = start_struct (RECORD_TYPE, $2);
+ /* Start scope of tag before parsing components. */
+ }
+ component_decl_list '}' maybe_attribute
+@@ -1741,7 +1741,7 @@ structsp_attr:
+ nreverse ($3), chainon ($1, $5));
+ }
+ | union_head identifier '{'
+- { $$ = start_struct (UNION_TYPE, $2); }
++ { $<ttype>$ = start_struct (UNION_TYPE, $2); }
+ component_decl_list '}' maybe_attribute
+ { $$ = finish_struct ($<ttype>4, nreverse ($5),
+ chainon ($1, $7)); }
+@@ -1750,12 +1750,12 @@ structsp_attr:
+ nreverse ($3), chainon ($1, $5));
+ }
+ | enum_head identifier '{'
+- { $$ = start_enum ($2); }
++ { $<ttype>$ = start_enum ($2); }
+ enumlist maybecomma_warn '}' maybe_attribute
+ { $$ = finish_enum ($<ttype>4, nreverse ($5),
+ chainon ($1, $8)); }
+ | enum_head '{'
+- { $$ = start_enum (NULL_TREE); }
++ { $<ttype>$ = start_enum (NULL_TREE); }
+ enumlist maybecomma_warn '}' maybe_attribute
+ { $$ = finish_enum ($<ttype>3, nreverse ($4),
+ chainon ($1, $7)); }
+@@ -1927,20 +1927,25 @@ absdcl: /* an absolute declarator */
+ | absdcl1
+ ;
+
++/* begin-GG-local: explicit register specification for parameters */
+ absdcl_maybe_attribute: /* absdcl maybe_attribute, but not just attributes */
+- /* empty */
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- NULL_TREE),
+- all_prefix_attributes); }
+- | absdcl1
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $1),
+- all_prefix_attributes); }
+- | absdcl1_noea attributes
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $1),
+- chainon ($2, all_prefix_attributes)); }
++ maybeasm
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, NULL_TREE),
++ all_prefix_attributes),
++ $1); }
++ | absdcl1 maybeasm
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $1),
++ all_prefix_attributes),
++ $2); }
++ | absdcl1_noea maybeasm attributes
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $1),
++ chainon ($3, all_prefix_attributes)),
++ $2); }
+ ;
++/* end-GG-local */
+
+ absdcl1: /* a nonempty absolute declarator */
+ absdcl1_ea
+@@ -2596,33 +2601,37 @@ parmlist_2: /* empty */
+ }
+ ;
+
++/* begin-GG-local: explicit register specification for parameters */
+ parms:
+ firstparm
+- { push_parm_decl ($1); }
++ { push_parm_decl (TREE_PURPOSE($1), TREE_VALUE($1)); }
+ | parms ',' parm
+- { push_parm_decl ($3); }
++ { push_parm_decl (TREE_PURPOSE($3), TREE_VALUE($3)); }
+ ;
+
+ /* A single parameter declaration or parameter type name,
+ as found in a parmlist. */
+ parm:
+- declspecs_ts setspecs parm_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $3),
+- chainon ($4, all_prefix_attributes));
++ declspecs_ts setspecs parm_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $3),
++ chainon ($5, all_prefix_attributes)),
++ $4);
+ POP_DECLSPEC_STACK; }
+- | declspecs_ts setspecs notype_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $3),
+- chainon ($4, all_prefix_attributes));
++ | declspecs_ts setspecs notype_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $3),
++ chainon ($5, all_prefix_attributes)),
++ $4);
+ POP_DECLSPEC_STACK; }
+ | declspecs_ts setspecs absdcl_maybe_attribute
+ { $$ = $3;
+ POP_DECLSPEC_STACK; }
+- | declspecs_nots setspecs notype_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $3),
+- chainon ($4, all_prefix_attributes));
++ | declspecs_nots setspecs notype_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $3),
++ chainon ($5, all_prefix_attributes)),
++ $4);
+ POP_DECLSPEC_STACK; }
+
+ | declspecs_nots setspecs absdcl_maybe_attribute
+@@ -2633,29 +2642,33 @@ parm:
+ /* The first parm, which must suck attributes from off the top of the parser
+ stack. */
+ firstparm:
+- declspecs_ts_nosa setspecs_fp parm_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $3),
+- chainon ($4, all_prefix_attributes));
++ declspecs_ts_nosa setspecs_fp parm_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $3),
++ chainon ($5, all_prefix_attributes)),
++ $4);
+ POP_DECLSPEC_STACK; }
+- | declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $3),
+- chainon ($4, all_prefix_attributes));
++ | declspecs_ts_nosa setspecs_fp notype_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $3),
++ chainon ($5, all_prefix_attributes)),
++ $4);
+ POP_DECLSPEC_STACK; }
+ | declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute
+ { $$ = $3;
+ POP_DECLSPEC_STACK; }
+- | declspecs_nots_nosa setspecs_fp notype_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $3),
+- chainon ($4, all_prefix_attributes));
++ | declspecs_nots_nosa setspecs_fp notype_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $3),
++ chainon ($5, all_prefix_attributes)),
++ $4);
+ POP_DECLSPEC_STACK; }
+
+ | declspecs_nots_nosa setspecs_fp absdcl_maybe_attribute
+ { $$ = $3;
+ POP_DECLSPEC_STACK; }
+ ;
++/* end-GG-local */
+
+ setspecs_fp:
+ setspecs
+@@ -3055,28 +3068,32 @@ mydecl:
+ { pedwarn ("empty declaration"); }
+ ;
+
++/* begin-GG-local: explicit register specification for parameters */
+ myparms:
+ myparm
+- { push_parm_decl ($1); }
++ { push_parm_decl (TREE_PURPOSE($1), TREE_VALUE($1)); }
+ | myparms ',' myparm
+- { push_parm_decl ($3); }
++ { push_parm_decl (TREE_PURPOSE($3), TREE_VALUE($3)); }
+ ;
+
+ /* A single parameter declaration or parameter type name,
+ as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */
+
+ myparm:
+- parm_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $1),
+- chainon ($2, all_prefix_attributes)); }
+- | notype_declarator maybe_attribute
+- { $$ = build_tree_list (build_tree_list (current_declspecs,
+- $1),
+- chainon ($2, all_prefix_attributes)); }
++ parm_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $1),
++ chainon ($3, all_prefix_attributes)),
++ $2); }
++ | notype_declarator maybeasm maybe_attribute
++ { $$ = build_tree_list (
++ build_tree_list (build_tree_list (current_declspecs, $1),
++ chainon ($2, all_prefix_attributes)),
++ $2); }
+ | absdcl_maybe_attribute
+ { $$ = $1; }
+ ;
++/* end-GG-local */
+
+ optparmlist:
+ /* empty */
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-tree.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-tree.h.p
new file mode 100644
index 0000000..629c4ef
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.c-tree.h.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/gcc/c-tree.h 2004-03-01 00:34:49.000000000 +0100
++++ gcc/c-tree.h 2013-05-19 20:23:32.000000000 +0200
+@@ -214,7 +214,9 @@
+ extern void pending_xref_error (void);
+ extern void c_push_function_context (struct function *);
+ extern void c_pop_function_context (struct function *);
+-extern void push_parm_decl (tree);
++/* begin-GG-local: explicit register specification for parameters */
++extern void push_parm_decl (tree, tree);
++/* end-GG-local */
+ extern tree pushdecl_top_level (tree);
+ extern void pushtag (tree, tree);
+ extern tree set_array_declarator_type (tree, tree, int);
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.calls.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.calls.c.p
new file mode 100644
index 0000000..b75a0f5
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.calls.c.p
@@ -0,0 +1,24 @@
+--- gcc-3.4.6/gcc/calls.c 2013-05-19 20:08:05.000000000 +0200
++++ gcc/calls.c 2013-05-19 20:23:32.000000000 +0200
+@@ -3777,6 +3777,10 @@
+ }
+ fun = orgfun;
+
++#ifdef LIBCALL_ENCODE_SECTION_INFO
++ LIBCALL_ENCODE_SECTION_INFO (fun);
++#endif
++
+ /* Ensure current function's preferred stack boundary is at least
+ what we need. */
+ if (cfun->preferred_stack_boundary < PREFERRED_STACK_BOUNDARY)
+@@ -3812,6 +3816,10 @@
+
+ /* ??? Unfinished: must pass the memory address as an argument. */
+
++#ifdef LIBCALL_ENCODE_SECTION_INFO
++ LIBCALL_ENCODE_SECTION_INFO (fun);
++#endif
++
+ /* Copy all the libcall-arguments out of the varargs data
+ and into a vector ARGVEC.
+
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.collect2.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.collect2.c.p
new file mode 100644
index 0000000..519a71f
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.collect2.c.p
@@ -0,0 +1,200 @@
+--- gcc-3.4.6/gcc/collect2.c 2013-05-19 20:08:05.000000000 +0200
++++ gcc/collect2.c 2013-05-19 20:23:32.000000000 +0200
+@@ -144,6 +144,12 @@
+ #define SCAN_LIBRARIES
+ #endif
+
++/* begin-GG-local: dynamic libraries */
++#ifndef DO_COLLECTING
++#define DO_COLLECTING do_collecting
++#endif
++/* end-GG-local */
++
+ #ifdef USE_COLLECT2
+ int do_collecting = 1;
+ #else
+@@ -256,8 +262,10 @@
+ static void prefix_from_env (const char *, struct path_prefix *);
+ static void prefix_from_string (const char *, struct path_prefix *);
+ static void do_wait (const char *);
+-static void fork_execute (const char *, char **);
+-static void maybe_unlink (const char *);
++/* begin-GG-local: dynamic libraries */
++void fork_execute (const char *, char **);
++void maybe_unlink (const char *);
++/* end-GG-local */
+ static void add_to_list (struct head *, const char *);
+ static int extract_init_priority (const char *);
+ static void sort_ids (struct head *);
+@@ -335,6 +343,12 @@
+ if (status != 0 && output_file != 0 && output_file[0])
+ maybe_unlink (output_file);
+
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_EXTRA_CLEANUP
++ COLLECT2_EXTRA_CLEANUP();
++#endif
++/* end-GG-local */
++
+ exit (status);
+ }
+
+@@ -423,6 +437,12 @@
+ maybe_unlink (export_file);
+ #endif
+
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_EXTRA_CLEANUP
++ COLLECT2_EXTRA_CLEANUP();
++#endif
++/* end-GG-local */
++
+ signal (signo, SIG_DFL);
+ kill (getpid (), signo);
+ }
+@@ -609,11 +629,7 @@
+
+ /* Determine the filename to execute (special case for absolute paths). */
+
+- if (*name == '/'
+-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+- || (*name && name[1] == ':')
+-#endif
+- )
++ if (IS_ABSOLUTE_PATH (name))
+ {
+ if (access (name, X_OK) == 0)
+ {
+@@ -881,6 +897,11 @@
+ const char *q = extract_string (&p);
+ if (*q == '-' && (q[1] == 'm' || q[1] == 'f'))
+ num_c_args++;
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_GCC_OPTIONS_HOOK
++ COLLECT2_GCC_OPTIONS_HOOK(q);
++#endif
++/* end-GG-local */
+ }
+ obstack_free (&temporary_obstack, temporary_firstobj);
+
+@@ -1112,6 +1133,11 @@
+ add_to_list (&libs, s);
+ }
+ #endif
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_LIBNAME_HOOK
++ COLLECT2_LIBNAME_HOOK(arg);
++#endif
++/* end-GG-local */
+ break;
+
+ #ifdef COLLECT_EXPORT_LIST
+@@ -1146,7 +1172,9 @@
+ break;
+
+ case 's':
+- if (arg[2] == '\0' && do_collecting)
++/* begin-GG-local: dynamic libraries */
++ if (arg[2] == '\0' && DO_COLLECTING)
++/* end-GG-local */
+ {
+ /* We must strip after the nm run, otherwise C++ linking
+ will not work. Thus we strip in the second ld run, or
+@@ -1190,6 +1218,11 @@
+ add_to_list (&libs, arg);
+ }
+ #endif
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_LIBNAME_HOOK
++ COLLECT2_LIBNAME_HOOK(arg);
++#endif
++/* end-GG-local */
+ }
+ }
+
+@@ -1283,6 +1316,12 @@
+ fprintf (stderr, "\n");
+ }
+
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_PRELINK_HOOK
++ COLLECT2_PRELINK_HOOK(ld1_argv, &strip_flag);
++#endif
++/* end-GG-local */
++
+ /* Load the program, searching all libraries and attempting to provide
+ undefined symbols from repository information. */
+
+@@ -1295,7 +1334,9 @@
+ constructor or destructor list, just return now. */
+ if (rflag
+ #ifndef COLLECT_EXPORT_LIST
+- || ! do_collecting
++/* begin-GG-local: dynamic libraries */
++ || ! DO_COLLECTING
++/* end-GG-local */
+ #endif
+ )
+ {
+@@ -1312,6 +1353,8 @@
+ return 0;
+ }
+
++/* begin-GG-local: dynamic libraries */
++#ifndef COLLECT2_POSTLINK_HOOK
+ /* Examine the namelist with nm and search it for static constructors
+ and destructors to call.
+ Write the constructor and destructor tables to a .s file and reload. */
+@@ -1331,6 +1374,10 @@
+ notice ("%d destructor(s) found\n", destructors.number);
+ notice ("%d frame table(s) found\n", frame_tables.number);
+ }
++#else /* COLLECT2_POSTLINK_HOOK */
++ COLLECT2_POSTLINK_HOOK(output_file);
++#endif
++/* end-GG-local */
+
+ if (constructors.number == 0 && destructors.number == 0
+ && frame_tables.number == 0
+@@ -1363,6 +1410,11 @@
+ #endif
+ maybe_unlink (c_file);
+ maybe_unlink (o_file);
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_EXTRA_CLEANUP
++ COLLECT2_EXTRA_CLEANUP();
++#endif
++/* end-GG-local */
+ return 0;
+ }
+
+@@ -1454,6 +1506,11 @@
+ maybe_unlink (export_file);
+ #endif
+
++/* begin-GG-local: dynamic libraries */
++#ifdef COLLECT2_EXTRA_CLEANUP
++ COLLECT2_EXTRA_CLEANUP();
++#endif
++/* end-GG-local */
+ return 0;
+ }
+
+@@ -1567,7 +1624,7 @@
+ fatal_perror (errmsg_fmt, errmsg_arg);
+ }
+
+-static void
++void
+ fork_execute (const char *prog, char **argv)
+ {
+ collect_execute (prog, argv, NULL);
+@@ -1576,7 +1633,7 @@
+
+ /* Unlink a file unless we are debugging. */
+
+-static void
++void
+ maybe_unlink (const char *file)
+ {
+ if (!debug)
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.common.opt.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.common.opt.p
new file mode 100644
index 0000000..61050e1
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.common.opt.p
@@ -0,0 +1,17 @@
+--- gcc-3.4.6/gcc/common.opt 2013-05-19 20:02:45.000000000 +0200
++++ gcc/common.opt 2013-05-19 20:23:32.000000000 +0200
+@@ -226,6 +226,14 @@
+ Common
+ Generate unwind tables that are exact at each instruction boundary
+
++fbaserel
++Common
++Generate base-relative code
++
++fbaserel32
++Common
++Generate base-relative code with no data limits
++
+ fbounds-check
+ Common
+ Generate code to check bounds before indexing arrays
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.gcc.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.gcc.p
index 0f0438c..76465d5 100644
--- a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.gcc.p
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.gcc.p
@@ -1,17 +1,17 @@
---- gcc/config.gcc 2010-12-16 13:06:35.000000000 +0000
-+++ gcc/config.gcc 2010-12-16 13:09:52.000000000 +0000
-@@ -1671,6 +1671,14 @@
- tm_defines="${tm_defines} MOTOROLA=1"
+--- gcc-3.4.6/gcc/config.gcc 2013-05-19 20:09:27.000000000 +0200
++++ gcc/config.gcc 2013-05-19 20:23:32.000000000 +0200
+@@ -1466,6 +1466,14 @@
+ tm_defines="MOTOROLA USE_GAS"
extra_parts="crtbegin.o crtend.o"
;;
+m68k-*-amigaos*)
-+ tmake_file="m68k/t-amigaos"
++ tmake_file=m68k/t-amigaos
+ tm_file="${tm_file} m68k/amigaos.h"
+ tm_p_file="${tm_p_file} m68k/amigaos-protos.h"
-+ tm_defines="${tm_defines} TARGET_AMIGAOS TARGET_DEFAULT=0"
-+ extra_objs="amigaos.o"
++ tm_defines="TARGET_AMIGAOS TARGET_DEFAULT=0" # 68000, no 68881, no bitfield ops
++ extra_objs=amigaos.o
+ gnu_ld=yes
+ ;;
mcore-*-elf)
- tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file} mcore/mcore-elf.h"
+ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} mcore/mcore-elf.h"
tmake_file=mcore/t-mcore
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host-linux.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host-linux.c.p
new file mode 100644
index 0000000..c040f23
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host-linux.c.p
@@ -0,0 +1,11 @@
+--- gcc-3.4.6/gcc/config/host-linux.c 2013-05-19 20:51:29.000000000 +0200
++++ gcc/config/host-linux.c 2013-05-19 20:51:47.000000000 +0200
+@@ -189,7 +189,7 @@
+
+ /* Try to make an anonymous private mmap at the desired location. */
+ addr = mmap (base, size, PROT_READ | PROT_WRITE,
+- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
++ MAP_PRIVATE | MAP_ANON, -1, 0);
+
+ if (addr != base)
+ {
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host.p
index f13685e..065fa66 100644
--- a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host.p
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.host.p
@@ -1,12 +1,14 @@
---- gcc/config.host 2010-12-20 02:28:16.000000000 +0000
-+++ gcc/config.host 2010-12-20 02:31:32.000000000 +0000
-@@ -264,4 +264,9 @@
- out_host_hook_obj=host-hpux.o
- host_xmake_file="${host_xmake_file} x-hpux"
+--- gcc-3.4.6/gcc/config.host 2013-05-19 20:09:27.000000000 +0200
++++ gcc/config.host 2013-05-19 20:23:32.000000000 +0200
+@@ -154,6 +154,11 @@
+ i860-*-sysv4*)
+ host_xmake_file=i860/x-sysv4
;;
+ m68k-*-amigaos*)
-+ host_xm_file="m68k/xm-amigaos.h"
-+ host_xmake_file="m68k/x-amigaos"
++ host_xm_file=m68k/xm-amigaos.h
++ host_xmake_file=m68k/x-amigaos
+ out_host_hook_obj=host-amigaos.o
+ ;;
- esac
+ powerpc-*-darwin*)
+ # powerpc-darwin host support.
+ out_host_hook_obj=host-darwin.o
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k-protos.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k-protos.h.p
new file mode 100644
index 0000000..222d80c
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k-protos.h.p
@@ -0,0 +1,14 @@
+--- gcc-3.4.6/gcc/config/m68k/m68k-protos.h 2013-05-19 20:09:27.000000000 +0200
++++ gcc/config/m68k/m68k-protos.h 2013-05-19 20:23:32.000000000 +0200
+@@ -68,3 +68,11 @@
+ extern void override_options (void);
+ extern void init_68881_table (void);
+ extern int m68k_hard_regno_rename_ok(unsigned int, unsigned int);
++
++#ifdef RTX_CODE
++#ifdef TREE_CODE
++extern void m68k_init_cumulative_args (CUMULATIVE_ARGS *, tree);
++extern void m68k_function_arg_advance (CUMULATIVE_ARGS *);
++extern struct rtx_def *m68k_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree);
++#endif
++#endif
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.c.p
new file mode 100644
index 0000000..9ca42a1
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.c.p
@@ -0,0 +1,513 @@
+--- gcc-3.4.6/gcc/config/m68k/m68k.c 2013-05-19 20:09:27.000000000 +0200
++++ gcc/config/m68k/m68k.c 2013-05-19 20:23:32.000000000 +0200
+@@ -123,6 +123,8 @@
+ static tree m68k_handle_fndecl_attribute (tree *node, tree name,
+ tree args, int flags,
+ bool *no_add_attrs);
++static tree m68k_handle_type_attribute (tree *, tree, tree, int, bool *);
++static int m68k_comp_type_attributes (tree, tree);
+ static void m68k_compute_frame_layout (void);
+ static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
+ static int const_int_cost (rtx);
+@@ -138,6 +140,8 @@
+ const char *m68k_align_funcs_string;
+ /* Specify the identification number of the library being built */
+ const char *m68k_library_id_string;
++/* Specify number of registers for integer, pointer and float arguments. */
++const char *m68k_regparm_string;
+
+ /* Specify power of two alignment used for loops. */
+ int m68k_align_loops;
+@@ -145,6 +149,8 @@
+ int m68k_align_jumps;
+ /* Specify power of two alignment used for functions. */
+ int m68k_align_funcs;
++/* Specify number of registers for integer, pointer and float arguments. */
++int m68k_regparm;
+
+ /* Nonzero if the last compare/test insn had FP operands. The
+ sCC expanders peek at this to determine what to do for the
+@@ -208,9 +214,30 @@
+ {
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+ { "interrupt_handler", 0, 0, true, false, false, m68k_handle_fndecl_attribute },
++
++ /* Stkparm attribute specifies to pass arguments on the stack */
++ { "stkparm", 0, 0, false, true, true, m68k_handle_type_attribute },
++ /* Regparm attribute specifies how many integer arguments are to be
++ passed in registers. */
++ { "regparm", 0, 1, false, true, true, m68k_handle_type_attribute },
++
++#ifdef TARGET_AMIGAOS
++ /* Stackext attribute specifies to generate stackextension code */
++ { "stackext", 0, 0, false, true, true, amigaos_handle_type_attribute },
++ /* Interrupt attribute specifies to generate a special exit code */
++ { "interrupt", 0, 0, false, true, true, amigaos_handle_type_attribute },
++ /* Saveds attribute specifies to generate baserel setup code */
++ { "saveds", 0, 0, false, true, true, amigaos_handle_type_attribute },
++ /* Chip attribute specifies to place data in a "special" section */
++ { "chip", 0, 0, true, false, false, amigaos_handle_decl_attribute },
++#endif
++
+ { NULL, 0, 0, false, false, false, NULL }
+ };
+
++#undef TARGET_COMP_TYPE_ATTRIBUTES
++#define TARGET_COMP_TYPE_ATTRIBUTES m68k_comp_type_attributes
++
+ struct gcc_target targetm = TARGET_INITIALIZER;
+
+ /* Sometimes certain combinations of command options do not make
+@@ -296,6 +323,23 @@
+ m68k_align_funcs = i;
+ }
+
++ /* Validate -mregparm and -mregparm= value. */
++ if (m68k_regparm_string)
++ {
++ m68k_regparm = atoi (m68k_regparm_string);
++ if (m68k_regparm < 1 || m68k_regparm > M68K_MAX_REGPARM)
++ error ("-mregparm=%d is not between 1 and %d",
++ m68k_regparm, M68K_MAX_REGPARM);
++ target_flags |= MASK_REGPARM;
++ }
++ else
++ if (TARGET_REGPARM)
++ m68k_regparm = M68K_DEFAULT_REGPARM;
++
++ /* XXX: FIXME: Workaround for a bug. */
++ if (flag_pic >= 3)
++ flag_strength_reduce = 0;
++
+ /* -fPIC uses 32-bit pc-relative displacements, which don't exist
+ until the 68020. */
+ if (!TARGET_68020 && !TARGET_COLDFIRE && (flag_pic == 2))
+@@ -312,12 +356,14 @@
+ the PLT entry for `foo'. Doing function cse will cause the address of
+ `foo' to be loaded into a register, which is exactly what we want to
+ avoid when we are doing PIC on svr4 m68k. */
+- if (flag_pic)
++ if (flag_pic && flag_pic < 3)
+ flag_no_function_cse = 1;
+
+ SUBTARGET_OVERRIDE_OPTIONS;
+ }
+
++/* Attributes support. */
++
+ /* Return nonzero if FUNC is an interrupt function as specified by the
+ "interrupt_handler" attribute. */
+ static bool
+@@ -350,6 +396,251 @@
+ return NULL_TREE;
+ }
+
++/* Handle a "regparm" or "stkparm" attribute;
++ arguments as in struct attribute_spec.handler. */
++
++static tree
++m68k_handle_type_attribute (tree *node, tree name, tree args,
++ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
++{
++ if (TREE_CODE (*node) == FUNCTION_TYPE || TREE_CODE (*node) == METHOD_TYPE)
++ {
++ /* 'regparm' accepts one optional argument - number of registers in
++ single class that should be used to pass arguments. */
++ if (is_attribute_p ("regparm", name))
++ {
++ if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(*node)))
++ {
++ error ("`regparm' and `stkparm' are mutually exclusive");
++ }
++ if (args && TREE_CODE (args) == TREE_LIST)
++ {
++ tree numofregs = TREE_VALUE (args);
++ if (numofregs)
++ if (TREE_CODE (numofregs) != INTEGER_CST
++/*
++ || compare_tree_int(numofregs, 1) < 0
++ || compare_tree_int(numofregs, M68K_MAX_REGPARM) > 0)
++*/
++ || TREE_INT_CST_HIGH (numofregs)
++ || TREE_INT_CST_LOW (numofregs) < 1
++ || TREE_INT_CST_LOW (numofregs) > M68K_MAX_REGPARM)
++ {
++ error ("invalid argument to `regparm' attribute");
++ }
++ }
++ }
++ else if (is_attribute_p ("stkparm", name))
++ {
++ if (lookup_attribute ("regparm", TYPE_ATTRIBUTES(*node)))
++ {
++ error ("`regparm' and `stkparm' are mutually exclusive");
++ }
++ }
++ }
++ else
++ {
++ warning ("`%s' attribute only applies to functions",
++ IDENTIFIER_POINTER (name));
++ *no_add_attrs = true;
++ }
++
++ return NULL_TREE;
++}
++
++/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
++ one if they are compatible, and two if they are nearly compatible
++ (which causes a warning to be generated). */
++
++static int
++m68k_comp_type_attributes (tree type1, tree type2)
++{
++ /* Functions or methods are incompatible if they specify mutually
++ exclusive ways of passing arguments. */
++ if (TREE_CODE (type1) == FUNCTION_TYPE || TREE_CODE (type1) == METHOD_TYPE)
++ {
++ tree arg1, arg2;
++ if (!! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type1)) !=
++ !! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type2))
++ || !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1)) !=
++ !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2)))
++ return 0; /* 'regparm' and 'stkparm' are mutually exclusive. */
++
++ arg1 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1));
++ arg2 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2));
++ if (arg1 && arg2)
++ {
++ int num1 = 0, num2 = 0;
++ if (TREE_VALUE (arg1) && TREE_CODE (TREE_VALUE (arg1)) == TREE_LIST)
++ {
++ tree numofregs = TREE_VALUE (TREE_VALUE (arg1));
++ if (numofregs)
++ num1 = TREE_INT_CST_LOW (numofregs);
++ }
++ if (TREE_VALUE (arg2) && TREE_CODE (TREE_VALUE (arg2)) == TREE_LIST)
++ {
++ tree numofregs = TREE_VALUE (TREE_VALUE (arg2));
++ if (numofregs)
++ num2 = TREE_INT_CST_LOW (numofregs);
++ }
++ if (num1 != num2)
++ return 0; /* Different numbers, or no number in one type. */
++ }
++ }
++#ifdef TARGET_AMIGAOS
++ return amigaos_comp_type_attributes(type1, type2);
++#else
++ return 1;
++#endif
++}
++
++/* Argument-passing support functions. */
++
++/* 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. */
++
++void
++m68k_init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype)
++{
++ cum->last_arg_reg = -1;
++ cum->regs_already_used = 0;
++ if (fntype)
++ {
++ if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES (fntype)))
++ cum->num_of_regs = 0;
++ else
++ {
++ tree ratree = lookup_attribute ("regparm", TYPE_ATTRIBUTES (fntype));
++ if (ratree)
++ {
++ cum->num_of_regs = m68k_regparm ? m68k_regparm
++ : M68K_DEFAULT_REGPARM;
++ if (TREE_VALUE (ratree)
++ && TREE_CODE (TREE_VALUE (ratree)) == TREE_LIST)
++ {
++ tree num_of_regs = TREE_VALUE (TREE_VALUE (ratree));
++ cum->num_of_regs =
++ num_of_regs ? TREE_INT_CST_LOW (num_of_regs) :
++ (m68k_regparm ? m68k_regparm : M68K_DEFAULT_REGPARM);
++ }
++ }
++ else
++ cum->num_of_regs = m68k_regparm;
++ }
++ }
++ else /* Libcall. */
++ cum->num_of_regs = 0;
++
++ if (cum->num_of_regs)
++ {
++ /* If this is a vararg call, put all arguments on stack. */
++ tree param, next_param;
++ for (param = TYPE_ARG_TYPES (fntype); param; param = next_param)
++ {
++ next_param = TREE_CHAIN (param);
++ if (!next_param && TREE_VALUE (param) != void_type_node)
++ cum->num_of_regs = 0;
++ }
++ }
++
++#if ! defined (PCC_STATIC_STRUCT_RETURN) && defined (STRUCT_VALUE_REGNUM)
++ /* If return value is a structure, and we pass the buffer address in a
++ register, we can't use this register for our own purposes.
++ FIXME: Something similar would be useful for static chain. */
++ if (fntype && aggregate_value_p (TREE_TYPE (fntype), fntype))
++ cum->regs_already_used |= (1 << STRUCT_VALUE_REGNUM);
++#endif
++}
++
++/* Update the data in CUM to advance over an argument. */
++
++void
++m68k_function_arg_advance (CUMULATIVE_ARGS *cum)
++{
++ if (cum->last_arg_reg != -1)
++ {
++ int count;
++ for (count = 0; count < cum->last_arg_len; count++)
++ cum->regs_already_used |= (1 << (cum->last_arg_reg + count));
++ cum->last_arg_reg = -1;
++ }
++}
++
++/* Define where to put the arguments 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. */
++
++struct rtx_def *
++m68k_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type)
++{
++ if (cum->num_of_regs)
++ {
++ int regbegin = -1, altregbegin = -1, len;
++
++ /* FIXME: The last condition below is a workaround for a bug. */
++ if (TARGET_68881 && FLOAT_MODE_P (mode) &&
++ GET_MODE_UNIT_SIZE (mode) <= 12 &&
++ (GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT || mode == SCmode))
++ {
++ regbegin = 16; /* FPx */
++ len = GET_MODE_NUNITS (mode);
++ }
++ /* FIXME: Two last conditions below are workarounds for bugs. */
++ else if (INTEGRAL_MODE_P (mode) && mode !=CQImode && mode != CHImode)
++ {
++ if (POINTER_TYPE_P (type))
++ regbegin = 8; /* Ax */
++ else
++ regbegin = 0; /* Dx */
++ altregbegin = 8 - regbegin;
++ len = (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
++ }
++
++ if (regbegin != -1)
++ {
++ int reg;
++ long mask;
++
++look_for_reg:
++ mask = 1 << regbegin;
++ for (reg = 0; reg < cum->num_of_regs; reg++, mask <<= 1)
++ if (!(cum->regs_already_used & mask))
++ {
++ int end;
++ for (end = reg; end < cum->num_of_regs && end < reg + len;
++ end++, mask <<= 1)
++ if (cum->regs_already_used & mask)
++ break;
++ if (end == reg + len)
++ {
++ cum->last_arg_reg = reg + regbegin;
++ cum->last_arg_len = len;
++ break;
++ }
++ }
++
++ if (reg == cum->num_of_regs && altregbegin != -1)
++ {
++ regbegin = altregbegin;
++ altregbegin = -1;
++ goto look_for_reg;
++ }
++ }
++
++ if (cum->last_arg_reg != -1)
++ return gen_rtx_REG (mode, cum->last_arg_reg);
++ }
++ return 0;
++}
++
+ static void
+ m68k_compute_frame_layout (void)
+ {
+@@ -428,10 +719,14 @@
+ static bool
+ m68k_save_reg (unsigned int regno, bool interrupt_handler)
+ {
+- if (flag_pic && current_function_uses_pic_offset_table
++ if (flag_pic && flag_pic < 3 && current_function_uses_pic_offset_table
+ && regno == PIC_OFFSET_TABLE_REGNUM)
+ return true;
+
++#ifdef EXTRA_SAVE_REG
++ EXTRA_SAVE_REG(regno);
++#endif
++
+ if (current_function_calls_eh_return)
+ {
+ unsigned int i;
+@@ -480,6 +775,9 @@
+ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
+ {
+ HOST_WIDE_INT fsize_with_regs;
++#if !defined (DWARF2_DEBUGGING_INFO) && !defined (DWARF2_UNWIND_INFO)
++#define dwarf2out_do_frame() 0
++#endif
+ HOST_WIDE_INT cfa_offset = INCOMING_FRAME_SP_OFFSET;
+
+ m68k_compute_frame_layout();
+@@ -496,8 +794,17 @@
+ if (TARGET_COLDFIRE && current_frame.reg_no > 2)
+ fsize_with_regs += current_frame.reg_no * 4;
+
++#ifdef PROLOGUE_BEGIN_HOOK
++ PROLOGUE_BEGIN_HOOK (stream, fsize_with_regs);
++#endif
++
+ if (frame_pointer_needed)
+ {
++#ifdef HAVE_ALTERNATE_FRAME_SETUP_F
++ if (HAVE_ALTERNATE_FRAME_SETUP_F (fsize_with_regs))
++ ALTERNATE_FRAME_SETUP_F (stream, fsize_with_regs);
++ else
++#endif
+ if (current_frame.size == 0 && TARGET_68040)
+ /* on the 68040, pea + move is faster than link.w 0 */
+ fprintf (stream, MOTOROLA ?
+@@ -528,6 +835,10 @@
+ cfa_offset += current_frame.size;
+ }
+ }
++#ifdef HAVE_ALTERNATE_FRAME_SETUP
++ else if (HAVE_ALTERNATE_FRAME_SETUP (fsize_with_regs))
++ ALTERNATE_FRAME_SETUP (stream, fsize_with_regs);
++#endif
+ else if (fsize_with_regs) /* !frame_pointer_needed */
+ {
+ if (fsize_with_regs < 0x8000)
+@@ -658,7 +969,12 @@
+ dwarf2out_reg_save (l, regno, -cfa_offset + n_regs++ * 4);
+ }
+ }
+- if (!TARGET_SEP_DATA && flag_pic &&
++#ifdef HAVE_ALTERNATE_PIC_SETUP
++ if (HAVE_ALTERNATE_PIC_SETUP)
++ ALTERNATE_PIC_SETUP (stream);
++ else
++#endif
++ if (!TARGET_SEP_DATA && flag_pic && flag_pic < 3 &&
+ (current_function_uses_pic_offset_table ||
+ (!current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)))
+ {
+@@ -921,6 +1237,11 @@
+ }
+ }
+ if (frame_pointer_needed)
++#ifdef HAVE_ALTERNATE_FRAME_DESTR_F
++ if (HAVE_ALTERNATE_FRAME_DESTR_F (fsize_with_regs))
++ ALTERNATE_FRAME_DESTR_F (stream, fsize_with_regs);
++ else
++#endif
+ fprintf (stream, "\tunlk %s\n",
+ reg_names[FRAME_POINTER_REGNUM]);
+ else if (fsize_with_regs)
+@@ -958,10 +1279,17 @@
+ }
+ if (current_function_calls_eh_return)
+ asm_fprintf (stream, "\tadd" ASM_DOT"l %Ra0,%Rsp\n");
++#ifdef EPILOGUE_END_HOOK
++ EPILOGUE_END_HOOK (stream);
++#endif
+ if (m68k_interrupt_function_p (current_function_decl))
+ fprintf (stream, "\trte\n");
+ else if (current_function_pops_args)
+ asm_fprintf (stream, "\trtd %I%d\n", current_function_pops_args);
++#ifdef HAVE_ALTERNATE_RETURN
++ else if (HAVE_ALTERNATE_RETURN)
++ ALTERNATE_RETURN (stream);
++#endif
+ else
+ fprintf (stream, "\trts\n");
+ }
+@@ -1454,12 +1782,20 @@
+ /* First handle a simple SYMBOL_REF or LABEL_REF */
+ if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
+ {
++#ifdef LEGITIMATE_BASEREL_OPERAND_P
++ if (LEGITIMATE_BASEREL_OPERAND_P (orig))
++ return orig;
++#endif
++
+ if (reg == 0)
+ abort ();
+
+- pic_ref = gen_rtx_MEM (Pmode,
+- gen_rtx_PLUS (Pmode,
+- pic_offset_table_rtx, orig));
++ if (flag_pic < 3)
++ pic_ref = gen_rtx_MEM (Pmode,
++ gen_rtx_PLUS (Pmode,
++ pic_offset_table_rtx, orig));
++ else
++ pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, orig);
+ current_function_uses_pic_offset_table = 1;
+ RTX_UNCHANGING_P (pic_ref) = 1;
+ emit_move_insn (reg, pic_ref);
+@@ -3001,6 +3337,10 @@
+ fprintf (file, ":w"); break;
+ case 2:
+ fprintf (file, ":l"); break;
++ case 3:
++ fprintf (file, ":W"); break;
++ case 4:
++ fprintf (file, ":L"); break;
+ default:
+ break;
+ }
+@@ -3488,7 +3828,7 @@
+ xops[0] = DECL_RTL (function);
+
+ /* Logic taken from call patterns in m68k.md. */
+- if (flag_pic)
++ if (flag_pic && flag_pic < 3)
+ {
+ if (TARGET_PCREL)
+ fmt = "bra.l %o0";
+@@ -3544,7 +3884,8 @@
+
+ /* Value is true if hard register REGNO can hold a value of machine-mode MODE.
+ On the 68000, the cpu registers can hold any mode except bytes in address
+- registers, but the 68881 registers can hold only SFmode or DFmode. */
++ registers, but the 68881 registers can hold only SFmode or DFmode.
++ The 68881 registers can't hold anything if 68881 use is disabled. */
+ bool
+ m68k_regno_mode_ok (int regno, enum machine_mode mode)
+ {
+@@ -3569,6 +3910,7 @@
+ smaller. */
+ if ((GET_MODE_CLASS (mode) == MODE_FLOAT
+ || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
++ && TARGET_68881
+ && GET_MODE_UNIT_SIZE (mode) <= 12)
+ return true;
+ }
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.h.p
new file mode 100644
index 0000000..b6d1f66
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.h.p
@@ -0,0 +1,175 @@
+--- gcc-3.4.6/gcc/config/m68k/m68k.h 2013-05-19 20:09:27.000000000 +0200
++++ gcc/config/m68k/m68k.h 2013-05-19 20:23:32.000000000 +0200
+@@ -226,6 +226,11 @@
+ #define MASK_ID_SHARED_LIBRARY (1<<18)
+ #define TARGET_ID_SHARED_LIBRARY (target_flags & MASK_ID_SHARED_LIBRARY)
+
++/* Compile using the first 'm68k_regparm' data, address and float
++ registers for arguments passing. */
++#define MASK_REGPARM (1<<24)
++#define TARGET_REGPARM (target_flags & MASK_REGPARM)
++
+ /* Compile for a CPU32. A 68020 without bitfields is a good
+ heuristic for a CPU32. */
+ #define TARGET_CPU32 (TARGET_68020 && !TARGET_BITFIELD)
+@@ -342,6 +347,10 @@
+ N_("Use different calling convention using 'rtd'") }, \
+ { "nortd", - MASK_RTD, \
+ N_("Use normal calling convention") }, \
++ { "regparm", MASK_REGPARM, \
++ N_("Pass arguments through registers") }, \
++ { "no-regparm", - MASK_REGPARM, \
++ N_("Don't pass arguments through registers") }, \
+ SUBTARGET_SWITCHES \
+ { "", TARGET_DEFAULT, "" }}
+ /* TARGET_DEFAULT is defined in m68k-none.h, netbsd.h, etc. */
+@@ -364,6 +373,8 @@
+ N_("Function starts are aligned to this power of 2"), 0}, \
+ { "shared-library-id=", &m68k_library_id_string, \
+ N_("ID of shared library to build"), 0}, \
++ { "regparm=", &m68k_regparm_string, \
++ N_("Use this register count to pass arguments"), 0}, \
+ SUBTARGET_OPTIONS \
+ }
+
+@@ -556,7 +567,8 @@
+
+ /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
+ On the 68000, the cpu registers can hold any mode except bytes in
+- address registers, the 68881 registers can hold only SFmode or DFmode. */
++ address registers, the 68881 registers can hold only SFmode or DFmode.
++ The 68881 registers can't hold anything if 68881 use is disabled. */
+
+ #define HARD_REGNO_MODE_OK(REGNO, MODE) \
+ m68k_regno_mode_ok ((REGNO), (MODE))
+@@ -805,7 +817,7 @@
+ /* On the 68000, this is the size of MODE in words,
+ except in the FP regs, where a single reg is always enough. */
+ #define CLASS_MAX_NREGS(CLASS, MODE) \
+- ((CLASS) == FP_REGS ? 1 \
++ ((CLASS) == FP_REGS ? GET_MODE_NUNITS (MODE) \
+ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
+
+ /* Moves between fp regs and other regs are two insns. */
+@@ -901,10 +913,19 @@
+
+ #define PCC_STATIC_STRUCT_RETURN
+
+-/* 1 if N is a possible register number for function argument passing.
+- On the 68000, no registers are used in this way. */
++/* 1 if N is a possible register number for function argument passing. */
+
+-#define FUNCTION_ARG_REGNO_P(N) 0
++#define FUNCTION_ARG_REGNO_P(N) \
++ ((((int)N) >= 0 && (N) < M68K_MAX_REGPARM) \
++ || ((N) >= 8 && (N) < 8 + M68K_MAX_REGPARM) \
++ || (TARGET_68881 && (N) >= 16 && (N) < 16 + M68K_MAX_REGPARM))
++
++/* Nonzero if we need to generate special stack-allocating insns.
++ On most systems they are not needed.
++ When they are needed, also define ALTERNATE_ALLOCATE_STACK (see m68k.md)
++ to perform the necessary actions. */
++
++#define TARGET_ALTERNATE_ALLOCATE_STACK 0
+
+ /* Define a data type for recording info about an argument list
+ during the scan of that argument list. This data type should
+@@ -912,28 +933,52 @@
+ and about the args processed so far, enough to enable macros
+ such as FUNCTION_ARG to determine where the next arg should go.
+
+- On the m68k, this is a single integer, which is a number of bytes
+- of arguments scanned so far. */
++ On the m68k, this is a structure:
++ num_of_regs: number of data, address and float registers to use for
++ arguments passing (if it's 2, than pass arguments in d0, d1, a0, a1,
++ fp0 and fp1). 0 - pass everything on stack. vararg calls are
++ always passed entirely on stack.
++ regs_already_used: bitmask of the already used registers.
++ last_arg_reg - register number of the most recently passed argument.
++ -1 if passed on stack.
++ last_arg_len - number of registers used by the most recently passed
++ argument.
++*/
+
+-#define CUMULATIVE_ARGS int
++struct m68k_args
++{
++ int num_of_regs;
++ long regs_already_used;
++ int last_arg_reg;
++ int last_arg_len;
++};
++
++#define CUMULATIVE_ARGS struct m68k_args
++
++/* Max. number of data, address and float registers to be used for passing
++ integer, pointer and float arguments when TARGET_REGPARM.
++ It's 4, so d0-d3, a0-a3 and fp0-fp3 can be used. */
++
++#define M68K_MAX_REGPARM 4
++
++/* The default number of data, address and float registers to use when
++ user specified '-mregparm' switch, not '-mregparm=<value>' option. */
++
++#define M68K_DEFAULT_REGPARM 2
+
+ /* 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.
+-
+- On the m68k, the offset starts at 0. */
++ For a library call, FNTYPE is 0. */
+
+ #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
+- ((CUM) = 0)
++ (m68k_init_cumulative_args (&(CUM), (FNTYPE)))
+
+ /* 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.) */
+
+ #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
+- ((CUM) += ((MODE) != BLKmode \
+- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
+- : (int_size_in_bytes (TYPE) + 3) & ~3))
++ (m68k_function_arg_advance (&(CUM)))
+
+ /* Define where to put the arguments to a function.
+ Value is zero to push the argument on the stack,
+@@ -948,9 +993,15 @@
+ NAMED is nonzero if this argument is a named parameter
+ (otherwise it is an extra parameter matching an ellipsis).
+
+- On the m68k all args are always pushed. */
++ On m68k all args are pushed, except if -mregparm is specified, then
++ a number of arguments is passed in the first 'm68k_regparm' data,
++ address and float registers.
++ Note: by default, the static-chain is passed in a0. Targets that want
++ to make full use of '-mregparm' are advised to pass the static-chain
++ somewhere else. */
+
+-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
++#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
++ (m68k_function_arg (&(CUM), (MODE), (TYPE)))
+
+ /* For an arg passed partly in registers and partly in memory,
+ this is the number of registers used.
+@@ -1688,14 +1739,17 @@
+
+ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
+
++
+ /* Variables in m68k.c */
+ extern const char *m68k_align_loops_string;
+ extern const char *m68k_align_jumps_string;
+ extern const char *m68k_align_funcs_string;
+ extern const char *m68k_library_id_string;
++extern const char *m68k_regparm_string;
+ extern int m68k_align_loops;
+ extern int m68k_align_jumps;
+ extern int m68k_align_funcs;
++extern int m68k_regparm;
+ extern int m68k_last_compare_had_fp_operands;
+
+
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.md.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.md.p
new file mode 100644
index 0000000..c63b8d5
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.config.m68k.m68k.md.p
@@ -0,0 +1,82 @@
+--- m68k.md.orig 2005-07-26 21:32:25.000000000 +0100
++++ gcc/config/m68k/m68k.md 2015-01-01 14:46:17.666994805 +0000
+@@ -3679,7 +3679,7 @@
+ target = operand_subword_force (operands[0], 0, SFmode);
+ result = expand_binop (SImode, xor_optab,
+ operand_subword_force (operands[1], 0, SFmode),
+- GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
++ GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
+ if (result == 0)
+ abort ();
+
+@@ -3723,7 +3723,7 @@
+ target = operand_subword (operands[0], 0, 1, DFmode);
+ result = expand_binop (SImode, xor_optab,
+ operand_subword_force (operands[1], 0, DFmode),
+- GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
++ GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
+ if (result == 0)
+ abort ();
+
+@@ -6418,7 +6418,7 @@
+ (match_operand:SI 1 "general_operand" "g"))]
+ ;; Operand 1 not really used on the m68000.
+
+- "! flag_pic"
++ "(! flag_pic || flag_pic >= 3)"
+ {
+ #if MOTOROLA && !defined (USE_GAS)
+ return "jsr %0";
+@@ -6433,7 +6433,7 @@
+ (match_operand:SI 1 "general_operand" "g"))]
+ ;; Operand 1 not really used on the m68000.
+
+- "flag_pic"
++ "(flag_pic && flag_pic < 3)"
+ {
+ m68k_output_pic_call(operands[0]);
+ return "";
+@@ -6460,7 +6460,7 @@
+ (call (match_operand:QI 1 "memory_operand" "o")
+ (match_operand:SI 2 "general_operand" "g")))]
+ ;; Operand 2 not really used on the m68000.
+- "! flag_pic"
++ "(! flag_pic || flag_pic >= 3)"
+ {
+ #if MOTOROLA && !defined (USE_GAS)
+ return "jsr %1";
+@@ -6475,7 +6475,7 @@
+ (call (match_operand:QI 1 "memory_operand" "o")
+ (match_operand:SI 2 "general_operand" "g")))]
+ ;; Operand 2 not really used on the m68000.
+- "flag_pic"
++ "(flag_pic && flag_pic < 3)"
+ {
+ m68k_output_pic_call(operands[1]);
+ return "";
+@@ -7170,7 +7170,7 @@
+ target = operand_subword (operands[0], 0, 1, XFmode);
+ result = expand_binop (SImode, xor_optab,
+ operand_subword_force (operands[1], 0, XFmode),
+- GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
++ GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
+ if (result == 0)
+ abort ();
+
+@@ -7334,3 +7334,16 @@
+ default: abort();
+ }
+ })
++
++; This is only needed for some subtargets.
++(define_expand "allocate_stack"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (minus:SI (reg:SI 15) (match_operand:SI 1 "general_operand" "")))
++ (set (reg:SI 15) (minus:SI (reg:SI 15) (match_dup 1)))]
++ "TARGET_ALTERNATE_ALLOCATE_STACK"
++ "
++{
++#ifdef ALTERNATE_ALLOCATE_STACK
++ ALTERNATE_ALLOCATE_STACK(operands);
++#endif
++}")
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.ac.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.ac.p
new file mode 100644
index 0000000..728be6d
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.ac.p
@@ -0,0 +1,35 @@
+--- gcc-3.4.6/gcc/configure.ac 2013-05-19 20:09:27.000000000 +0200
++++ gcc/configure.ac 2013-05-19 20:23:32.000000000 +0200
+@@ -101,10 +101,11 @@
+ # Directories
+ # -----------
+
++### begin-GG-local: local prefix
+ # Specify the local prefix
+ local_prefix=
+ AC_ARG_WITH(local-prefix,
+-[ --with-local-prefix=DIR specifies directory to put local include],
++[ --with-local-prefix=DIR specifies directory to put local include directory (not files).],
+ [case "${withval}" in
+ yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
+ no) ;;
+@@ -113,8 +114,9 @@
+
+ # Default local prefix if it is empty
+ if test x$local_prefix = x; then
+- local_prefix=/usr/local
++ local_prefix='${prefix}'/local
+ fi
++### end-GG-local
+
+ # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
+ # passed in by the toplevel make and thus we'd get different behavior
+@@ -962,6 +964,8 @@
+
+ gcc_AC_INITFINI_ARRAY
+
++AC_FUNC_ALLOCA
++
+ # mkdir takes a single argument on some systems.
+ gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
+
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.p
new file mode 100644
index 0000000..d8ba1cf
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.configure.p
@@ -0,0 +1,61 @@
+--- gcc-3.4.6/gcc/configure 2013-05-19 20:09:27.000000000 +0200
++++ gcc/configure 2013-05-19 20:23:32.000000000 +0200
+@@ -1583,6 +1583,7 @@
+ # Directories
+ # -----------
+
++### begin-GG-local: local prefix
+ # Specify the local prefix
+ local_prefix=
+
+@@ -1600,8 +1601,9 @@
+
+ # Default local prefix if it is empty
+ if test x$local_prefix = x; then
+- local_prefix=/usr/local
++ local_prefix='${prefix}'/local
+ fi
++### end-GG-local
+
+ # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
+ # passed in by the toplevel make and thus we'd get different behavior
+@@ -7258,7 +7260,7 @@
+ # read() to the same fd. The only system known to have a problem here
+ # is VMS, where text files have record structure.
+ case "$host_os" in
+- vms* | ultrix*)
++ vms* | ultrix* | amigaos*)
+ gcc_cv_func_mmap_file=no ;;
+ *)
+ gcc_cv_func_mmap_file=yes;;
+@@ -7282,7 +7284,7 @@
+ # Systems known to be in this category are Windows (all variants),
+ # VMS, and Darwin.
+ case "$host_os" in
+- vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
++ vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00 | amigaos*)
+ gcc_cv_func_mmap_dev_zero=no ;;
+ *)
+ gcc_cv_func_mmap_dev_zero=yes;;
+@@ -7367,7 +7369,7 @@
+ # above for use of /dev/zero.
+ # Systems known to be in this category are Windows, VMS, and SCO Unix.
+ case "$host_os" in
+- vms* | cygwin* | pe | mingw* | sco* | udk* )
++ vms* | cygwin* | pe | mingw* | sco* | udk* | amigaos*)
+ gcc_cv_func_mmap_anon=no ;;
+ *)
+ gcc_cv_func_mmap_anon=yes;;
+@@ -7762,6 +7764,12 @@
+
+ sparc_address_test (0);
+
++#ifdef __amigaos__
++ /* Force this test to succeed for AmigaOS, which has a fairly good
++ vfork() emulation, but doesn't support fork() at all. -fnf */
++ exit (0);
++#endif
++
+ child = vfork ();
+
+ if (child == 0) {
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.cppfiles.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.cppfiles.c.p
new file mode 100644
index 0000000..6457748
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.cppfiles.c.p
@@ -0,0 +1,48 @@
+--- gcc-3.4.6/gcc/cppfiles.c 2013-05-19 20:22:04.000000000 +0200
++++ gcc/cppfiles.c 2013-05-19 20:23:32.000000000 +0200
+@@ -50,6 +50,10 @@
+ #ifndef O_BINARY
+ # define O_BINARY 0
+ #endif
++#ifndef OPEN_CASE_SENSITIVE
++/* Default is standard open(). */
++# define OPEN_CASE_SENSITIVE open
++#endif
+
+ /* This structure represents a file searched for by CPP, whether it
+ exists or not. An instance may be pointed to by more than one
+@@ -210,7 +214,7 @@
+ set_stdin_to_binary_mode ();
+ }
+ else
+- file->fd = open (file->path, O_RDONLY | O_NOCTTY | O_BINARY, 0666);
++ file->fd = OPEN_CASE_SENSITIVE (file->path, O_RDONLY | O_NOCTTY | O_BINARY, 0666);
+
+ if (file->fd != -1)
+ {
+@@ -1109,7 +1113,11 @@
+ flen = strlen (fname);
+ path = xmalloc (dlen + 1 + flen + 1);
+ memcpy (path, dir->name, dlen);
+- if (dlen && path[dlen - 1] != '/')
++ if (dlen
++#ifdef VOL_SEPARATOR
++ && path[dlen - 1] != VOL_SEPARATOR
++#endif
++ && path[dlen - 1] != '/')
+ path[dlen++] = '/';
+ memcpy (&path[dlen], fname, flen + 1);
+
+@@ -1157,7 +1165,11 @@
+ len = dir->len;
+ name = alloca (len + sizeof (FILE_NAME_MAP_FILE) + 1);
+ memcpy (name, dir->name, len);
+- if (len && name[len - 1] != '/')
++ if (len
++#ifdef VOL_SEPARATOR
++ && name[len - 1] != VOL_SEPARATOR
++#endif
++ && name[len - 1] != '/')
+ name[len++] = '/';
+ strcpy (name + len, FILE_NAME_MAP_FILE);
+ f = fopen (name, "r");
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.defaults.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.defaults.h.p
new file mode 100644
index 0000000..016e899
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.defaults.h.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/gcc/defaults.h 2013-05-19 20:08:05.000000000 +0200
++++ gcc/defaults.h 2013-05-19 20:23:32.000000000 +0200
+@@ -280,8 +280,10 @@
+ /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
+ the rest of the DWARF 2 frame unwind support is also provided. */
+ #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
++#if !defined (NO_DWARF2_UNWIND_INFO)
+ #define DWARF2_UNWIND_INFO 1
+ #endif
++#endif
+
+ /* If we have named sections, and we're using crtstuff to run ctors,
+ use them for registering eh frame information. */
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.fixinc.mkfixinc.sh.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.fixinc.mkfixinc.sh.p
new file mode 100644
index 0000000..9024640
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.fixinc.mkfixinc.sh.p
@@ -0,0 +1,10 @@
+--- gcc-3.4.6/gcc/fixinc/mkfixinc.sh 2003-10-24 19:47:51.000000000 +0200
++++ gcc/fixinc/mkfixinc.sh 2013-05-19 20:23:32.000000000 +0200
+@@ -47,6 +47,7 @@
+ i?86-*-mingw32* | \
+ i?86-*-uwin* | \
+ i?86-*-interix* | \
++ m68k-*-amigaos* | \
+ powerpc-*-eabiaix* | \
+ powerpc-*-eabisim* | \
+ powerpc-*-eabi* | \
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.flow.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.flow.c.p
new file mode 100644
index 0000000..2934804
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.flow.c.p
@@ -0,0 +1,19 @@
+--- gcc-3.4.6/gcc/flow.c 2013-05-19 20:09:27.000000000 +0200
++++ gcc/flow.c 2013-05-19 20:23:32.000000000 +0200
+@@ -2335,11 +2335,13 @@
+ if (n_basic_blocks == 0
+ || (regno < FIRST_PSEUDO_REGISTER
+ && (global_regs[regno]
+- || fixed_regs[regno]
+- || FUNCTION_ARG_REGNO_P (regno))))
++/* begin-GG-local: explicit register specification for parameters */
++ || fixed_regs[regno])))
+ return 0;
+
+- return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->global_live_at_end, regno);
++ return (REGNO_REG_SET_P (ENTRY_BLOCK_PTR->global_live_at_end, regno)
++ && (regno >= FIRST_PSEUDO_REGISTER || ! function_arg_regno_p (regno)));
++/* end-GG-local */
+ }
+
+ /* 1 if register REGNO was alive at a place where `setjmp' was called
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.c.p
new file mode 100644
index 0000000..299ea70
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.c.p
@@ -0,0 +1,31 @@
+--- gcc-3.4.6/gcc/function.c 2013-05-19 20:08:05.000000000 +0200
++++ gcc/function.c 2013-05-19 20:23:32.000000000 +0200
+@@ -8153,3 +8153,28 @@
+ }
+
+ #include "gt-function.h"
++
++/* begin-GG-local: explicit register specification for parameters */
++/* Return 1 if an argument for the current function was passed in
++ register REGNO. */
++
++int
++function_arg_regno_p (int regno)
++{
++ tree parm = DECL_ARGUMENTS (current_function_decl);
++ for (; parm; parm = TREE_CHAIN (parm))
++ {
++ rtx incoming = DECL_INCOMING_RTL (parm);
++ if (GET_CODE (incoming) == REG)
++ {
++ int incoming_reg;
++ incoming_reg = REGNO (incoming);
++ if (regno >= incoming_reg &&
++ regno < incoming_reg + HARD_REGNO_NREGS (incoming_reg,
++ GET_MODE (incoming)))
++ return 1;
++ }
++ }
++ return 0;
++}
++/* end-GG-local */
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.h.p
new file mode 100644
index 0000000..7752b0e
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.function.h.p
@@ -0,0 +1,11 @@
+--- gcc-3.4.6/gcc/function.h 2013-05-19 19:56:54.000000000 +0200
++++ gcc/function.h 2013-05-19 20:23:32.000000000 +0200
+@@ -643,4 +643,8 @@
+
+ extern void do_warn_unused_parameter (tree);
+
++/* begin-GG-local: explicit register specification for parameters */
++extern int function_arg_regno_p (int);
++/* end-GG-local */
++
+ #endif /* GCC_FUNCTION_H */
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.gcc.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.gcc.c.p
new file mode 100644
index 0000000..4399b19
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.gcc.c.p
@@ -0,0 +1,63 @@
+--- gcc-3.4.6/gcc/gcc.c 2013-05-19 20:22:04.000000000 +0200
++++ gcc/gcc.c 2013-05-19 20:23:32.000000000 +0200
+@@ -1403,16 +1403,29 @@
+ #define MD_STARTFILE_PREFIX_1 ""
+ #endif
+
++#ifndef STANDARD_EXEC_PREFIX_1
++#define STANDARD_EXEC_PREFIX_1 "/usr/libexec/gcc/"
++#endif
++#ifndef STANDARD_EXEC_PREFIX_2
++#define STANDARD_EXEC_PREFIX_2 "/usr/lib/gcc/"
++#endif
++#ifndef STANDARD_STARTFILE_PREFIX_1
++#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
++#endif
++#ifndef STANDARD_STARTFILE_PREFIX_2
++#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
++#endif
++
+ static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
+-static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
+-static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
++static const char *const standard_exec_prefix_1 = STANDARD_EXEC_PREFIX_1;
++static const char *const standard_exec_prefix_2 = STANDARD_EXEC_PREFIX_2;
+ static const char *md_exec_prefix = MD_EXEC_PREFIX;
+
+ static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+ static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
+ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+-static const char *const standard_startfile_prefix_1 = "/lib/";
+-static const char *const standard_startfile_prefix_2 = "/usr/lib/";
++static const char *const standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1;
++static const char *const standard_startfile_prefix_2 = STANDARD_STARTFILE_PREFIX_2;
+
+ static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
+ static const char *tooldir_prefix;
+@@ -4483,7 +4496,9 @@
+ and it is better not to use them for searching
+ at run time. In particular, stage1 loses. */
+ if (!IS_ABSOLUTE_PATH (pl->prefix))
++#ifndef VOL_SEPARATOR
+ continue;
++#endif /* VOL_SEPARATOR */
+ #endif
+ /* Try subdirectory if there is one. */
+ if (multilib_dir != NULL
+@@ -5853,12 +5868,11 @@
+ /* Exclude directories that the linker is known to search. */
+ if (linker
+ && ((cp - path == 6
+- && strcmp (path, concat (dir_separator_str, "lib",
+- dir_separator_str, ".", NULL)) == 0)
++ && strcmp (path, concat (STANDARD_STARTFILE_PREFIX_1,
++ ".", NULL)) == 0)
+ || (cp - path == 10
+- && strcmp (path, concat (dir_separator_str, "usr",
+- dir_separator_str, "lib",
+- dir_separator_str, ".", NULL)) == 0)))
++ && strcmp (path, concat (STANDARD_STARTFILE_PREFIX_2,
++ ".", NULL)) == 0)))
+ return 0;
+
+ return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.ginclude.stdarg.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.ginclude.stdarg.h.p
new file mode 100644
index 0000000..934c0c9
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.ginclude.stdarg.h.p
@@ -0,0 +1,20 @@
+--- gcc-3.4.6/gcc/ginclude/stdarg.h 2003-03-13 03:58:40.000000000 +0100
++++ gcc/ginclude/stdarg.h 2013-05-19 20:23:32.000000000 +0200
+@@ -93,7 +93,7 @@
+ But on BSD NET2 we must not test or define or undef it.
+ (Note that the comments in NET 2's ansi.h
+ are incorrect for _VA_LIST_--see stdio.h!) */
+-#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
++#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) || defined(__amigaos__)
+ /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
+ #ifndef _VA_LIST_DEFINED
+ /* The macro _VA_LIST is used in SCO Unix 3.2. */
+@@ -107,7 +107,7 @@
+ #endif /* not _VA_LIST_T_H */
+ #endif /* not _VA_LIST */
+ #endif /* not _VA_LIST_DEFINED */
+-#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
++#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(__amigaos__))
+ #define _VA_LIST_
+ #endif
+ #ifndef _VA_LIST
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.loop.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.loop.c.p
new file mode 100644
index 0000000..6040ce4
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.loop.c.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/gcc/loop.c 2013-05-19 20:09:27.000000000 +0200
++++ gcc/loop.c 2013-05-19 20:23:32.000000000 +0200
+@@ -934,6 +934,10 @@
+ == INSN_UID (regs->array[regno].single_usage))
+ && regs->array[regno].set_in_loop == 1
+ && GET_CODE (SET_SRC (set)) != ASM_OPERANDS
++ && (regno >= FIRST_PSEUDO_REGISTER
++ || asm_noperands (PATTERN (regs->array[regno]
++ .single_usage))
++ < 0)
+ && ! side_effects_p (SET_SRC (set))
+ && ! find_reg_note (p, REG_RETVAL, NULL_RTX)
+ && (! SMALL_REGISTER_CLASSES
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.mklibgcc.in.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.mklibgcc.in.p
new file mode 100644
index 0000000..a169484
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.mklibgcc.in.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/gcc/mklibgcc.in 2013-05-19 20:09:27.000000000 +0200
++++ gcc/mklibgcc.in 2013-05-19 20:23:32.000000000 +0200
+@@ -42,6 +42,10 @@
+ # SHLIB_INSTALL
+ # MULTILIB_OSDIRNAMES
+
++if [ "$LIBGCC_MULTI" != '' ]; then
++ MULTILIBS=$LIBGCC_MULTI
++fi
++
+ # Make needs VPATH to be literal.
+ echo 'srcdir = @srcdir@'
+ echo 'VPATH = @srcdir@'
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.opts.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.opts.c.p
new file mode 100644
index 0000000..1eb8198
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.opts.c.p
@@ -0,0 +1,26 @@
+--- gcc-3.4.6/gcc/opts.c 2004-02-18 01:09:04.000000000 +0100
++++ gcc/opts.c 2013-05-19 20:23:32.000000000 +0200
+@@ -619,7 +619,7 @@
+
+ if (flag_pie)
+ flag_pic = flag_pie;
+- if (flag_pic && !flag_pie)
++ if (flag_pic && flag_pic < 3 && !flag_pie)
+ flag_shlib = 1;
+
+ if (flag_no_inline == 2)
+@@ -889,6 +889,14 @@
+ flag_bounds_check = value;
+ break;
+
++ case OPT_fbaserel:
++ flag_pic = value + value + value;
++ break;
++
++ case OPT_fbaserel32:
++ flag_pic = value + value + value + value;
++ break;
++
+ case OPT_fbranch_count_reg:
+ flag_branch_on_count_reg = value;
+ break;
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.rtl.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.rtl.h.p
new file mode 100644
index 0000000..779a3e9
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.rtl.h.p
@@ -0,0 +1,11 @@
+--- gcc-3.4.6/gcc/rtl.h 2013-05-19 20:22:04.000000000 +0200
++++ gcc/rtl.h 2013-05-19 20:23:32.000000000 +0200
+@@ -587,7 +587,7 @@
+ JUMP_INSN, INSN_LIST, BARRIER, CODE_LABEL, CONST, \
+ NOTE)->integrated)
+ #define RTX_UNCHANGING_P(RTX) \
+- (RTL_FLAG_CHECK3("RTX_UNCHANGING_P", (RTX), REG, MEM, CONCAT)->unchanging)
++ (RTL_FLAG_CHECK4("RTX_UNCHANGING_P", (RTX), REG, MEM, CONCAT, PLUS)->unchanging)
+ #define RTX_FRAME_RELATED_P(RTX) \
+ (RTL_FLAG_CHECK5("RTX_FRAME_RELATED_P", (RTX), INSN, CALL_INSN, \
+ JUMP_INSN, BARRIER, SET)->frame_related)
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc.toplev.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.toplev.c.p
new file mode 100644
index 0000000..8eecf05
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc.toplev.c.p
@@ -0,0 +1,11 @@
+--- gcc-3.4.6/gcc/toplev.c 2013-05-19 20:09:28.000000000 +0200
++++ gcc/toplev.c 2013-05-19 20:23:32.000000000 +0200
+@@ -1100,6 +1100,8 @@
+ {"branch-count-reg",&flag_branch_on_count_reg, 1 },
+ {"pic", &flag_pic, 1 },
+ {"PIC", &flag_pic, 2 },
++ {"baserel", &flag_pic, 3 },
++ {"baserel32", &flag_pic, 4 },
+ {"pie", &flag_pie, 1 },
+ {"PIE", &flag_pie, 2 },
+ {"exceptions", &flag_exceptions, 1 },
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/include.filenames.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/include.filenames.h.p
new file mode 100644
index 0000000..a9d5548
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/include.filenames.h.p
@@ -0,0 +1,14 @@
+--- gcc-3.4.6/include/filenames.h 2003-07-01 22:29:16.000000000 +0200
++++ include/filenames.h 2013-05-19 20:23:32.000000000 +0200
+@@ -43,7 +43,11 @@
+ #else /* not DOSish */
+
+ #define IS_DIR_SEPARATOR(c) ((c) == '/')
++#if !defined(__amigaos__)
+ #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
++#else
++#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || strchr((f), VOL_SEPARATOR))
++#endif
+ #define FILENAME_CMP(s1, s2) strcmp(s1, s2)
+
+ #endif /* not DOSish */
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libgcc.config.host.p b/m68k-unknown-amigaos/recipes/patches/gcc/libgcc.config.host.p
deleted file mode 100644
index b02e61f..0000000
--- a/m68k-unknown-amigaos/recipes/patches/gcc/libgcc.config.host.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- libgcc/config.host 2010-12-22 16:21:16.000000000 +0000
-+++ libgcc/config.host 2010-12-22 16:21:42.000000000 +0000
-@@ -391,6 +391,8 @@
- ;;
- m68k-*-rtems*)
- ;;
-+m68k-*-amigaos*)
-+ ;;
- mcore-*-elf)
- ;;
- mcore-*-pe*)
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.configure.p b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.configure.p
new file mode 100644
index 0000000..928f83e
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.configure.p
@@ -0,0 +1,105 @@
+--- gcc-3.4.6/libiberty/configure 2003-10-01 19:11:29.000000000 +0200
++++ libiberty/configure 2013-05-19 20:23:32.000000000 +0200
+@@ -347,6 +347,10 @@
+ includedir='${prefix}/include'
+ oldincludedir='/usr/include'
+ infodir='${prefix}/info'
++guidedir='${prefix}/guide'
++htmldir='${prefix}/html'
++psdir='${prefix}/ps'
++dvidir='${prefix}/dvi'
+ mandir='${prefix}/man'
+
+ ac_prev=
+@@ -450,6 +454,26 @@
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
++ -guidedir | --guidedir | --guidedi | --guided | --guide | --gui)
++ ac_prev=guidedir ;;
++ -guidedir=* | --guidedir=* | --guidedi=* | --guided=* | --guide=* |--gui=*)
++ guidedir=$ac_optarg ;;
++
++ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm)
++ ac_prev=htmldir ;;
++ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* |--htm=*)
++ htmldir=$ac_optarg ;;
++
++ -psdir | --psdir | --psdi | --psd | --ps)
++ ac_prev=psdir ;;
++ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
++ psdir=$ac_optarg ;;
++
++ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
++ ac_prev=dvidir ;;
++ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* |--dv=*)
++ dvidir=$ac_optarg ;;
++
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+@@ -825,6 +849,10 @@
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
++ --guidedir=DIR Amigaguide documentation in DIR [PREFIX/guide]
++ --htmldir=DIR HTML documentation in DIR [PREFIX/html]
++ --psdir=DIR postscript documentation in DIR [PREFIX/ps]
++ --dvidir=DIR TeX dvi documentation in DIR [PREFIX/dvi]
+ --mandir=DIR man documentation [PREFIX/man]
+ _ACEOF
+
+@@ -3322,7 +3350,7 @@
+ # Account for people who put trailing slashes in PATH elements.
+ case $as_dir/ in
+ ./ | .// | /cC/* | \
+- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
++ /etc/* | /c/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+@@ -5108,6 +5136,12 @@
+
+ sparc_address_test (0);
+
++#ifdef __amigaos__
++ /* Force this test to succeed for AmigaOS, which has a fairly good
++ vfork() emulation, but doesn't support fork() at all. -fnf */
++ exit (0);
++#endif
++
+ child = vfork ();
+
+ if (child == 0) {
+@@ -5208,6 +5242,11 @@
+ #define HAVE_WORKING_FORK 1
+ _ACEOF
+
++else
++ cat >> confdefs.h <<\EOF
++#define HAVE_VFORK 1
++EOF
++
+ fi
+
+ if test $ac_cv_func_vfork_works = no; then
+@@ -6761,6 +6800,10 @@
+ s,@includedir@,$includedir,;t t
+ s,@oldincludedir@,$oldincludedir,;t t
+ s,@infodir@,$infodir,;t t
++s,@guidedir@,$guidedir,;t t
++s,@htmldir@,$htmldir,;t t
++s,@psdir@,$psdir,;t t
++s,@dvidir@,$dvidir,;t t
+ s,@mandir@,$mandir,;t t
+ s,@build_alias@,$build_alias,;t t
+ s,@host_alias@,$host_alias,;t t
+@@ -7297,7 +7340,7 @@
+ case $ac_dest in
+ default ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+ if test -n "$CONFIG_FILES"; then
+- if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
++ if test -n "${with_target_subdir}"; then
+ # FIXME: We shouldn't need to set ac_file
+ ac_file=Makefile
+ LD="${ORIGINAL_LD_FOR_MULTILIBS}"
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.lbasename.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.lbasename.c.p
new file mode 100644
index 0000000..735ca77
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.lbasename.c.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/libiberty/lbasename.c 2003-12-22 20:21:37.000000000 +0100
++++ libiberty/lbasename.c 2013-05-19 20:23:32.000000000 +0200
+@@ -42,6 +42,10 @@
+ #include "safe-ctype.h"
+ #include "filenames.h"
+
++#ifdef __amigaos__
++#define VOL_SEPARATOR ':'
++#endif
++
+ const char *
+ lbasename (name)
+ const char *name;
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.make-temp-file.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.make-temp-file.c.p
new file mode 100644
index 0000000..fec49da
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.make-temp-file.c.p
@@ -0,0 +1,27 @@
+--- gcc-3.4.6/libiberty/make-temp-file.c 2001-10-17 23:15:41.000000000 +0200
++++ libiberty/make-temp-file.c 2013-05-19 20:23:32.000000000 +0200
+@@ -50,6 +50,10 @@
+ #define DIR_SEPARATOR '/'
+ #endif
+
++#ifdef __amigaos__
++#define VOL_SEPARATOR ':'
++#endif
++
+ /* Name of temporary file.
+ mktemp requires 6 trailing X's. */
+ #define TEMP_FILE "ccXXXXXX"
+@@ -126,8 +130,13 @@
+ len = strlen (base);
+ tmpdir = xmalloc (len + 2);
+ strcpy (tmpdir, base);
++#ifdef VOL_SEPARATOR
++ if (tmpdir[len-1] != DIR_SEPARATOR && tmpdir[len-1] != VOL_SEPARATOR)
++#endif
++{
+ tmpdir[len] = DIR_SEPARATOR;
+ tmpdir[len+1] = '\0';
++}
+
+ memoized_tmpdir = tmpdir;
+ return tmpdir;
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.pex-unix.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.pex-unix.c.p
new file mode 100644
index 0000000..b90f69e
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.pex-unix.c.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/libiberty/pex-unix.c 2003-01-24 21:02:11.000000000 +0100
++++ libiberty/pex-unix.c 2013-05-19 20:23:32.000000000 +0200
+@@ -44,6 +44,10 @@
+ #define waitpid(pid, status, flags) wait(status)
+ #endif
+
++#ifdef __amigaos__
++#define fork() vfork()
++#endif
++
+ extern int execv ();
+ extern int execvp ();
+
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.strsignal.c.p b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.strsignal.c.p
new file mode 100644
index 0000000..db4ce9e
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libiberty.strsignal.c.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/libiberty/strsignal.c 2003-04-15 22:36:33.000000000 +0200
++++ libiberty/strsignal.c 2013-05-19 20:23:32.000000000 +0200
+@@ -558,8 +558,8 @@
+
+ void
+ psignal (signo, message)
+- unsigned signo;
+- char *message;
++ unsigned int signo;
++ const char *message;
+ {
+ if (signal_names == NULL)
+ {
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.config.cpu.m68k.atomicity.h.p b/m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.config.cpu.m68k.atomicity.h.p
new file mode 100644
index 0000000..192d911
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.config.cpu.m68k.atomicity.h.p
@@ -0,0 +1,25 @@
+--- gcc-3.4.6/libstdc++-v3/config/cpu/m68k/atomicity.h 2004-03-18 18:36:28.000000000 +0100
++++ libstdc++-v3/config/cpu/m68k/atomicity.h 2013-05-19 20:23:32.000000000 +0200
+@@ -31,7 +31,21 @@
+
+ namespace __gnu_cxx
+ {
+-#if ( defined(__mc68020__) || defined(__mc68030__) \
++#if defined(__amigaos__)
++
++ _Atomic_word
++ __attribute__ ((__unused__))
++ __exchange_and_add (volatile _Atomic_word *__mem, int __val)
++ {
++ _Atomic_word __result;
++
++ __result = *__mem;
++ *__mem = __result + __val;
++
++ return __result;
++ }
++
++#elif ( defined(__mc68020__) || defined(__mc68030__) \
+ || defined(__mc68040__) || defined(__mc68060__) ) \
+ && !defined(__mcpu32__)
+ // These variants support compare-and-swap.
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.configure.p b/m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.configure.p
new file mode 100644
index 0000000..d0f9e88
--- /dev/null
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/libstdc++-v3.configure.p
@@ -0,0 +1,13 @@
+--- gcc-3.4.6/libstdc++-v3/configure 2013-05-19 20:08:06.000000000 +0200
++++ libstdc++-v3/configure 2013-05-19 20:23:32.000000000 +0200
+@@ -31093,6 +31093,10 @@
+
+ # Base decisions on target environment.
+ case "${host}" in
++ m68k-*-amigaos*)
++ #os_include_dir="os/newlib"
++ ;;
++
+ *-darwin*)
+ # Darwin versions vary, but the linker should work in a cross environment,
+ # so we just check for all the features here.