Patchwork [Ping] Fix gcc/gcov.c and libgcc/libgcov.c to fix build on VxWorks

login
register
mail settings
Submitter rbmj
Date June 22, 2012, 10:52 p.m.
Message ID <4FE4F717.6090800@verizon.net>
Download mbox | patch
Permalink /patch/166681/
State New
Headers show

Comments

rbmj - June 22, 2012, 10:52 p.m.
On 06/11/2012 08:01 AM, Paolo Bonzini wrote:
> 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.
OK, I've prepared a patch.  I would venture to say it is obvious.  I'll 
mock up a separate patch that resolves the mkdir() issue.

Robert Mason

Changes:

gcc/gcov-io.c: pass mode argument unconditionally to be
     compatible with non-variadic open() (e.g. on VxWorks).

---
  gcc/gcov-io.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c
index 37c1c3e..28ed52f 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
      {