From patchwork Sun Jun 24 22:54:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ping] Fix gcc/gcov.c and libgcc/libgcov.c to fix build on VxWorks From: rbmj X-Patchwork-Id: 166915 Message-Id: <4FE79AC0.8090107@verizon.net> To: gcc-patches@gcc.gnu.org Cc: gerald@pfeifer.com, bkorb@gnu.org Date: Sun, 24 Jun 2012 18:54:56 -0400 On 06/22/2012 06:52 PM, rbmj wrote: > 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. > OK, so in addition to that small change, here's a fixincludes rule to resolve the mkdir() issue, which I've tested and works correctly. It depends on my patch [1] to allow fixincludes to run on VxWorks (note that gcc/configure needs to be regened for that patch), and (as a fixincludes rule patch) needs fixincl.x to be regened with fixincludes/genfixes. Patch is attached. This patch, together with the patch in my previous mail [2], resolves bug 53264. Thanks, Robert Mason [1] http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00383.html [2] http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01508.html >From 0e14c471820d4a44b372e4e1c9248b39f65e23c4 Mon Sep 17 00:00:00 2001 From: rbmj Date: Sat, 23 Jun 2012 17:38:41 -0400 Subject: [PATCH] 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. Modified: *fixincludes/inclhack.def (vxworks_mkdir_macro): add hack *fixincludes/fixincl.x: Regenerate --- fixincludes/inclhack.def | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index d122b6d..95b6607 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -4488,6 +4488,27 @@ fix = { 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" + "#ifdef IN_GCC\n" + "#define mkdir(dir, mode) ((mode), (mkdir)(dir))\n" + "#endif\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 to not require including . -- 1.7.5.4