Fixincludes permanence & questions on cross compilers

rbmj rbmj@verizon.net
Wed May 23 18:04:00 GMT 2012


On 05/23/2012 01:27 PM, Jonathan Wakely wrote:
> On 23 May 2012 17:52, rbmj wrote:
>> 1.  Are fixincludes hacks only active during build-time (e.g. they do not
>> replace the actual file) or are they permanent?  If they are only
>> temporary/local to gcc, but they need to be permanent, is there a way to
>> specify this?
> They are permanent, but they don't replace the file. GCC puts the
> fixed headers in a directory which it searches before the system
> directories, so it finds the fixed ones before the original ones.
>
>> 2.  On cross compilers, fixincludes does not appear (to my uneducated eye)
>> to be applied to my headers (then again, I may have written the hacks wrong)
>> located in sys-include.  Does fixincludes not affect headers in sys-include
>> or am I not looking hard enough?
> If you're expecting the original headers to be replaced then you're
> looking in the wrong place.
>
> Search under the GCC installation tree, you should find the fixed
> version of the header.
>

OK, so I went into fixincludes/inclhack.def and added this rule:

/*
  *  This hack makes makes unistd.h more POSIX-compliant on VxWorks
  */
fix = {
     hackname    = vxworks_tasklib_regs;
     files       = taskLib.h;
     test        = " -r vxWorks.h ";

     select      = "#[\t ]*include[\t ]+<regs.h>";
     c_fix       = format;
     c_fix_arg   = "#include <arch/../regs.h>";

     test_text   = "`touch vxWorks.h taskLib.h`"
         "#include <regs.h>\n";
};

I then ran genfixes and then went in to my build directory.  I ran make 
check.  This was in fixincludes/test/inc/taskLib.h:

#if defined( VXWORKS_TASKLIB_REGS_CHECK )
#include <regs.h>

#endif  /* VXWORKS_TASKLIB_REGS_CHECK */

and I saw this in tests/res/taskLib.h:

#if defined( VXWORKS_TASKLIB_REGS_CHECK )
#include <arch/../regs.h>

#endif  /* VXWORKS_TASKLIB_REGS_CHECK */

So it looks good. I deleted the fixincludes subdir and then ran make. 
However, when I get to libgcc:

In file included from ../../../gcc-4.7.0/libgcc/../gcc/regs.h:25:0,
                  from /usr/powerpc-wrs-vxworks/sys-include/taskLib.h:213,
                  from ../../../gcc-4.7.0/libgcc/config/vxlib.c
<errors />

These errors go away if i run sed -i.orig -e 
's|<regs.h>|<arch/../regs.h>|' /usr/powerpc-wrs-vxworks/taskLib.h

So taskLib.h is still including regs.h, not arch/../regs.h like it 
should.  I go into the build directory, and type find | grep taskLib. 
The only thing I get are the two in fixincludes/tests - there's no file 
in GCC's build tree.

taskLib.h and vxWorks.h are in /usr/powerpc-wrs-vxworks/sys-include.  I 
configured gcc with the following command line:

../gcc-4.7.0/configure --prefix=/usr --target=powerpc-wrs-vxworks 
--with-gnu-as --with-gnu-ld 
--with-headers=../gccdist/WindRiver/vxworks-6.3/target/h 
--disable-shared --disable-libssp --disable-multilib --with-float=hard 
--enable-languages=c --enable-threads=vxworks --without-gconv 
--disable-libgomp --disable-nls --disable-libmudflap --with-cpu-PPC603

What is the problem here?  Do I need to manually specify to run fixincludes?

Thanks,

Robert Mason



More information about the Gcc-help mailing list