diff mbox series

libgcc/config/t-vxworks: remove -nostdinc from LIBGCC2_INCLUDES

Message ID 20180601122325.6251-1-rasmus.villemoes@prevas.dk
State New
Headers show
Series libgcc/config/t-vxworks: remove -nostdinc from LIBGCC2_INCLUDES | expand

Commit Message

Rasmus Villemoes June 1, 2018, 12:23 p.m. UTC
-nostdinc apparently does not affect the directories added by the -B
options when the xgcc wrapper is used when building an ordinary
cross-compiler, but having -nostdinc in LIBGCC2_INCLUDES breaks a
canadian cross build (i.e., when we use an already installed
cross-compiler), because we cannot find the ppc-asm.h file.

-I. alone already ensures we search find the gcc-provided unwind.h
rather than a system header by that name, but just for good measure
change the following -I includes to -isystem.

I have tested that both a cross (build=host=x86-linux,
target=powerpc-wrs-vxworks) and canadian cross (build=x86-linux,
host=x86-windows, target=powerpc-wrs-vxworks) builds work, and that
the resulting compilers produce working code on target.

2018-06-01  Rasmus Villemoes  <rasmus.villemoes@prevas.dk>

libgcc/

	* config/t-vxworks: Remove -nostdinc from LIBGCC2_INCLUDES.
---
 libgcc/config/t-vxworks | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Olivier Hainque June 3, 2018, 7:06 a.m. UTC | #1
Hello Rasmus,

> On 01 Jun 2018, at 14:23, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
> 
> -nostdinc apparently does not affect the directories added by the -B
> options when the xgcc wrapper is used when building an ordinary
> cross-compiler, but having -nostdinc in LIBGCC2_INCLUDES breaks a
> canadian cross build (i.e., when we use an already installed
> cross-compiler), because we cannot find the ppc-asm.h file.
> 
> -I. alone already ensures we search find the gcc-provided unwind.h
> rather than a system header by that name, but just for good measure
> change the following -I includes to -isystem.
> 
> I have tested that both a cross (build=host=x86-linux,
> target=powerpc-wrs-vxworks) and canadian cross (build=x86-linux,
> host=x86-windows, target=powerpc-wrs-vxworks) builds work, and that
> the resulting compilers produce working code on target.
> 
> 2018-06-01  Rasmus Villemoes  <rasmus.villemoes@prevas.dk>
> 
> libgcc/
> 
> 	* config/t-vxworks: Remove -nostdinc from LIBGCC2_INCLUDES.

Thanks for proposing this patch. It unfortunately breaks
a regular cross build for me, configured like:

  /gcc.git/configure  --prefix=/gournay.a/users/hainque/ins  --target=powerpc-wrs-vxworks --enable-languages=c --disable-libada --with-gnu-ld --with-gnu-as --disable-libssp

on a x86-linux host. With a properly set WIND_BASE, "make" passes with the
current trunk, and with the patch now fails with errors like:

  In file included from .../users/hainque/gcc.git/libgcc/config/vxlib-tls.c:45:
  .../vxworks-6.8/vxworks-6.8/target/h/taskLib.h:425:5: error: unknown type name 'REG_SET'
     REG_SET *  pExcRegSet; /* 0x120: exception regSet ptr or NULL*/

vxlib-tls.c #includes some vxworks headers, which end up including "regs.h",
intended to get the vxworks instance of this file. Without -nostdinc, we get
gcc's "regs.h" instead.

Turns out we have encountered the canadian build problem as well and have
an alternate resolution for it, which I was about to commit.

Does the attached patch work for you ?

--

    Refine -I flags for VxWorks libgcc

    Arrange to always have <toplevel-build-dir>/gcc/include in the
    -I flags for libgcc on VxWorks. This contains user accessible header
    files provided by gcc so is legitimate and needed in many cases.

    This is implicitly achieved with -B when building a regular cross
    compiler, but there's no such -B when cross compiling libraries as
    part of a canadian build.

2018-06-03  Olivier Hainque  <hainque@adacore.com>

        * libgcc/config/t-vxworks (LIBGCC_INCLUDES):
        Add -I$(MULTIBUILDTOP)../../gcc/include.
        * libgcc/config/t-vxworks7: Likewise. Reformat a bit to
        match the t-vxworks layout.
Rasmus Villemoes June 4, 2018, 9:02 a.m. UTC | #2
On 2018-06-03 09:06, Olivier Hainque wrote:
> Hello Rasmus,
> 
>> On 01 Jun 2018, at 14:23, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
>> 
>> -nostdinc apparently does not affect the directories added by the -B
>> options when the xgcc wrapper is used when building an ordinary
>> cross-compiler, but having -nostdinc in LIBGCC2_INCLUDES breaks a
>> canadian cross build (i.e., when we use an already installed
>> cross-compiler), because we cannot find the ppc-asm.h file.
>> 
>> -I. alone already ensures we search find the gcc-provided unwind.h
>> rather than a system header by that name, but just for good measure
>> change the following -I includes to -isystem.
>> 
>> I have tested that both a cross (build=host=x86-linux,
>> target=powerpc-wrs-vxworks) and canadian cross (build=x86-linux,
>> host=x86-windows, target=powerpc-wrs-vxworks) builds work, and that
>> the resulting compilers produce working code on target.
>> 
>> 2018-06-01  Rasmus Villemoes  <rasmus.villemoes@prevas.dk>
>> 
>> libgcc/
>> 
>>        * config/t-vxworks: Remove -nostdinc from LIBGCC2_INCLUDES.
> 
> Thanks for proposing this patch. It unfortunately breaks
> a regular cross build for me, configured like:
> 
>    /gcc.git/configure  --prefix=/gournay.a/users/hainque/ins  
> --target=powerpc-wrs-vxworks --enable-languages=c --disable-libada --with-gnu-ld 
> --with-gnu-as --disable-libssp
> 
> on a x86-linux host. With a properly set WIND_BASE, "make" passes with the
> current trunk, and with the patch now fails with errors like:
> 
>    In file included from .../users/hainque/gcc.git/libgcc/config/vxlib-tls.c:45:
>    .../vxworks-6.8/vxworks-6.8/target/h/taskLib.h:425:5: error: unknown type 
> name 'REG_SET'
>       REG_SET *  pExcRegSet; /* 0x120: exception regSet ptr or NULL*/
> 
> vxlib-tls.c #includes some vxworks headers, which end up including "regs.h",
> intended to get the vxworks instance of this file. Without -nostdinc, we get
> gcc's "regs.h" instead.

Ah. I'm on VxWorks 5.5, where the system headers mostly use #include
"...", so the include in taskLib.h first searches the directory of
taskLib.h itself.

> Turns out we have encountered the canadian build problem as well and have
> an alternate resolution for it, which I was about to commit.
> 
> Does the attached patch work for you ?

It does seem to work for me, both for the cross and canadian builds.

thanks,
Rasmus
Olivier Hainque June 7, 2018, 9 a.m. UTC | #3
Hello Rasmus,

> On 04 Jun 2018, at 11:02, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:

>> Turns out we have encountered the canadian build problem as well and have
>> an alternate resolution for it, which I was about to commit.
>> 
>> Does the attached patch work for you ?
> 
> It does seem to work for me, both for the cross and canadian builds.

Great, thanks for confirming! I'll be committing shortly.

I'll also get back to you on the exception related patches
you sent. Exception handling is a delicate problem on VxWorks
so this will take a bit of time.

Regards,

Olivier
diff mbox series

Patch

diff --git a/libgcc/config/t-vxworks b/libgcc/config/t-vxworks
index bbbb16deede..8e85bd21f1f 100644
--- a/libgcc/config/t-vxworks
+++ b/libgcc/config/t-vxworks
@@ -8,8 +8,8 @@  LIB2ADDEH += $(srcdir)/config/vxlib.c $(srcdir)/config/vxlib-tls.c
 # system headers have names that collide with GCC's internal (host)
 # headers, e.g. regs.h. Make sure the local libgcc headers still
 # prevail (e.g. unwind.h).
-LIBGCC2_INCLUDES = -nostdinc -I. \
+LIBGCC2_INCLUDES = -I. \
   `case "/$(MULTIDIR)" in \
-     */mrtp*) echo -I$(WIND_USR)/h -I$(WIND_USR)/h/wrn/coreip ;; \
-     *) echo -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip ;; \
+     */mrtp*) echo -isystem $(WIND_USR)/h -isystem $(WIND_USR)/h/wrn/coreip ;; \
+     *) echo -isystem $(WIND_BASE)/target/h -isystem $(WIND_BASE)/target/h/wrn/coreip ;; \
    esac`