All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add -nostdinc to TARGET_CFLAGS
@ 2009-10-26 16:16 Robert Millan
  2009-10-28 23:16 ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2009-10-26 16:16 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]


It should be pretty obvious that we don't want to use system headers when
building target, but we've been for so long without this flag that I want
to make sure.

Does anyone see a problem with it?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

[-- Attachment #2: nostdinc.diff --]
[-- Type: text/x-diff, Size: 735 bytes --]


$ bzr diff -r 1768..1769 bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/lib-linux/Makefile.in

2009-10-26  Robert Millan  <rmh.grub@aybabtu.com>

	* Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'.

=== modified file 'Makefile.in'
--- Makefile.in	2009-10-06 00:04:32 +0000
+++ Makefile.in	2009-10-23 13:31:15 +0000
@@ -75,7 +75,7 @@
 TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
 TARGET_APPLE_CC = @TARGET_APPLE_CC@
 OBJCONV = @OBJCONV@
-TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
+TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
 	-Wall -W
 TARGET_LDFLAGS = @TARGET_LDFLAGS@
 TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-10-26 16:16 [PATCH] Add -nostdinc to TARGET_CFLAGS Robert Millan
@ 2009-10-28 23:16 ` Robert Millan
  2009-10-29 10:14   ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2009-10-28 23:16 UTC (permalink / raw)
  To: grub-devel


Committed then.

On Mon, Oct 26, 2009 at 05:16:38PM +0100, Robert Millan wrote:
> 
> It should be pretty obvious that we don't want to use system headers when
> building target, but we've been for so long without this flag that I want
> to make sure.
> 
> Does anyone see a problem with it?
> 
> -- 
> Robert Millan
> 
>   The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
>   how) you may access your data; but nobody's threatening your freedom: we
>   still allow you to remove your data and not access it at all."

> 
> $ bzr diff -r 1768..1769 bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/lib-linux/Makefile.in
> 
> 2009-10-26  Robert Millan  <rmh.grub@aybabtu.com>
> 
> 	* Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'.
> 
> === modified file 'Makefile.in'
> --- Makefile.in	2009-10-06 00:04:32 +0000
> +++ Makefile.in	2009-10-23 13:31:15 +0000
> @@ -75,7 +75,7 @@
>  TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
>  TARGET_APPLE_CC = @TARGET_APPLE_CC@
>  OBJCONV = @OBJCONV@
> -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
> +TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
>  	-Wall -W
>  TARGET_LDFLAGS = @TARGET_LDFLAGS@
>  TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
> 

> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-10-28 23:16 ` Robert Millan
@ 2009-10-29 10:14   ` Robert Millan
  2009-10-29 10:36     ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2009-10-29 10:14 UTC (permalink / raw)
  To: grub-devel


It appears that -nostdinc also excludes GCC internal header directory (for
e.g. stdarg.h), which I didn't expect.

Does someone know a clean way to resolve this?  A quick check at GCC
command-line options didn't reveal a way to explicitly include that
directory afterwards without knowing its path.

I.e. something similar to `gcc -print-file-name=libgcc.a`

On Thu, Oct 29, 2009 at 12:16:23AM +0100, Robert Millan wrote:
> 
> Committed then.
> 
> On Mon, Oct 26, 2009 at 05:16:38PM +0100, Robert Millan wrote:
> > 
> > It should be pretty obvious that we don't want to use system headers when
> > building target, but we've been for so long without this flag that I want
> > to make sure.
> > 
> > Does anyone see a problem with it?
> > 
> > -- 
> > Robert Millan
> > 
> >   The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
> >   how) you may access your data; but nobody's threatening your freedom: we
> >   still allow you to remove your data and not access it at all."
> 
> > 
> > $ bzr diff -r 1768..1769 bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/lib-linux/Makefile.in
> > 
> > 2009-10-26  Robert Millan  <rmh.grub@aybabtu.com>
> > 
> > 	* Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'.
> > 
> > === modified file 'Makefile.in'
> > --- Makefile.in	2009-10-06 00:04:32 +0000
> > +++ Makefile.in	2009-10-23 13:31:15 +0000
> > @@ -75,7 +75,7 @@
> >  TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
> >  TARGET_APPLE_CC = @TARGET_APPLE_CC@
> >  OBJCONV = @OBJCONV@
> > -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
> > +TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
> >  	-Wall -W
> >  TARGET_LDFLAGS = @TARGET_LDFLAGS@
> >  TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
> > 
> 
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > http://lists.gnu.org/mailman/listinfo/grub-devel
> 
> 
> -- 
> Robert Millan
> 
>   The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
>   how) you may access your data; but nobody's threatening your freedom: we
>   still allow you to remove your data and not access it at all."

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-10-29 10:14   ` Robert Millan
@ 2009-10-29 10:36     ` Robert Millan
  2009-10-29 10:46       ` Vladimir 'phcoder' Serbinenko
  2009-11-04 10:48       ` Felix Zielcke
  0 siblings, 2 replies; 16+ messages in thread
From: Robert Millan @ 2009-10-29 10:36 UTC (permalink / raw)
  To: grub-devel

On Thu, Oct 29, 2009 at 11:14:33AM +0100, Robert Millan wrote:
> 
> It appears that -nostdinc also excludes GCC internal header directory (for
> e.g. stdarg.h), which I didn't expect.
> 
> Does someone know a clean way to resolve this?  A quick check at GCC
> command-line options didn't reveal a way to explicitly include that
> directory afterwards without knowing its path.
> 
> I.e. something similar to `gcc -print-file-name=libgcc.a`

Maybe with -isysroot=`pwd`/dummy instead of -nostdinc.

It's an ugly kludge, but the alternatives look even worse.

Does someone have a better idea?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-10-29 10:36     ` Robert Millan
@ 2009-10-29 10:46       ` Vladimir 'phcoder' Serbinenko
  2009-10-30 18:55         ` Robert Millan
  2009-11-04 10:48       ` Felix Zielcke
  1 sibling, 1 reply; 16+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-10-29 10:46 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Thu, Oct 29, 2009 at 11:14:33AM +0100, Robert Millan wrote:
>   
>> It appears that -nostdinc also excludes GCC internal header directory (for
>> e.g. stdarg.h), which I didn't expect.
>>
>> Does someone know a clean way to resolve this?  A quick check at GCC
>> command-line options didn't reveal a way to explicitly include that
>> directory afterwards without knowing its path.
>>
>> I.e. something similar to `gcc -print-file-name=libgcc.a`
>>     
>
> Maybe with -isysroot=`pwd`/dummy instead of -nostdinc.
>
>   
Why not to create a real sysdir? For gcc grub is just another OS
environment so we can use same approach as if we were cross-compiling
for another OS
> It's an ugly kludge, but the alternatives look even worse.
>
> Does someone have a better idea?
>
>   


-- 
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git 




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-10-29 10:46       ` Vladimir 'phcoder' Serbinenko
@ 2009-10-30 18:55         ` Robert Millan
  0 siblings, 0 replies; 16+ messages in thread
From: Robert Millan @ 2009-10-30 18:55 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

On Thu, Oct 29, 2009 at 11:46:11AM +0100, Vladimir 'phcoder' Serbinenko wrote:
> Robert Millan wrote:
> > On Thu, Oct 29, 2009 at 11:14:33AM +0100, Robert Millan wrote:
> >   
> >> It appears that -nostdinc also excludes GCC internal header directory (for
> >> e.g. stdarg.h), which I didn't expect.
> >>
> >> Does someone know a clean way to resolve this?  A quick check at GCC
> >> command-line options didn't reveal a way to explicitly include that
> >> directory afterwards without knowing its path.
> >>
> >> I.e. something similar to `gcc -print-file-name=libgcc.a`
> >>     
> >
> > Maybe with -isysroot=`pwd`/dummy instead of -nostdinc.
> >
> >   
> Why not to create a real sysdir? For gcc grub is just another OS
> environment so we can use same approach as if we were cross-compiling
> for another OS

Good point.  Actually, I realized that we already have one (include/grub/).

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

[-- Attachment #2: isystem.diff --]
[-- Type: text/x-diff, Size: 747 bytes --]

2009-10-30  Robert Millan  <rmh.grub@aybabtu.com>

	* Makefile.in (TARGET_CPPFLAGS): Replace `-nostdinc' with
	`-isystem=$(srcdir)/include'.

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 2672)
+++ Makefile.in	(working copy)
@@ -75,7 +75,7 @@ TARGET_ASFLAGS = @TARGET_ASFLAGS@
 TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
 TARGET_APPLE_CC = @TARGET_APPLE_CC@
 OBJCONV = @OBJCONV@
-TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \
+TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(builddir) -I$(builddir)/include \
 	-Wall -W
 TARGET_LDFLAGS = @TARGET_LDFLAGS@
 TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-10-29 10:36     ` Robert Millan
  2009-10-29 10:46       ` Vladimir 'phcoder' Serbinenko
@ 2009-11-04 10:48       ` Felix Zielcke
  2009-11-14 21:16         ` Felix Zielcke
  1 sibling, 1 reply; 16+ messages in thread
From: Felix Zielcke @ 2009-11-04 10:48 UTC (permalink / raw)
  To: The development of GRUB 2

Am Donnerstag, den 29.10.2009, 11:36 +0100 schrieb Robert Millan:
> On Thu, Oct 29, 2009 at 11:14:33AM +0100, Robert Millan wrote:
> > 
> > It appears that -nostdinc also excludes GCC internal header directory (for
> > e.g. stdarg.h), which I didn't expect.
> > 
> > Does someone know a clean way to resolve this?  A quick check at GCC
> > command-line options didn't reveal a way to explicitly include that
> > directory afterwards without knowing its path.
> > 
> > I.e. something similar to `gcc -print-file-name=libgcc.a`
> 
> Maybe with -isysroot=`pwd`/dummy instead of -nostdinc.
> 
> It's an ugly kludge, but the alternatives look even worse.
> 
> Does someone have a better idea?
> 

Thanks to the hint from rubisher I looked now at Linux Makefiles.
They use this:

NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)

# ls $(gcc-4.4 -print-file-name=include)/stdarg.h
/usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h


-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-04 10:48       ` Felix Zielcke
@ 2009-11-14 21:16         ` Felix Zielcke
  2009-11-15 11:04           ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Felix Zielcke @ 2009-11-14 21:16 UTC (permalink / raw)
  To: The development of GRUB 2

Am Mittwoch, den 04.11.2009, 11:48 +0100 schrieb Felix Zielcke:
> Am Donnerstag, den 29.10.2009, 11:36 +0100 schrieb Robert Millan:
> > On Thu, Oct 29, 2009 at 11:14:33AM +0100, Robert Millan wrote:
> > > 
> > > It appears that -nostdinc also excludes GCC internal header directory (for
> > > e.g. stdarg.h), which I didn't expect.
> > > 
> > > Does someone know a clean way to resolve this?  A quick check at GCC
> > > command-line options didn't reveal a way to explicitly include that
> > > directory afterwards without knowing its path.
> > > 
> > > I.e. something similar to `gcc -print-file-name=libgcc.a`
> > 
> > Maybe with -isysroot=`pwd`/dummy instead of -nostdinc.
> > 
> > It's an ugly kludge, but the alternatives look even worse.
> > 
> > Does someone have a better idea?
> > 
> 
> Thanks to the hint from rubisher I looked now at Linux Makefiles.
> They use this:
> 
> NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> 
> # ls $(gcc-4.4 -print-file-name=include)/stdarg.h
> /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h
> 

Robert?
IMO this makes at least more sense then what we have now
and I just tested this now with and without a seperate build directory
with experimental branch and it works
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC)
-print-file-name=include) -I$(srcdir)/include -I$(builddir)
-I$(builddir)/include -Wall -W


-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-14 21:16         ` Felix Zielcke
@ 2009-11-15 11:04           ` Robert Millan
  2009-11-15 11:12             ` Robert Millan
  2009-11-15 11:17             ` Felix Zielcke
  0 siblings, 2 replies; 16+ messages in thread
From: Robert Millan @ 2009-11-15 11:04 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sat, Nov 14, 2009 at 10:16:45PM +0100, Felix Zielcke wrote:
> Am Mittwoch, den 04.11.2009, 11:48 +0100 schrieb Felix Zielcke:
> > 
> > Thanks to the hint from rubisher I looked now at Linux Makefiles.
> > They use this:
> > 
> > NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > 
> > # ls $(gcc-4.4 -print-file-name=include)/stdarg.h
> > /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h
> > 
> 
> Robert?
> IMO this makes at least more sense then what we have now
> and I just tested this now with and without a seperate build directory
> with experimental branch and it works
> TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC)
> -print-file-name=include) -I$(srcdir)/include -I$(builddir)
> -I$(builddir)/include -Wall -W

What's the advantage?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 11:04           ` Robert Millan
@ 2009-11-15 11:12             ` Robert Millan
  2009-11-15 11:19               ` Felix Zielcke
  2009-11-15 11:17             ` Felix Zielcke
  1 sibling, 1 reply; 16+ messages in thread
From: Robert Millan @ 2009-11-15 11:12 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sun, Nov 15, 2009 at 12:04:58PM +0100, Robert Millan wrote:
> On Sat, Nov 14, 2009 at 10:16:45PM +0100, Felix Zielcke wrote:
> > Am Mittwoch, den 04.11.2009, 11:48 +0100 schrieb Felix Zielcke:
> > > 
> > > Thanks to the hint from rubisher I looked now at Linux Makefiles.
> > > They use this:
> > > 
> > > NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > > 
> > > # ls $(gcc-4.4 -print-file-name=include)/stdarg.h
> > > /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h
> > > 
> > 
> > Robert?
> > IMO this makes at least more sense then what we have now
> > and I just tested this now with and without a seperate build directory
> > with experimental branch and it works
> > TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC)
> > -print-file-name=include) -I$(srcdir)/include -I$(builddir)
> > -I$(builddir)/include -Wall -W
> 
> What's the advantage?

Ah, I remember.  There was a problem with stddef.h right?

So you propose something like this:

-TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
+TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(shell $(CC) -print-file-name=include) -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \

  ?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 11:04           ` Robert Millan
  2009-11-15 11:12             ` Robert Millan
@ 2009-11-15 11:17             ` Felix Zielcke
  2009-11-15 11:35               ` Robert Millan
  1 sibling, 1 reply; 16+ messages in thread
From: Felix Zielcke @ 2009-11-15 11:17 UTC (permalink / raw)
  To: The development of GNU GRUB

Am Sonntag, den 15.11.2009, 12:04 +0100 schrieb Robert Millan:
> On Sat, Nov 14, 2009 at 10:16:45PM +0100, Felix Zielcke wrote:
> > Am Mittwoch, den 04.11.2009, 11:48 +0100 schrieb Felix Zielcke:
> > > 
> > > Thanks to the hint from rubisher I looked now at Linux Makefiles.
> > > They use this:
> > > 
> > > NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > > 
> > > # ls $(gcc-4.4 -print-file-name=include)/stdarg.h
> > > /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h
> > > 
> > 
> > Robert?
> > IMO this makes at least more sense then what we have now
> > and I just tested this now with and without a seperate build directory
> > with experimental branch and it works
> > TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC)
> > -print-file-name=include) -I$(srcdir)/include -I$(builddir)
> > -I$(builddir)/include -Wall -W
> 
> What's the advantage?
> 

The advantage is that this does exatly what we want for the target.
Remove /usr/include from the include search directories but still keep
the gcc internal one for e.g. stdarg.h
As far as I understand the gcc manual, isystem adds this directory to
the search path and treats all headers there in as system headers.
And with the = between -isystem and $(srcdir) it actually uses
${sysroot}{$srcdir} but we don't use any --sysroot or -isysroot.
The arguments we currently have there just look wrong with my understand
of the gcc manual

$ cat test.c
#include <stdarg.h>
#include <stdint.h>

int main (void)
{
  return 0;
}

$ srcdir=$PWD builddir=$PWD gcc -isystem=$srcdir/include -I$srcdir/include -I$builddir -I$builddir/include test.c -o test && ls test
test
$ srcdir=$PWD builddir=$PWD gcc -nostdinc -isystem $(gcc -print-file-name=include) -I$srcdir/include -I$builddir -I$builddir/include test.c 
test.c:2:20: error: stdint.h: No such file or directory


-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 11:12             ` Robert Millan
@ 2009-11-15 11:19               ` Felix Zielcke
  0 siblings, 0 replies; 16+ messages in thread
From: Felix Zielcke @ 2009-11-15 11:19 UTC (permalink / raw)
  To: The development of GNU GRUB

Am Sonntag, den 15.11.2009, 12:12 +0100 schrieb Robert Millan:
> On Sun, Nov 15, 2009 at 12:04:58PM +0100, Robert Millan wrote:
> > On Sat, Nov 14, 2009 at 10:16:45PM +0100, Felix Zielcke wrote:
> > > Am Mittwoch, den 04.11.2009, 11:48 +0100 schrieb Felix Zielcke:
> > > > 
> > > > Thanks to the hint from rubisher I looked now at Linux Makefiles.
> > > > They use this:
> > > > 
> > > > NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > > > 
> > > > # ls $(gcc-4.4 -print-file-name=include)/stdarg.h
> > > > /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h
> > > > 
> > > 
> > > Robert?
> > > IMO this makes at least more sense then what we have now
> > > and I just tested this now with and without a seperate build directory
> > > with experimental branch and it works
> > > TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC)
> > > -print-file-name=include) -I$(srcdir)/include -I$(builddir)
> > > -I$(builddir)/include -Wall -W
> > 
> > What's the advantage?
> 
> Ah, I remember.  There was a problem with stddef.h right?
> 
> So you propose something like this:
> 
> -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
> +TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(shell $(CC) -print-file-name=include) -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
> 
>   ?

See my previous mail, actually this:
-TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
+TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC) -print-file-name=include) -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \

The = in -isystem doestn't make much sense to me.
And with above -nostdinc really works for us.



-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 11:17             ` Felix Zielcke
@ 2009-11-15 11:35               ` Robert Millan
  2009-11-15 11:50                 ` Felix Zielcke
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2009-11-15 11:35 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sun, Nov 15, 2009 at 12:17:50PM +0100, Felix Zielcke wrote:
> 
> The advantage is that this does exatly what we want for the target.
> Remove /usr/include from the include search directories but still keep
> the gcc internal one for e.g. stdarg.h
> As far as I understand the gcc manual, isystem adds this directory to
> the search path and treats all headers there in as system headers.
> And with the = between -isystem and $(srcdir) it actually uses
> ${sysroot}{$srcdir} but we don't use any --sysroot or -isysroot.
> The arguments we currently have there just look wrong with my understand
> of the gcc manual

Ah, I see..

> $ cat test.c
> #include <stdarg.h>
> #include <stdint.h>
> 
> int main (void)
> {
>   return 0;
> }
> 
> $ srcdir=$PWD builddir=$PWD gcc -isystem=$srcdir/include -I$srcdir/include -I$builddir -I$builddir/include test.c -o test && ls test
> test
> $ srcdir=$PWD builddir=$PWD gcc -nostdinc -isystem $(gcc -print-file-name=include) -I$srcdir/include -I$builddir -I$builddir/include test.c 
> test.c:2:20: error: stdint.h: No such file or directory

We used -isystem as a way of excluding system headers but not gcc headers.
With the -print-file-name trick this seems to be no longer necessary, right?

So why not "-nostdinc -I$(gcc -print-file-name=include)" instead?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 11:35               ` Robert Millan
@ 2009-11-15 11:50                 ` Felix Zielcke
  2009-11-15 12:32                   ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Felix Zielcke @ 2009-11-15 11:50 UTC (permalink / raw)
  To: The development of GNU GRUB

Am Sonntag, den 15.11.2009, 12:35 +0100 schrieb Robert Millan:
> On Sun, Nov 15, 2009 at 12:17:50PM +0100, Felix Zielcke wrote:
> > 
> > The advantage is that this does exatly what we want for the target.
> > Remove /usr/include from the include search directories but still keep
> > the gcc internal one for e.g. stdarg.h
> > As far as I understand the gcc manual, isystem adds this directory to
> > the search path and treats all headers there in as system headers.
> > And with the = between -isystem and $(srcdir) it actually uses
> > ${sysroot}{$srcdir} but we don't use any --sysroot or -isysroot.
> > The arguments we currently have there just look wrong with my understand
> > of the gcc manual
> 
> Ah, I see..
> 
> > $ cat test.c
> > #include <stdarg.h>
> > #include <stdint.h>
> > 
> > int main (void)
> > {
> >   return 0;
> > }
> > 
> > $ srcdir=$PWD builddir=$PWD gcc -isystem=$srcdir/include -I$srcdir/include -I$builddir -I$builddir/include test.c -o test && ls test
> > test
> > $ srcdir=$PWD builddir=$PWD gcc -nostdinc -isystem $(gcc -print-file-name=include) -I$srcdir/include -I$builddir -I$builddir/include test.c 
> > test.c:2:20: error: stdint.h: No such file or directory
> 
> We used -isystem as a way of excluding system headers but not gcc headers.
> With the -print-file-name trick this seems to be no longer necessary, right?
> 
> So why not "-nostdinc -I$(gcc -print-file-name=include)" instead?

I think we should use -isystem for the gcc internal header files not -I,
but I just tested experimental branch with -I instead of -isystem and
also compiles cleanly (except the usual grub.texi warnings)

As said on IRC already:
http://gcc.gnu.org/onlinedocs/cpp/System-Headers.html


-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 11:50                 ` Felix Zielcke
@ 2009-11-15 12:32                   ` Robert Millan
  2009-11-15 12:42                     ` Felix Zielcke
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2009-11-15 12:32 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sun, Nov 15, 2009 at 12:50:39PM +0100, Felix Zielcke wrote:
> > > $ srcdir=$PWD builddir=$PWD gcc -isystem=$srcdir/include -I$srcdir/include -I$builddir -I$builddir/include test.c -o test && ls test
> > > test
> > > $ srcdir=$PWD builddir=$PWD gcc -nostdinc -isystem $(gcc -print-file-name=include) -I$srcdir/include -I$builddir -I$builddir/include test.c 
> > > test.c:2:20: error: stdint.h: No such file or directory
> > 
> > We used -isystem as a way of excluding system headers but not gcc headers.
> > With the -print-file-name trick this seems to be no longer necessary, right?
> > 
> > So why not "-nostdinc -I$(gcc -print-file-name=include)" instead?
> 
> I think we should use -isystem for the gcc internal header files not -I,
> but I just tested experimental branch with -I instead of -isystem and
> also compiles cleanly (except the usual grub.texi warnings)

Seems fine.  Thanks for investigating this.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
  2009-11-15 12:32                   ` Robert Millan
@ 2009-11-15 12:42                     ` Felix Zielcke
  0 siblings, 0 replies; 16+ messages in thread
From: Felix Zielcke @ 2009-11-15 12:42 UTC (permalink / raw)
  To: The development of GNU GRUB

Am Sonntag, den 15.11.2009, 13:32 +0100 schrieb Robert Millan:
> On Sun, Nov 15, 2009 at 12:50:39PM +0100, Felix Zielcke wrote:
> > > > $ srcdir=$PWD builddir=$PWD gcc -isystem=$srcdir/include -I$srcdir/include -I$builddir -I$builddir/include test.c -o test && ls test
> > > > test
> > > > $ srcdir=$PWD builddir=$PWD gcc -nostdinc -isystem $(gcc -print-file-name=include) -I$srcdir/include -I$builddir -I$builddir/include test.c 
> > > > test.c:2:20: error: stdint.h: No such file or directory
> > > 
> > > We used -isystem as a way of excluding system headers but not gcc headers.
> > > With the -print-file-name trick this seems to be no longer necessary, right?
> > > 
> > > So why not "-nostdinc -I$(gcc -print-file-name=include)" instead?
> > 
> > I think we should use -isystem for the gcc internal header files not -I,
> > but I just tested experimental branch with -I instead of -isystem and
> > also compiles cleanly (except the usual grub.texi warnings)
> 
> Seems fine.  Thanks for investigating this.

You're welcome.
I commited this now except that I used now $TARGET_CC.
Makes more sense inside TARGET_CPPFLAGS.


-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-11-15 12:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-26 16:16 [PATCH] Add -nostdinc to TARGET_CFLAGS Robert Millan
2009-10-28 23:16 ` Robert Millan
2009-10-29 10:14   ` Robert Millan
2009-10-29 10:36     ` Robert Millan
2009-10-29 10:46       ` Vladimir 'phcoder' Serbinenko
2009-10-30 18:55         ` Robert Millan
2009-11-04 10:48       ` Felix Zielcke
2009-11-14 21:16         ` Felix Zielcke
2009-11-15 11:04           ` Robert Millan
2009-11-15 11:12             ` Robert Millan
2009-11-15 11:19               ` Felix Zielcke
2009-11-15 11:17             ` Felix Zielcke
2009-11-15 11:35               ` Robert Millan
2009-11-15 11:50                 ` Felix Zielcke
2009-11-15 12:32                   ` Robert Millan
2009-11-15 12:42                     ` Felix Zielcke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.