Re: fix gcc 4.9 -static

2016-07-10 Thread Stefan Kempf
Tobias Ulmer wrote:
> Sync STARTFILE_SPEC, fixes egcc -static producing crashing programs
> 
> I don't expect any fallout from this (builtin spec file change only)

Checking with gcc -v, it seems to work on amd64. gcc 4.9 and our
base gcc behave the same given various -pie/-nopie/-shared/-static/-pg
combinations.
 
> OK?
> 
> ? todo.txt
> Index: Makefile
> ===
> RCS file: /home/vcs/cvs/openbsd/ports/lang/gcc/4.9/Makefile,v
> retrieving revision 1.32
> diff -u -p -r1.32 Makefile
> --- Makefile  29 Jun 2016 16:14:41 -  1.32
> +++ Makefile  9 Jul 2016 21:41:29 -
> @@ -4,8 +4,7 @@ ONLY_FOR_ARCHS = amd64 arm hppa i386 mip
>  DPB_PROPERTIES = parallel
>  
>  V = 4.9.3
> -REVISION = 7
> -REVISION-java = 8
> +REVISION = 9
>  FULL_VERSION = $V
>  FULL_PKGVERSION = $V
>  
> Index: patches/patch-gcc_config_alpha_openbsd_h
> ===
> RCS file: 
> /home/vcs/cvs/openbsd/ports/lang/gcc/4.9/patches/patch-gcc_config_alpha_openbsd_h,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 patch-gcc_config_alpha_openbsd_h
> --- patches/patch-gcc_config_alpha_openbsd_h  26 Jun 2014 16:30:17 -  
> 1.1.1.1
> +++ patches/patch-gcc_config_alpha_openbsd_h  9 Jul 2016 21:41:29 -
> @@ -1,6 +1,6 @@
>  $OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.1.1.1 2014/06/26 16:30:17 
> pascal Exp $
>  gcc/config/alpha/openbsd.h.orig  Thu Jan 10 21:38:27 2013
> -+++ gcc/config/alpha/openbsd.h   Thu Apr 18 20:58:27 2013
> +--- gcc/config/alpha/openbsd.h.orig  Thu Jan  2 23:23:26 2014
>  gcc/config/alpha/openbsd.h   Sat Jul  9 22:13:30 2016
>  @@ -19,6 +19,28 @@ along with GCC; see the file COPYING3.  If not see
>   
>   /* Controlling the compilation driver.  */
> @@ -21,11 +21,11 @@ $OpenBSD: patch-gcc_config_alpha_openbsd
>  +/* As an elf system, we need crtbegin/crtend stuff.  */
>  +#undef STARTFILE_SPEC
>  +#define STARTFILE_SPEC "\
> -+%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
> -+crtbegin%O%s} %{shared:crtbeginS%O%s}"
> ++%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
> ++%{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
> ++%{!nopie:rcrt0%O%s crtbegin%O%s} %{shared:crtbeginS%O%s}"
>  +#undef ENDFILE_SPEC
>  +#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
> -+
>  +
>   /* run-time target specifications */
>   #define TARGET_OS_CPP_BUILTINS()\
> Index: patches/patch-gcc_config_i386_openbsdelf_h
> ===
> RCS file: 
> /home/vcs/cvs/openbsd/ports/lang/gcc/4.9/patches/patch-gcc_config_i386_openbsdelf_h,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 patch-gcc_config_i386_openbsdelf_h
> --- patches/patch-gcc_config_i386_openbsdelf_h26 Jun 2014 16:30:17 
> -  1.1.1.1
> +++ patches/patch-gcc_config_i386_openbsdelf_h9 Jul 2016 21:41:29 
> -
> @@ -1,7 +1,7 @@
>  $OpenBSD: patch-gcc_config_i386_openbsdelf_h,v 1.1.1.1 2014/06/26 16:30:17 
> pascal Exp $
>  gcc/config/i386/openbsdelf.h.origSun Sep  2 16:13:21 2012
> -+++ gcc/config/i386/openbsdelf.h Fri Oct 12 11:24:33 2012
> -@@ -97,10 +97,13 @@ along with GCC; see the file COPYING3.  If not see
> +--- gcc/config/i386/openbsdelf.h.origThu Jan  2 23:23:26 2014
>  gcc/config/i386/openbsdelf.h Fri Jul  8 17:18:50 2016
> +@@ -97,14 +97,17 @@ along with GCC; see the file COPYING3.  If not see
>  %{shared:-shared} %{R*} \
>  %{static:-Bstatic} \
>  %{!static:-Bdynamic} \
> @@ -10,8 +10,15 @@ $OpenBSD: patch-gcc_config_i386_openbsde
>  -dynamic-linker /usr/libexec/ld.so"
>   
>   #undef STARTFILE_SPEC
> -+
> +-#define STARTFILE_SPEC "\
> +-%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
> +-crtbegin%O%s} %{shared:crtbeginS%O%s}"
> + 
>  +#define SUBTARGET32_DEFAULT_CPU "i486"
> - #define STARTFILE_SPEC "\
> - %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
> - crtbegin%O%s} %{shared:crtbeginS%O%s}"
> ++#define STARTFILE_SPEC "\
> ++%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
> ++%{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
> ++%{!nopie:rcrt0%O%s crtbegin%O%s} %{shared:crtbeginS%O%s}"
> + #undef ENDFILE_SPEC
> + #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
> + 
> Index: patches/patch-gcc_config_mips_openbsd_h
> ===
> RCS file: 
> /home/vcs/cvs/openbsd/ports/lang/gcc/4.9/patches/patch-gcc_config_mips_openbsd_h,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 patch-gcc_config_mips_openbsd_h
> --- patches/patch-gcc_config_mips_openbsd_h   26 Jun 2014 16:30:18 -  
> 1.1.1.1
> +++ patches/patch-gcc_config_mips_openbsd_h   9 Jul 2016 21:41:29 -
> @@ -1,7 +1,7 @@
>  $OpenBSD: patch-gcc_config_mips_openbsd_h,v 1.1.1.1 2014/06/26 16:30:18 
> 

fix gcc 4.9 -static

2016-07-09 Thread Tobias Ulmer
Sync STARTFILE_SPEC, fixes egcc -static producing crashing programs

I don't expect any fallout from this (builtin spec file change only)

OK?

? todo.txt
Index: Makefile
===
RCS file: /home/vcs/cvs/openbsd/ports/lang/gcc/4.9/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- Makefile29 Jun 2016 16:14:41 -  1.32
+++ Makefile9 Jul 2016 21:41:29 -
@@ -4,8 +4,7 @@ ONLY_FOR_ARCHS = amd64 arm hppa i386 mip
 DPB_PROPERTIES = parallel
 
 V = 4.9.3
-REVISION = 7
-REVISION-java = 8
+REVISION = 9
 FULL_VERSION = $V
 FULL_PKGVERSION = $V
 
Index: patches/patch-gcc_config_alpha_openbsd_h
===
RCS file: 
/home/vcs/cvs/openbsd/ports/lang/gcc/4.9/patches/patch-gcc_config_alpha_openbsd_h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-gcc_config_alpha_openbsd_h
--- patches/patch-gcc_config_alpha_openbsd_h26 Jun 2014 16:30:17 -  
1.1.1.1
+++ patches/patch-gcc_config_alpha_openbsd_h9 Jul 2016 21:41:29 -
@@ -1,6 +1,6 @@
 $OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.1.1.1 2014/06/26 16:30:17 
pascal Exp $
 gcc/config/alpha/openbsd.h.origThu Jan 10 21:38:27 2013
-+++ gcc/config/alpha/openbsd.h Thu Apr 18 20:58:27 2013
+--- gcc/config/alpha/openbsd.h.origThu Jan  2 23:23:26 2014
 gcc/config/alpha/openbsd.h Sat Jul  9 22:13:30 2016
 @@ -19,6 +19,28 @@ along with GCC; see the file COPYING3.  If not see
  
  /* Controlling the compilation driver.  */
@@ -21,11 +21,11 @@ $OpenBSD: patch-gcc_config_alpha_openbsd
 +/* As an elf system, we need crtbegin/crtend stuff.  */
 +#undef STARTFILE_SPEC
 +#define STARTFILE_SPEC "\
-+  %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
-+  crtbegin%O%s} %{shared:crtbeginS%O%s}"
++  %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
++  %{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
++  %{!nopie:rcrt0%O%s crtbegin%O%s} %{shared:crtbeginS%O%s}"
 +#undef ENDFILE_SPEC
 +#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
-+
 +
  /* run-time target specifications */
  #define TARGET_OS_CPP_BUILTINS()  \
Index: patches/patch-gcc_config_i386_openbsdelf_h
===
RCS file: 
/home/vcs/cvs/openbsd/ports/lang/gcc/4.9/patches/patch-gcc_config_i386_openbsdelf_h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-gcc_config_i386_openbsdelf_h
--- patches/patch-gcc_config_i386_openbsdelf_h  26 Jun 2014 16:30:17 -  
1.1.1.1
+++ patches/patch-gcc_config_i386_openbsdelf_h  9 Jul 2016 21:41:29 -
@@ -1,7 +1,7 @@
 $OpenBSD: patch-gcc_config_i386_openbsdelf_h,v 1.1.1.1 2014/06/26 16:30:17 
pascal Exp $
 gcc/config/i386/openbsdelf.h.orig  Sun Sep  2 16:13:21 2012
-+++ gcc/config/i386/openbsdelf.h   Fri Oct 12 11:24:33 2012
-@@ -97,10 +97,13 @@ along with GCC; see the file COPYING3.  If not see
+--- gcc/config/i386/openbsdelf.h.orig  Thu Jan  2 23:23:26 2014
 gcc/config/i386/openbsdelf.h   Fri Jul  8 17:18:50 2016
+@@ -97,14 +97,17 @@ along with GCC; see the file COPYING3.  If not see
 %{shared:-shared} %{R*} \
 %{static:-Bstatic} \
 %{!static:-Bdynamic} \
@@ -10,8 +10,15 @@ $OpenBSD: patch-gcc_config_i386_openbsde
 -dynamic-linker /usr/libexec/ld.so"
  
  #undef STARTFILE_SPEC
-+
+-#define STARTFILE_SPEC "\
+-  %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+-  crtbegin%O%s} %{shared:crtbeginS%O%s}"
+ 
 +#define SUBTARGET32_DEFAULT_CPU "i486"
- #define STARTFILE_SPEC "\
-   %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
-   crtbegin%O%s} %{shared:crtbeginS%O%s}"
++#define STARTFILE_SPEC "\
++  %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
++  %{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
++  %{!nopie:rcrt0%O%s crtbegin%O%s} %{shared:crtbeginS%O%s}"
+ #undef ENDFILE_SPEC
+ #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+ 
Index: patches/patch-gcc_config_mips_openbsd_h
===
RCS file: 
/home/vcs/cvs/openbsd/ports/lang/gcc/4.9/patches/patch-gcc_config_mips_openbsd_h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-gcc_config_mips_openbsd_h
--- patches/patch-gcc_config_mips_openbsd_h 26 Jun 2014 16:30:18 -  
1.1.1.1
+++ patches/patch-gcc_config_mips_openbsd_h 9 Jul 2016 21:41:29 -
@@ -1,7 +1,7 @@
 $OpenBSD: patch-gcc_config_mips_openbsd_h,v 1.1.1.1 2014/06/26 16:30:18 pascal 
Exp $
 gcc/config/mips/openbsd.h.orig Fri May  2 12:54:22 2014
-+++ gcc/config/mips/openbsd.h  Sat May  3 03:53:05 2014
-@@ -0,0 +1,225 @@
+--- gcc/config/mips/openbsd.h.orig Sat Jul  9 22:05:54 2016
 gcc/config/mips/openbsd.h  Sat Jul  9 22:28:39 2016
+@@ -0,0 +1,227 @@
 +/* Configuration file for a mips64 OpenBSD target.
 +   Copyright (C) 1998, 1999, 2000,