This fixes gfortran on powerpc for me; simply merge what is in base gcc. Index: Makefile =================================================================== RCS file: /cvs/ports/lang/gfortran/Makefile,v retrieving revision 1.24 diff -u -p -r1.24 Makefile --- Makefile 12 Jan 2014 22:16:02 -0000 1.24 +++ Makefile 18 Jan 2014 13:50:26 -0000 @@ -1,7 +1,6 @@ # $OpenBSD: Makefile,v 1.24 2014/01/12 22:16:02 pascal Exp $ ONLY_FOR_ARCHS = ${GCC4_ARCHS} -BROKEN-powerpc = Segmentation fault during build SYSV = 4.2.1 BROKEN-hppa = port not contributed Index: patches/patch-gcc_config_rs6000_openbsd_h =================================================================== RCS file: /cvs/ports/lang/gfortran/patches/patch-gcc_config_rs6000_openbsd_h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-gcc_config_rs6000_openbsd_h --- patches/patch-gcc_config_rs6000_openbsd_h 10 Oct 2010 17:39:07 -0000 1.1.1.1 +++ patches/patch-gcc_config_rs6000_openbsd_h 18 Jan 2014 13:50:26 -0000 @@ -1,6 +1,6 @@ $OpenBSD: patch-gcc_config_rs6000_openbsd_h,v 1.1.1.1 2010/10/10 17:39:07 steven Exp $ ---- gcc/config/rs6000/openbsd.h.orig Sat Jun 9 17:11:08 2007 -+++ gcc/config/rs6000/openbsd.h Sat Jun 9 18:24:52 2007 +--- gcc/config/rs6000/openbsd.h.orig Sat Jan 18 12:17:59 2014 ++++ gcc/config/rs6000/openbsd.h Sat Jan 18 13:54:26 2014 @@ -0,0 +1,132 @@ +/* Configuration file for an rs6000 OpenBSD target. + Copyright (C) 1999 Free Software Foundation, Inc. @@ -62,9 +62,6 @@ $OpenBSD: patch-gcc_config_rs6000_openbs +#undef CPP_OS_DEFAULT_SPEC +#define CPP_OS_DEFAULT_SPEC "%(cpp_os_openbsd)" + -+#undef LINKER_NAME -+#define LINKER_NAME "ld" -+ +#undef LINK_SPEC +#define LINK_SPEC "%{shared:-shared} \ + %{!shared: \ @@ -78,6 +75,9 @@ $OpenBSD: patch-gcc_config_rs6000_openbs + +#undef STARTFILE_DEFAULT_SPEC +#define STARTFILE_DEFAULT_SPEC "%(startfile_openbsd)" ++ ++#undef CRTSAVRES_DEFAULT_SPEC ++#define CRTSAVRES_DEFAULT_SPEC "" + +#undef ENDFILE_DEFAULT_SPEC +#define ENDFILE_DEFAULT_SPEC "%(endfile_openbsd)" Index: patches/patch-gcc_config_rs6000_rs6000_c =================================================================== RCS file: patches/patch-gcc_config_rs6000_rs6000_c diff -N patches/patch-gcc_config_rs6000_rs6000_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-gcc_config_rs6000_rs6000_c 18 Jan 2014 13:50:26 -0000 @@ -0,0 +1,35 @@ +$OpenBSD$ +--- gcc/config/rs6000/rs6000.c.orig Sat Jan 18 13:56:24 2014 ++++ gcc/config/rs6000/rs6000.c Sat Jan 18 13:56:36 2014 +@@ -13475,17 +13475,22 @@ rs6000_return_addr (int count, rtx frame) + don't try to be too clever here. */ + if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic)) + { ++ rtx x; + cfun->machine->ra_needs_full_frame = 1; + +- return +- gen_rtx_MEM +- (Pmode, +- memory_address +- (Pmode, +- plus_constant (copy_to_reg +- (gen_rtx_MEM (Pmode, +- memory_address (Pmode, frame))), +- RETURN_ADDRESS_OFFSET))); ++ if (count == 0) ++ { ++ gcc_assert (frame == frame_pointer_rtx); ++ x = arg_pointer_rtx; ++ } ++ else ++ { ++ x = memory_address (Pmode, frame); ++ x = copy_to_reg (gen_rtx_MEM (Pmode, x)); ++ } ++ ++ x = plus_constant (x, RETURN_ADDRESS_OFFSET); ++ return gen_rtx_MEM (Pmode, memory_address (Pmode, x)); + } + + cfun->machine->ra_need_lr = 1; Index: patches/patch-gcc_config_rs6000_sysv4_h =================================================================== RCS file: patches/patch-gcc_config_rs6000_sysv4_h diff -N patches/patch-gcc_config_rs6000_sysv4_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-gcc_config_rs6000_sysv4_h 18 Jan 2014 13:50:26 -0000 @@ -0,0 +1,47 @@ +$OpenBSD$ +--- gcc/config/rs6000/sysv4.h.orig Sat Jan 18 13:57:20 2014 ++++ gcc/config/rs6000/sysv4.h Sat Jan 18 13:57:35 2014 +@@ -423,6 +423,7 @@ extern int rs6000_pic_labelno; + asm_fprintf (FILE, "%L%s", PREFIX) + + /* Globalizing directive for a label. */ ++#undef GLOBAL_ASM_OP + #define GLOBAL_ASM_OP "\t.globl " + + /* This says how to output assembler code to declare an +@@ -787,7 +788,7 @@ extern int fixuplabelno; + mcall-linux : crtsavres.o%s %(endfile_linux) ; \ + mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \ + mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \ +- mcall-openbsd: crtsavres.o%s %(endfile_openbsd) ; \ ++ mcall-openbsd: %(endfile_openbsd) ; \ + : %(crtsavres_default) %(endfile_default) }" + + #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s" +@@ -967,7 +968,7 @@ ncrtn.o%s" + + /* OpenBSD support. */ + #ifndef LIB_OPENBSD_SPEC +-#define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" ++#define LIB_OPENBSD_SPEC OBSD_LIB_SPEC + #endif + + #ifndef STARTFILE_OPENBSD_SPEC +@@ -990,7 +991,7 @@ ncrtn.o%s" + #endif + + #ifndef CPP_OS_OPENBSD_SPEC +-#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" ++#define CPP_OS_OPENBSD_SPEC OBSD_CPP_SPEC + #endif + + /* WindISS support. */ +@@ -1126,7 +1127,7 @@ ncrtn.o%s" + be stacked, so that invocations of #pragma pack(pop)' will return + to the previous value. */ + +-#define HANDLE_PRAGMA_PACK_PUSH_POP 1 ++#define HANDLE_PRAGMA_PACK_PUSH_POP + + /* Select a format to encode pointers in exception handling data. CODE + is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is Index: patches/patch-gcc_config_rs6000_t-openbsd =================================================================== RCS file: /cvs/ports/lang/gfortran/patches/patch-gcc_config_rs6000_t-openbsd,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-gcc_config_rs6000_t-openbsd --- patches/patch-gcc_config_rs6000_t-openbsd 10 Oct 2010 17:39:07 -0000 1.1.1.1 +++ patches/patch-gcc_config_rs6000_t-openbsd 18 Jan 2014 13:50:26 -0000 @@ -1,13 +1,13 @@ $OpenBSD: patch-gcc_config_rs6000_t-openbsd,v 1.1.1.1 2010/10/10 17:39:07 steven Exp $ ---- gcc/config/rs6000/t-openbsd.orig Tue Jun 12 12:23:22 2007 -+++ gcc/config/rs6000/t-openbsd Tue Jun 12 12:18:16 2007 -@@ -0,0 +1,55 @@ +--- gcc/config/rs6000/t-openbsd.orig Sat Jan 18 12:17:59 2014 ++++ gcc/config/rs6000/t-openbsd Sat Jan 18 14:33:51 2014 +@@ -0,0 +1,59 @@ +# include t-rs6000 too +# this is taken from t-ppccomm +# but crt* removed. + + -+LIB2FUNCS_EXTRA = tramp.S ++LIB2FUNCS_EXTRA = tramp.S darwin-ldouble.c + +# This one can't end up in shared libgcc +LIB2FUNCS_STATIC_EXTRA = eabi.S @@ -31,6 +31,10 @@ $OpenBSD: patch-gcc_config_rs6000_t-open +tramp.S: $(srcdir)/config/rs6000/tramp.asm + cat $(srcdir)/config/rs6000/tramp.asm > tramp.S + ++darwin-ldouble.c: $(srcdir)/config/rs6000/darwin-ldouble.c ++ cat $(srcdir)/config/rs6000/darwin-ldouble.c > darwin-ldouble.c ++ ++# Switch synonyms +# Switch synonyms +MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?401 \ + msoft-float=mcpu?403 \