Handle -rdynamic on OpenBSD

2011-10-22 Thread Jonathan Gray
The following lets -rdynamic work on OpenBSD.
Added to every OpenBSD target that defines LIB_SPEC.

Gerald Pfeifer has previously volunteered to apply my patches based
on maintainer approval.

2011-10-22  Jonathan Gray  

* config/openbsd.opt (rdynamic): New Driver option.
* config/sparc/openbsd64.h (LINK_SPEC): Handle -rdynamic.
* config/i386/openbsdelf.h (LINK_SPEC): Handle -rdynamic.
* config/mips/openbsd.h (LINK_SPEC): Handle -rdynamic.

Index: gcc/config/sparc/openbsd64.h
===
--- gcc/config/sparc/openbsd64.h(revision 180322)
+++ gcc/config/sparc/openbsd64.h(working copy)
@@ -70,6 +70,7 @@
%{shared:-shared} %{R*} \
%{static:-Bstatic} \
%{!static:-Bdynamic} \
+   %{rdynamic:-export-dynamic} \
%{assert*} \
-dynamic-linker /usr/libexec/ld.so"
 
Index: gcc/config/i386/openbsdelf.h
===
--- gcc/config/i386/openbsdelf.h(revision 180322)
+++ gcc/config/i386/openbsdelf.h(working copy)
@@ -128,6 +128,7 @@
%{shared:-shared} %{R*} \
%{static:-Bstatic} \
%{!static:-Bdynamic} \
+   %{rdynamic:-export-dynamic} \
%{assert*} \
-dynamic-linker /usr/libexec/ld.so"
 
Index: gcc/config/openbsd.opt
===
--- gcc/config/openbsd.opt  (revision 180322)
+++ gcc/config/openbsd.opt  (working copy)
@@ -33,4 +33,7 @@
 pthread
 Driver
 
+rdynamic
+Driver
+
 ; This comment is to ensure we retain the blank line above.
Index: gcc/config/mips/openbsd.h
===
--- gcc/config/mips/openbsd.h   (revision 180322)
+++ gcc/config/mips/openbsd.h   (working copy)
@@ -81,7 +81,10 @@
%{!shared: -non_shared} \
-dynamic-linker /usr/libexec/ld.so \
%{!nostdlib:%{!r:%{!e*:-e __start}}} -dc -dp \
-   %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
+   %{static:-Bstatic} \
+   %{!static:-Bdynamic} \
+   %{rdynamic:-export-dynamic} \
+   %{assert*}"
 
 /* -G is incompatible with -KPIC which is the default, so only allow objects
in the small data section if the user explicitly asks for it.  */


don't "fix" ((void *)0) to 0 (PR 48851)

2011-10-22 Thread Jonathan Gray
fixincludes was changing the definition of
NULL on OpenBSD from 

#ifndef NULL
#ifdef  __GNUG__
#define NULL__null
#else
#define NULL((void *)0)
#endif
#endif

to

#ifndef NULL
#ifdef  __GNUG__
#define NULL__null
#else
#define NULL 0
#endif
#endif

Posting the proposed fix from Mike in PR 48851 here as asked
as he doesn't have the environment to regenerate fixincl.x

2011-10-23  Mike Stump  

* inclhack.def (void_null): New bypass.
* fixincl.x: Regenerate.

Index: inclhack.def
===
--- inclhack.def(revision 180322)
+++ inclhack.def(working copy)
@@ -4585,6 +4585,7 @@
 files = sys/types.h;
 /* avoid changing C++ friendly NULL */
 bypass= __cplusplus;
+bypass= __null;
 select= "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
 c_fix = format;
 c_fix_arg = "#define NULL 0";
Index: fixincl.x
===
--- fixincl.x   (revision 180322)
+++ fixincl.x   (working copy)
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  September 22, 2011 at 04:28:52 PM by AutoGen 5.11.1
+ * It has been AutoGen-ed  Sunday October 23, 2011 at 12:18:29 PM EST
  * From the definitionsinclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 22 16:28:52 CEST 2011
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Oct 23 12:18:29 EST 2011
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -8587,10 +8587,13 @@
  */
 tSCC zVoid_NullBypass0[] =
"__cplusplus";
+tSCC zVoid_NullBypass1[] =
+   "__null";
 
-#defineVOID_NULL_TEST_CT  2
+#defineVOID_NULL_TEST_CT  3
 static tTestDesc aVoid_NullTests[] = {
   { TT_NEGREP,   zVoid_NullBypass0, (regex_t*)NULL },
+  { TT_NEGREP,   zVoid_NullBypass1, (regex_t*)NULL },
   { TT_EGREP,zVoid_NullSelect0, (regex_t*)NULL }, };
 
 /*
@@ -8953,7 +8956,7 @@
  *
  *  List of all fixes
  */
-#define REGEX_COUNT  261
+#define REGEX_COUNT  262
 #define MACH_LIST_SIZE_LIMIT 181
 #define FIX_COUNT220