Message ID | 4FC90C96.4030507@verizon.net |
---|---|
State | New |
Headers | show |
On 06/01/2012 02:40 PM, rbmj wrote: > Hi everyone, > > These fixes are to allow building on vxWorks. Currently there are two > issues: > > 1. VxWorks does not have a variadic open - it must receive three > arguments. gcc/gcov.c however opens a file for reading and does not > pass in a mode argument, which causes an error on vxWorks. This just > adds a platform-based ifdef around this. I am aware that this is > against coding conventions, and if that is an issue, I can think of > two resolutions. One, an autoconf macro to check for a non-variadic > open, or two, simply pass the extra mode argument in unconditionally, > as it should be transparent to the function and ignored if it is > variadic (I'm no expert on calling conventions though). > > 2. VxWorks has a two argument mkdir(). libgcc/libgcov.c uses mkdir() > and calls it with two arguments if TARGET_POSIX_IO is defined and only > one argument otherwise. I don't know what TARGET_POSIX_IO is, but if > it's anything more than just mkdir(), this is probably correct, as > vxworks is only partially POSIX compliant. Again, another > platform-based ifdef, so if that is anathema, it can be replaced by > more autoconf hackery. > > The patch as-is compiles targeting on vxworks and bootstraps on a > native x86_64-linux-gnu build (which makes sense, since it doesn't > touch anything for non-vxworks). > > Gerald Pfeifer has volunteered to apply the patch if approved. > > Also, in an earlier message [1] Janne Blomqvist mentioned that newer > versions of VxWorks do have the variadic open(), and this is true. > However, as far as I know, this version is still not available for > kernel modules, only real-time processes. > > Thanks, > > Robert Mason Sorry, forgot to add in the link. [1]: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01102.html
Hi everyone, Ping RE: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00086.html Thanks, Robert Mason On 06/01/2012 02:43 PM, rbmj wrote: > On 06/01/2012 02:40 PM, rbmj wrote: >> Hi everyone, >> >> These fixes are to allow building on vxWorks. Currently there are >> two issues: >> >> 1. VxWorks does not have a variadic open - it must receive three >> arguments. gcc/gcov.c however opens a file for reading and does not >> pass in a mode argument, which causes an error on vxWorks. This just >> adds a platform-based ifdef around this. I am aware that this is >> against coding conventions, and if that is an issue, I can think of >> two resolutions. One, an autoconf macro to check for a non-variadic >> open, or two, simply pass the extra mode argument in unconditionally, >> as it should be transparent to the function and ignored if it is >> variadic (I'm no expert on calling conventions though). >> >> 2. VxWorks has a two argument mkdir(). libgcc/libgcov.c uses >> mkdir() and calls it with two arguments if TARGET_POSIX_IO is defined >> and only one argument otherwise. I don't know what TARGET_POSIX_IO >> is, but if it's anything more than just mkdir(), this is probably >> correct, as vxworks is only partially POSIX compliant. Again, >> another platform-based ifdef, so if that is anathema, it can be >> replaced by more autoconf hackery. >> >> The patch as-is compiles targeting on vxworks and bootstraps on a >> native x86_64-linux-gnu build (which makes sense, since it doesn't >> touch anything for non-vxworks). >> >> Gerald Pfeifer has volunteered to apply the patch if approved. >> >> Also, in an earlier message [1] Janne Blomqvist mentioned that newer >> versions of VxWorks do have the variadic open(), and this is true. >> However, as far as I know, this version is still not available for >> kernel modules, only real-time processes. >> >> Thanks, >> >> Robert Mason > > Sorry, forgot to add in the link. > [1]: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01102.html >
Il 11/06/2012 13:56, rbmj ha scritto: >>> 1. VxWorks does not have a variadic open - it must receive three >>> arguments. gcc/gcov.c however opens a file for reading and does not >>> pass in a mode argument, which causes an error on vxWorks. This just >>> adds a platform-based ifdef around this. I am aware that this is >>> against coding conventions, and if that is an issue, I can think of >>> two resolutions. [...] simply pass the extra mode argument in unconditionally, >>> as it should be transparent to the function and ignored if it is >>> variadic (I'm no expert on calling conventions though). Yes, please do this. >>> 2. VxWorks has a two argument mkdir(). libgcc/libgcov.c uses >>> mkdir() and calls it with two arguments if TARGET_POSIX_IO is defined >>> and only one argument otherwise. I don't know what TARGET_POSIX_IO >>> is, but if it's anything more than just mkdir(), this is probably >>> correct, as vxworks is only partially POSIX compliant. Again, >>> another platform-based ifdef, so if that is anathema, it can be >>> replaced by more autoconf hackery. VxWorks should define TARGET_POSIX_IO if it has both access and mkdir. Please add it to gcc/config/vxworks.h if this is the case. Paolo
From ad3b2df4d172eea2e0edfd61153133b25a7ed640 Mon Sep 17 00:00:00 2001 From: rbmj <rbmj@verizon.net> Date: Wed, 30 May 2012 08:42:37 -0400 Subject: [PATCH 3/5] Make changes to gcov to allow compilation targeting vxworks. gcc/gcov-io.c: add mode argument to open() on vxworks libgcc/libgcov.c: fall back to single argument mkdir() on vxworks --- gcc/ChangeLog | 5 +++++ gcc/gcov-io.c | 4 ++++ libgcc/ChangeLog | 5 +++++ libgcc/libgcov.c | 2 +- 4 files changed, 15 insertions(+), 1 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 71451d2..c362fc6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2012-05-30 Robert Mason <rbmj@verizon.net> + * gcov-io.c (gcov_open): VxWorks does not have variadic open(), so pass + in a mode argument (ignored for O_RDONLY) on that platform. + +2012-05-30 Robert Mason <rbmj@verizon.net> + * config/rs6000/vxworks.h: Fix bad macro SUBSUBTARGET_OVERRIDE_OPTIONS. 2012-05-29 Joseph Myers <joseph@codesourcery.com> diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c index 37c1c3e..823067a 100644 --- a/gcc/gcov-io.c +++ b/gcc/gcov-io.c @@ -92,7 +92,11 @@ gcov_open (const char *name, int mode) { /* Read-only mode - acquire a read-lock. */ s_flock.l_type = F_RDLCK; +#ifdef __VXWORKS__ + fd = open (name, O_RDONLY, 0666); +#else fd = open (name, O_RDONLY); +#endif } else { diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 5c048f5..04a6653 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2012-05-30 Robert Mason <rbmj@verizon.net> + + * libgcov.c (create_file_directory): VxWorks does not have two-argument + mkdir, so fall back to the single-argument call on that platform. + 2012-05-25 Ian Lance Taylor <iant@google.com> * config/i386/morestack.S (__morestack_non_split): Check whether diff --git a/libgcc/libgcov.c b/libgcc/libgcov.c index 8ed8971..27117b4 100644 --- a/libgcc/libgcov.c +++ b/libgcc/libgcov.c @@ -133,7 +133,7 @@ create_file_directory (char *filename) /* Try to make directory if it doesn't already exist. */ if (access (filename, F_OK) == -1 -#ifdef TARGET_POSIX_IO +#if defined(TARGET_POSIX_IO) && !defined(__VXWORKS__) && mkdir (filename, 0755) == -1 #else && mkdir (filename) == -1 -- 1.7.5.4