This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[VXWORKS PPC 2.95.3] vxworks-varargs.patch




  VxWorks bypasses the usual varargs headers, and defines all the va_
macros in a header file arch/ppc/toolPpc.h.  It uses the
__builtin_args_info functions, which are no longer valid in 2.95.3,
particularly since the rs6000_args_info structure was altered, removing
the varargs_offset member that previously was __builtin_args_info(4).
When the VxWorks headers try that, they get the new member #4, which is
the prototype count.  This is usually around 1000 (decimal) which isn't
right at all.

  We have to patch that file to use va-ppc.h instead, and we also have to
patch a file that includes it to enforce it's being found on the system
include path. There are some predefines needed in the spec file as well.

  In order for the fixed headers to still work with the old compiler, I
used a feature select macro.  This is just a minor kindness to anyone who
overwrites their VxWorks header files and then wants to go back.  We also
define __PPC__ since a) it's true and b) it makes the new
varargs.h/stdarg.h find va-ppc.h correctly.  I suppose to be really kind I
should have fixed these headers to include the old VxWorks header file if
the feature select macro was off, but there you go.  There will still be a
problem if people continue to use the
-nostdinc flag.

diff -c3prN /gcc.orig/gcc/gcc/config/rs6000/vxppc.h
/gcc.dev/gcc/gcc/config/rs6000/vxppc.h
*** /gcc.orig/gcc/gcc/config/rs6000/vxppc.h Mon May 17 02:30:56 1999
--- /gcc.dev/gcc/gcc/config/rs6000/vxppc.h Mon Jan 29 23:41:20 2001
*************** Boston, MA 02111-1307, USA.  */
*** 47,53 ****
  #undef CPP_PREDEFINES
  #define CPP_PREDEFINES "\
  -D__vxworks -Asystem(vxworks) -Asystem(embedded) \
! -Acpu(powerpc) -Amachine(powerpc)"

  /* VxWorks does all the library stuff itself.  */

--- 47,53 ----
  #undef CPP_PREDEFINES
  #define CPP_PREDEFINES "\
  -D__vxworks -Asystem(vxworks) -Asystem(embedded) \
! -Acpu(powerpc) -Amachine(powerpc) -D__PPC__ -D__VXVARGS__"

  /* VxWorks does all the library stuff itself.  */

diff -c3prN /gcc.orig/gcc/gcc/fixinc/inclhack.def
/gcc.dev/gcc/gcc/fixinc/inclhack.def
*** /gcc.orig/gcc/gcc/fixinc/inclhack.def Fri Aug 13 09:44:06 1999
--- /gcc.dev/gcc/gcc/fixinc/inclhack.def Wed Jan 24 20:38:26 2001
*************** fix = {
*** 2234,2239 ****
--- 2234,2267 ----
          "#endif\n";
  };

+ /*
+  *   Fix VxWorks varargs header
+  */
+ fix = {
+     hackname = vxworks_varargs_problem;
+     files    = arch/ppc/toolPpc.h;
+     select   = "GNU C varargs support for the PowerPC with V.4 calling sequence";
+
+     sed = "/\\/\\* GNU C varargs support for the PowerPC with V.4 calling sequence \\*\\//a\\\n"
+      "#ifdef __VXVARGS__\\\n"
+   "#include <va-ppc.h>\\\n"
+   "#else /* !defined(__VXVARGS__) */\\\n";
+
+     sed = "/\\/\\* END CYGNUS LOCAL Waiting for 2.7.1 to unfreeze \\*\\//i\\\n"
+   "#endif /* !defined(__VXVARGS__) */\\\n";
+ };
+
+ /*
+  *   That last fix won't even work unless we make archPpc.h use the default
+  *  search path when it includes toolPpc.h
+  *
+  */
+ fix = {
+     hackname = vxworks_arch_includepath;
+     files    = arch/ppc/archPpc.h;
+     select = 'include.*"toolPpc.h"';
+     sed    = "s,\"toolPpc.h\",<arch/ppc/toolPpc.h>,";
+ };

  /*
   *  Fix VxWorks <time.h> to not require including <vxTypes.h>.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]