Patchwork VxWorks Patches Back from the Dead!

login
register
mail settings
Submitter rbmj
Date Sept. 9, 2012, 3:54 p.m.
Message ID <504CBB9F.5070000@verizon.net>
Download mbox | patch
Permalink /patch/182625/
State New
Headers show

Comments

rbmj - Sept. 9, 2012, 3:54 p.m.
Just because I *love* bothering everyone with emails...

I've made a few changes and squashed everything into a single patch for 
ease of application.  The commit message is inside the patch, but here's 
the suggested ChangeLog:

configure.ac: add --enable-libstdcxx option
configure: regenerate

[gcc]
	gcov-io.c (gcov_open): Pass mode to open() unconditionally

[fixincludes]
	fixinc.in: Added ability to skip machine_name
	inclhack.def (AAB_vxworks_assert): Added fix
	inclhack.def (AAB_vxworks_regs_vxtypes): Added fix
	inclhack.def (AAB_vxworks_stdint): Added fix
	inclhack.def (AAB_vxworks_unistd): Added fix
	inclhack.def (vxworks_ioctl_macro): Added fix
	inclhack.def (vxworks_mkdir_macro): Added fix
	inclhack.def (vxworks_regs): Added fix
	inclhack.def (vxworks_write_const):  Added fix
	fixincl.x:  Regenerate
	mkfixinc.sh: Removed vxworks from list of no-op fixinc targets

[libstdc++-v3]
	config/os/vxworks/os_defines.h: #define'd NOMINMAX

Thanks,

Robert Mason
From 2ce175a3c94e6d544e27a8f936728fbec8f1f004 Mon Sep 17 00:00:00 2001
From: rbmj <rbmj@verizon.net>
Date: Mon, 4 Jun 2012 13:18:10 -0400
Subject: [PATCH] Fix issues with VxWorks Targets

Fix 1: Added assert fixinclude hack for VxWorks.

VxWorks's assert.h relies on adjacent string tokens being joined,
and uses macros for some of the strings (e.g. __FILE__).  However,
it does not put a space after the end quote and before the macro,
so instead of replacing the macro, gcc >= 4.7.x thinks it's a
user-defined literal token, and since the lookup obviously fails,
compilation of libstdc++ dies.

This patch just replaces the assert.h header with another one that
will work.  It preserves the same format, just changes the spacing.

Fix 2: Add hack for ioctl() on VxWorks.

ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.  This way, the most common use case
of ioctl (with a const char * for the third argument) will compile
in C++, where pointers must be explicitly casted to int.

Fix 3: Added vxworks_mkdir_macro fix

This adds a macro to POSIX-ify VxWorks' mkdir() function by
including a macro that wraps the function and takes an (ignored,
but still evaluated) mode argument.

Fix 4:  Add fix to prevent inclusion of regs.h on VxWorks.

VxWorks has it's own regs.h that conflicts with GCC's regs.h, so
just make any replace any references to regs.h in VxWorks with
references to arch/../regs.h, which includes the VxWorks header,
not GCC's header.

Fix 5: Add stdint.h wrapper for VxWorks.

Vxworks stdint.h doesn't have all the typedefs needed for standards
compliance, so add a hack that adds all of the needed typedefs to be
fully compliant to the standard.  Fixes broken libstdc++.

There was additional discussion of adding the necessary macros to get
gcc to have built-in recognition of the types, but I could not get that
to work.  That is also non-essential to this patch, which is primarily
to fix a bug caused by relying on types in stdint.h that vxworks does
not define.

Fix 6: Add unistd.h wrapper for VxWorks.

On VxWorks, unistd.h doesn't define everything it should, like
read/write, etc.  This wrapper adds the things it should define
so everything can be compliant and compile correctly without
manual modification.

Fix 7: Add fix to make write() const correct on VxWorks

VxWorks' write() takes its second argument as non-const, so the
compiler complains if one tries to pass a const pointer to it.
This simply changes the prototype to say it is const so everything
works.  I believe that the prototype is non-const for backwards
compatibility with old verisons of vxworks, but these versions are
not supported by modern GCC, so causing potential bugs on those
platforms is a non-issue.  Modern vxworks will not modify the string
passed to it, so just changing the prototype will work silently.

Fix 8: Make open() call more compatible in gcc/gcov-io.c

In gcc/gcov-io.c, the call to open() only has two arguments. This
is fine, as long as the system open() is standards compliant.
However, on at least one system (vxworks real time processes),
open() is a non-variadic function, so the call fails.  This adds
a third argument passed unconditionally to open for compatibility
with non-variadic open().  On systems with variadic open(), the
extra argument should just be ignored anyway.

There was talk of replacing this change with a fixincludes macro
definition of open(), but this breaks libstdc++-v3.

Fix 9: Added --enable-libstdcxx option.

This patch allows the user to force enable/disable building of
libstdc++-v3 with a --enable-libstdcxx option to be congruent
with the other runtime library options.

The side effect of this, and the main motivation for this patch, is
to allow the user to force compilation of libstdc++-v3 for targets
that do not currently enable building libstdc++-v3 by default.  The
configure-time override is useful when trying to override the stock
runtime library on embedded systems that have their own C++ library.

Please note that although this is a patch that pertains to libstdc++-v3,
it is a patch over top-level configure, NOT libstdc++-v3/configure.

Fix 10: Add ability to skip the machine_name fixincludes fix.

This patch adds the ability to skip the machine_name fixincludes
fix in fixinc.in by wiping the macro list.

It also removes vxworks from the list of no-op fix platforms in
order to allow necessary include fixes to allow a successful
build of the latest GCC.

Fix 11: Added NOMINMAX to vxworks os_defines.h

VxWorks defines min and max as macros, but allows this behavior
to be disabled by defining NOMINMAX.  This adds that definition
to libstdc++-v3's vxworks os_defines.h so that whenever C++
code is being compiled these macros are not defined and the
standard versions of min and max will be used instead.

ChangeLog:

configure.ac: add --enable-libstdcxx option
configure: regenerate

[gcc]
	gcov-io.c (gcov_open): Pass mode to open() unconditionally

[fixincludes]
	fixinc.in: Added ability to skip machine_name
	inclhack.def (AAB_vxworks_assert): Added fix
	inclhack.def (AAB_vxworks_regs_vxtypes): Added fix
	inclhack.def (AAB_vxworks_stdint): Added fix
	inclhack.def (AAB_vxworks_unistd): Added fix
	inclhack.def (vxworks_ioctl_macro): Added fix
	inclhack.def (vxworks_mkdir_macro): Added fix
	inclhack.def (vxworks_regs): Added fix
	inclhack.def (vxworks_write_const):  Added fix
	fixincl.x:  Regenerate
	mkfixinc.sh: Removed vxworks from list of no-op fixinc targets

[libstdc++-v3]
	config/os/vxworks/os_defines.h: #define'd NOMINMAX
---
 configure.ac                                |   38 ++--
 fixincludes/fixinc.in                       |   16 ++
 fixincludes/inclhack.def                    |  266 +++++++++++++++++++++++++++
 fixincludes/mkfixinc.sh                     |    1 -
 gcc/gcov-io.c                               |    3 +-
 libstdc++-v3/config/os/vxworks/os_defines.h |    6 +
 6 files changed, 315 insertions(+), 15 deletions(-)
Bruce Korb - Sept. 10, 2012, 1:35 p.m.
On 09/09/12 08:54, rbmj wrote:
> Just because I *love* bothering everyone with emails...

I don't mind, as long as you don't expect me to do anything
until I'm certain you've stabilized the patch ;)
I'm glad you rolled it up into one patch, because I was
eventually going to ask you to do that.  Thank  you.

Cheers - Bruce

> I've made a few changes and squashed everything into a single patch for ease of application.  The commit message is inside the patch, but here's the suggested ChangeLog:
> 
> configure.ac: add --enable-libstdcxx option
> configure: regenerate
> 
> [gcc]
>     gcov-io.c (gcov_open): Pass mode to open() unconditionally
> 
> [fixincludes]
>     fixinc.in: Added ability to skip machine_name
>     inclhack.def (AAB_vxworks_assert): Added fix
>     inclhack.def (AAB_vxworks_regs_vxtypes): Added fix
>     inclhack.def (AAB_vxworks_stdint): Added fix
>     inclhack.def (AAB_vxworks_unistd): Added fix
>     inclhack.def (vxworks_ioctl_macro): Added fix
>     inclhack.def (vxworks_mkdir_macro): Added fix
>     inclhack.def (vxworks_regs): Added fix
>     inclhack.def (vxworks_write_const):  Added fix
>     fixincl.x:  Regenerate
>     mkfixinc.sh: Removed vxworks from list of no-op fixinc targets
> 
> [libstdc++-v3]
>     config/os/vxworks/os_defines.h: #define'd NOMINMAX
> 
> Thanks,
> 
> Robert Mason
>
rbmj - Sept. 10, 2012, 5:48 p.m.
On 9/10/2012 9:35 AM, Bruce Korb wrote:
> On 09/09/12 08:54, rbmj wrote:
>> Just because I *love* bothering everyone with emails...
>
> I don't mind, as long as you don't expect me to do anything
> until I'm certain you've stabilized the patch ;)
> I'm glad you rolled it up into one patch, because I was
> eventually going to ask you to do that.  Thank  you.
>

I keep thinking everything is stable, but then something changes 
(bitrot? something elsewhere in GCC? I don't know) and I have to 
regroup.  Sorry for changing everything 10 times - please bear with me.

At this point, I've recompiled with different settings about 10 times 
and it hasn't broken itself yet.  I've tried in a different VM and it 
works there too. So *hopefully* it should be good.

On the other hand, I've read this on the website:

> Don't mix together changes made for different reasons. Send them individually.  Ideally, each change you send should be impossible to subdivide into 
parts that we might want to consider separately, because each of its 
parts gets its motivation from the other parts

"impossible to subdivide into parts" seems like one patch per 
fixincludes rule (am I looking at the wrong level of granularity here?). 
  At the same time, it's a pain in the rear to worry about 12 different 
commits (especially when I'm making changes, I git rebase a TON).  I'm 
also not sure about practicality of this approach in terms of the amount 
of work it creates on all ends.

Unless cosmic rays break everything again, that should be all.

Thanks,
Robert Mason
Bruce Korb - Sept. 10, 2012, 7:46 p.m.
Hi,

On Mon, Sep 10, 2012 at 10:48 AM, rbmj <rbmj@verizon.net> wrote:
> On the other hand, I've read this on the website:
>
>> Don't mix together changes made for different reasons. Send them
>> individually.  Ideally, each change you send should be impossible to
>> subdivide into
>
> parts that we might want to consider separately, because each of its parts
> gets its motivation from the other parts

OTOH, this is a fairly cohesive set of patches.
A single project.  Even if, strictly speaking, each include fix
is entirely separate from the others (by the design of fixincludes),
I see them as a cohesive set that ought to be in a single commit.
Fixes to fixes for fixincludes have been very infrequent.

> ... At the same
> time, it's a pain in the rear to worry about 12 different commits

I'm into comforting one's derriere.

> Unless cosmic rays break everything again, that should be all.

:)  OK.  I'll push it on your behalf once the other bits have been
approved by their approvers.

Cheers - Bruce
rbmj - Sept. 21, 2012, 2:02 a.m.
Ping?  Just did a full pull and rebuild today and everything still works :)

Robert Mason

On 9/10/2012 3:46 PM, Bruce Korb wrote:
> Hi,
>
> On Mon, Sep 10, 2012 at 10:48 AM, rbmj <rbmj@verizon.net> wrote:
>> On the other hand, I've read this on the website:
>>
>>> Don't mix together changes made for different reasons. Send them
>>> individually.  Ideally, each change you send should be impossible to
>>> subdivide into
>>
>> parts that we might want to consider separately, because each of its parts
>> gets its motivation from the other parts
>
> OTOH, this is a fairly cohesive set of patches.
> A single project.  Even if, strictly speaking, each include fix
> is entirely separate from the others (by the design of fixincludes),
> I see them as a cohesive set that ought to be in a single commit.
> Fixes to fixes for fixincludes have been very infrequent.
>
>> ... At the same
>> time, it's a pain in the rear to worry about 12 different commits
>
> I'm into comforting one's derriere.
>
>> Unless cosmic rays break everything again, that should be all.
>
> :)  OK.  I'll push it on your behalf once the other bits have been
> approved by their approvers.
>
> Cheers - Bruce
>
Bruce Korb - Sept. 21, 2012, 1:30 p.m.
From my part, I'm willing to push the patch, but I need confirmation
from Paolo and Nathan
because some of it affects code outside of my authority.

On Thu, Sep 20, 2012 at 7:02 PM, rbmj <rbmj@verizon.net> wrote:
> Ping?  Just did a full pull and rebuild today and everything still works :)
>
> Robert Mason
Nathan Sidwell - Sept. 21, 2012, 1:50 p.m.
On 09/21/12 14:30, Bruce Korb wrote:
>  From my part, I'm willing to push the patch, but I need confirmation
> from Paolo and Nathan
> because some of it affects code outside of my authority.
>

I have no objections to the patch.

nathan

Patch

diff --git a/configure.ac b/configure.ac
index a6f5828..7aaa28d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -426,6 +426,15 @@  AC_ARG_ENABLE(libssp,
 ENABLE_LIBSSP=$enableval,
 ENABLE_LIBSSP=yes)
 
+AC_ARG_ENABLE(libstdcxx,
+AS_HELP_STRING([--disable-libstdcxx],
+  [do not build libstdc++-v3 directory]),
+ENABLE_LIBSTDCXX=$enableval,
+ENABLE_LIBSTDCXX=default)
+if test "${ENABLE_LIBSTDCXX}" = "no" ; then
+  noconfigdirs="$noconfigdirs libstdc++-v3"
+fi
+
 # Save it here so that, even in case of --enable-libgcj, if the Java
 # front-end isn't enabled, we still get libgcj disabled.
 libgcj_saved=$libgcj
@@ -552,19 +561,22 @@  case "${target}" in
 esac
 
 # Disable libstdc++-v3 for some systems.
-case "${target}" in
-  *-*-vxworks*)
-    # VxWorks uses the Dinkumware C++ library.
-    noconfigdirs="$noconfigdirs target-libstdc++-v3"
-    ;;
-  arm*-wince-pe*)
-    # the C++ libraries don't build on top of CE's C libraries
-    noconfigdirs="$noconfigdirs target-libstdc++-v3"
-    ;;
-  avr-*-*)
-    noconfigdirs="$noconfigdirs target-libstdc++-v3"
-    ;;
-esac
+# Allow user to override this if they pass --enable-libstdc++-v3
+if test "${ENABLE_LIBSTDCXX}" = "default" ; then
+  case "${target}" in
+    *-*-vxworks*)
+      # VxWorks uses the Dinkumware C++ library.
+      noconfigdirs="$noconfigdirs target-libstdc++-v3"
+      ;;
+    arm*-wince-pe*)
+      # the C++ libraries don't build on top of CE's C libraries
+      noconfigdirs="$noconfigdirs target-libstdc++-v3"
+      ;;
+    avr-*-*)
+      noconfigdirs="$noconfigdirs target-libstdc++-v3"
+      ;;
+  esac
+fi
 
 # Disable Fortran for some systems.
 case "${target}" in
diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index e73aed9..f7b8d8f 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -128,6 +128,22 @@  fi
 
 # # # # # # # # # # # # # # # # # # # # #
 #
+#  Check to see if the machine_name fix needs to be disabled.
+#
+#  On some platforms, machine_name doesn't work properly and
+#  breaks some of the header files.  Since everything works
+#  properly without it, just wipe the macro list to
+#  disable the fix.
+
+case "${target_canonical}" in
+    *-*-vxworks*)
+	test -f ${MACRO_LIST} &&  echo > ${MACRO_LIST}
+        ;;
+esac
+
+
+# # # # # # # # # # # # # # # # # # # # #
+#
 #  In the file macro_list are listed all the predefined
 #  macros that are not in the C89 reserved namespace (the reserved
 #  namespace is all identifiers beginnning with two underscores or one
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 82792af..9f32f4e 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -354,6 +354,206 @@  fix = {
 	_EndOfHeader_;
 };
 
+/*
+ * Fix assert.h on VxWorks:
+ */
+fix = {
+	hackname	= AAB_vxworks_assert;
+	files		= assert.h;
+	mach		= "*-*-vxworks*";
+	
+	replace		= <<- _EndOfHeader_
+	#ifndef _ASSERT_H
+	#define _ASSERT_H
+
+	#ifdef assert
+	#undef assert
+	#endif
+
+	#if defined(__STDC__) || defined(__cplusplus)
+	extern void __assert (const char*);
+	#else
+	extern void __assert ();
+	#endif
+
+	#ifdef NDEBUG
+	#define assert(ign) ((void)0)
+	#else
+
+	#define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
+	#define ASSERT_STRINGIFY_HELPER(str) #str
+
+	#define assert(test) ((void) \
+		((test) ? ((void)0) : \
+		__assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
+		__FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
+
+	#endif
+
+	#endif
+	_EndOfHeader_;
+};
+
+/*
+ * Add needed include to regs.h (NOT the gcc header) on VxWorks
+ */
+
+fix = {
+	hackname	= AAB_vxworks_regs_vxtypes;
+	files		= regs.h;
+	mach		= "*-*-vxworks*";
+
+	replace 	= <<- _EndOfHeader_
+	#ifndef _REGS_H
+	#define _REGS_H
+	#include <types/vxTypesOld.h>
+	#include_next <arch/../regs.h>
+	#endif
+	_EndOfHeader_;
+};
+
+/*
+ * Make VxWorks stdint.h a bit more compliant - add typedefs
+ */
+fix = {
+	hackname	= AAB_vxworks_stdint;
+	files		= stdint.h;
+	mach		= "*-*-vxworks*";
+	
+	replace		= <<- _EndOfHeader_
+	#ifndef _STDINT_H
+	#define _STDINT_H
+	/* get int*_t, uint*_t */
+	#include <types/vxTypes.h>
+	
+	/* get legacy vxworks types for compatibility */
+	#include <types/vxTypesOld.h>
+	
+	typedef long intptr_t;
+	typedef unsigned long uintptr_t;
+	
+	typedef int64_t intmax_t;
+	typedef uint64_t uintmax_t;
+	
+	typedef int8_t int_least8_t;
+	typedef int16_t int_least16_t;
+	typedef int32_t int_least32_t;
+	typedef int64_t int_least64_t;
+	
+	typedef uint8_t uint_least8_t;
+	typedef uint16_t uint_least16_t;
+	typedef uint32_t uint_least32_t;
+	typedef uint64_t uint_least64_t;
+	
+	typedef int8_t int_fast8_t;
+	typedef int int_fast16_t;
+	typedef int32_t int_fast32_t;
+	typedef int64_t int_fast64_t;
+	
+	typedef uint8_t uint_fast8_t;
+	typedef unsigned int uint_fast16_t;
+	typedef uint32_t uint_fast32_t;
+	typedef uint64_t uint_fast64_t;
+	
+	/* Ranges */
+	#define UINT8_MAX (~(uint8_t)0)
+	#define UINT8_MIN 0
+	#define UINT16_MAX (~(uint16_t)0)
+	#define UINT16_MIN 0
+	#define UINT32_MAX (~(uint32_t)0)
+	#define UINT32_MIN 0
+	#define UINT64_MAX (~(uint64_t)0)
+	#define UINT64_MIN 0
+	
+	#define UINTPTR_MAX (~(uintptr_t)0)
+	#define UINTPTR_MIN 0
+	
+	/* Need to do int_fast16_t as well, as type
+	   size may be architecture dependent */
+	#define UINT_FAST16_MAX (~(uint_fast16_t)0)
+	#define UINT_FAST16_MAX 0
+	
+	#define INT8_MAX (UINT8_MAX>>1)
+	#define INT8_MIN (INT8_MAX+1)
+	#define INT16_MAX (UINT16_MAX>>1)
+	#define INT16_MIN (INT16_MAX+1)
+	#define INT32_MAX (UINT32_MAX>>1)
+	#define INT32_MIN (INT32_MAX+1)
+	#define INT64_MAX (UINT64_MAX>>1)
+	#define INT64_MIN (INT64_MAX+1)
+	
+	#define INTPTR_MAX (UINTPTR_MAX>>1)
+	#define INTPTR_MIN (INTPTR_MAX+1)	
+	
+	#define INT_FAST16_MAX (UINT_FAST16_MAX>>1)
+	#define INT_FAST16_MIN (INT_FAST16_MAX+1)
+	
+	/* now define equiv. constants */
+	#define UINT_FAST8_MAX UINT8_MAX
+	#define UINT_FAST8_MIN UINT_FAST8_MIN
+	#define INT_FAST8_MAX INT8_MAX
+	#define INT_FAST8_MIN INT8_MIN
+	#define UINT_FAST32_MAX UINT32_MAX
+	#define UINT_FAST32_MIN UINT32_MIN
+	#define INT_FAST32_MAX INT32_MAX
+	#define INT_FAST32_MIN INT32_MIN
+	#define UINT_FAST64_MAX UINT64_MAX
+	#define UINT_FAST64_MIN UINT64_MIN
+	#define INT_FAST64_MAX INT64_MAX
+	#define INT_FAST64_MIN INT64_MIN
+	
+	#define UINT_LEAST8_MAX UINT8_MAX
+	#define UINT_LEAST8_MIN UINT8_MIN
+	#define INT_LEAST8_MAX INT8_MAX
+	#define INT_LEAST8_MIN INT8_MIN
+	#define UINT_LEAST16_MAX UINT16_MAX
+	#define UINT_LEAST16_MIN UINT16_MIN
+	#define INT_LEAST16_MAX INT16_MAX
+	#define INT_LEAST16_MIN INT16_MIN
+	#define UINT_LEAST32_MAX UINT32_MAX
+	#define UINT_LEAST32_MIN UINT32_MIN
+	#define INT_LEAST32_MAX INT32_MAX
+	#define INT_LEAST32_MIN INT32_MIN
+	#define UINT_LEAST64_MAX UINT64_MAX
+	#define UINT_LEAST64_MIN UINT64_MIN
+	#define INT_LEAST64_MAX INT64_MAX
+	#define INT_LEAST64_MIN INT64_MIN
+	
+	#define UINTMAX_MAX UINT64_MAX
+	#define UINTMAX_MIN UINT64_MIN
+	#define INTMAX_MAX INT64_MAX
+	#define INTMAX_MIN INT64_MIN
+	
+	#endif
+	_EndOfHeader_;
+};
+
+/*
+ *  This hack makes makes unistd.h more POSIX-compliant on VxWorks
+ */
+fix = {
+	hackname	= AAB_vxworks_unistd;
+	files	   = unistd.h;
+	mach		= "*-*-vxworks*";
+	
+	replace		= <<- _EndOfHeader_
+	#ifndef _UNISTD_H
+	#define _UNISTD_H
+	#include_next <unistd.h>
+	#include <ioLib.h>
+	#ifndef STDIN_FILENO
+	#define STDIN_FILENO 0
+	#endif
+	#ifndef STDOUT_FILENO
+	#define STDOUT_FILENO 1
+	#endif
+	#ifndef STDERR_FILENO
+	#define STDERR_FILENO 2
+	#endif
+	#endif /* _UNISTD_H */
+	_EndOfHeader_;
+};
+
 
 /*
  * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
@@ -4371,6 +4571,41 @@  fix = {
     "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
 };
 
+/*
+ *  Wrap VxWorks ioctl to keep everything pretty
+ */
+fix = {
+	hackname	= vxworks_ioctl_macro;
+	files	   	= ioLib.h;
+	mach		= "*-*-vxworks*";
+
+	c_fix		= format;
+	c_fix_arg	= "%0\n"
+		"#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
+	c_fix_arg	= "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
+	
+	test_text	= "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
+};
+
+/*
+ *  Wrap VxWorks mkdir to be posix compliant
+ */
+fix = {
+	hackname	= vxworks_mkdir_macro;
+	files	   	= sys/stat.h;
+	mach		= "*-*-vxworks*";
+
+	c_fix		= format;
+	c_fix_arg	= "%0\n"
+		"#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
+	c_fix_arg	= "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
+				"\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
+				"(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
+				"\\)[\t ]*;";
+	
+	test_text	= "extern STATUS mkdir (const char * _qwerty) ;";
+};
+
 
 /*
  *  Fix VxWorks <time.h> to not require including <vxTypes.h>.
@@ -4404,6 +4639,20 @@  fix = {
     "# define\t__INCstath <sys/stat.h>";
 };
 
+/*
+ *  Make it so VxWorks does not include gcc/regs.h accidentally
+ */
+fix = {
+	hackname	= vxworks_regs;
+	mach		= "*-*-vxworks*";
+	
+	select		= "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
+	c_fix		= format;
+	c_fix_arg	= "#include <arch/../regs.h>";
+	
+	test_text	= "#include <regs.h>\n";
+};
+
 
 /*
  *  Another bad dependency in VxWorks 5.2 <time.h>.
@@ -4431,6 +4680,23 @@  fix = {
                 "#define VOIDFUNCPTR (void(*)())";
 };
 
+/*
+ *  This hack makes write const-correct on VxWorks
+ */
+fix = {
+	hackname	= vxworks_write_const;
+	files		= ioLib.h;
+	mach		= "*-*-vxworks*";
+
+	c_fix		= format;
+	c_fix_arg	= "extern int  write (int, const char*, size_t);";
+	c_fix_arg	= "extern[\t ]+int[\t ]+write[\t ]*\\("
+		"[\t ]*int[\t ]*,"
+		"[\t ]*char[\t ]*\\*[\t ]*,"
+		"[\t ]*size_t[\t ]*\\)[\t ]*;";
+	
+	test_text	= "extern int write ( int , char * , size_t ) ;";
+};
 
 /*
  *  There are several name conflicts with C++ reserved words in X11 header
diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
index 89e8ab7..6653fed 100755
--- a/fixincludes/mkfixinc.sh
+++ b/fixincludes/mkfixinc.sh
@@ -15,7 +15,6 @@  case $machine in
     i?86-*-mingw32* | \
     x86_64-*-mingw32* | \
     i?86-*-interix* | \
-    *-*-vxworks* | \
     powerpc-*-eabisim* | \
     powerpc-*-eabi*    | \
     powerpc-*-rtems*   | \
diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c
index d64fb42..f562654 100644
--- a/gcc/gcov-io.c
+++ b/gcc/gcov-io.c
@@ -92,7 +92,8 @@  gcov_open (const char *name, int mode)
     {
       /* Read-only mode - acquire a read-lock.  */
       s_flock.l_type = F_RDLCK;
-      fd = open (name, O_RDONLY);
+      /* pass mode (ignored) for compatibility */
+      fd = open (name, O_RDONLY, S_IRUSR | S_IWUSR);
     }
   else
     {
diff --git a/libstdc++-v3/config/os/vxworks/os_defines.h b/libstdc++-v3/config/os/vxworks/os_defines.h
index c66063e..93ad1d4 100644
--- a/libstdc++-v3/config/os/vxworks/os_defines.h
+++ b/libstdc++-v3/config/os/vxworks/os_defines.h
@@ -33,4 +33,10 @@ 
 // System-specific #define, typedefs, corrections, etc, go here.  This
 // file will come before all others.
 
+//Keep vxWorks from defining min()/max() as macros
+#ifdef NOMINMAX
+#undef NOMINMAX
+#endif
+#define NOMINMAX 1
+
 #endif