public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* best practices on gcc building host tool for cross arch
@ 2007-01-12 18:21 tmike
  2007-01-14 19:13 ` Michael Eager
  0 siblings, 1 reply; 4+ messages in thread
From: tmike @ 2007-01-12 18:21 UTC (permalink / raw)
  To: gcc-help


Folks,

I am trying to build a simple elf file parsing tool.
Tool runs on a host, but wants to be able to parse core files
from embedded architectures.
host = x86
embedded = arm

In order to parse the embedded core file, the tool needs to see
and read the embedded kernel header files.

I would guess a version of gdb that runs on a host and debugs
a different target has similar issues.

Are there any "best-practices" for configuring/building/using gcc
in this manner?

This isn't strictly a "cross-compilation" build of gcc.
Cheers,
T.mike

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

* Re: best practices on gcc building host tool for cross arch
  2007-01-12 18:21 best practices on gcc building host tool for cross arch tmike
@ 2007-01-14 19:13 ` Michael Eager
  2007-01-15 18:15   ` T Michael Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Eager @ 2007-01-14 19:13 UTC (permalink / raw)
  To: tmike; +Cc: gcc-help

tmike@recipes4linux.com wrote:
> 
> Folks,
> 
> I am trying to build a simple elf file parsing tool.
> Tool runs on a host, but wants to be able to parse core files
> from embedded architectures.
> host = x86
> embedded = arm
> 
> In order to parse the embedded core file, the tool needs to see
> and read the embedded kernel header files.
> 
> I would guess a version of gdb that runs on a host and debugs
> a different target has similar issues.
> 
> Are there any "best-practices" for configuring/building/using gcc
> in this manner?
> 
> This isn't strictly a "cross-compilation" build of gcc.
> Cheers,
> T.mike

Hi --

I don't see why you believe that this has anything to do
with building gcc.

If your program which parses core files needs headers from
the target kernel, you can reference them in your source.
Rather than "#include <stdio.h>" which would get the host
definitions, put "#include "<target>/usr/include/stdio.h"" in
the source for your parser, where <target> is the path to a
copy of the target's root directory tree.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

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

* RE: best practices on gcc building host tool for cross arch
  2007-01-14 19:13 ` Michael Eager
@ 2007-01-15 18:15   ` T Michael Turney
  2007-01-15 18:32     ` Michael Eager
  0 siblings, 1 reply; 4+ messages in thread
From: T Michael Turney @ 2007-01-15 18:15 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-help


Hi Michael,
Thanks for the suggestion, which I had considered and tried already.
The problem is that while I can directly include the top-level file,
say elfcore.h, the files it includes will come from the host kernel
and not the target kernel.

Certainly one of the approaches I can take is to maintain a second
copy of the target kernel header files that I need access to for this
tool, and make sure they include from the target area.

I was hoping there was a more 'elegant' solution.
You may be right about gcc-help not being the best mailing list,
I will pose the question on the gdb list as well.
Cheers,
T.mike

> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
> Behalf Of Michael Eager
> Sent: Sunday, January 14, 2007 11:13 AM
> To: tmike@recipes4linux.com
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: best practices on gcc building host tool for cross arch
> 
> 
> tmike@recipes4linux.com wrote:
> > 
> > Folks,
> > 
> > I am trying to build a simple elf file parsing tool.
> > Tool runs on a host, but wants to be able to parse core files
> > from embedded architectures.
> > host = x86
> > embedded = arm
> > 
> > In order to parse the embedded core file, the tool needs to see
> > and read the embedded kernel header files.
> > 
> > I would guess a version of gdb that runs on a host and debugs
> > a different target has similar issues.
> > 
> > Are there any "best-practices" for configuring/building/using gcc
> > in this manner?
> > 
> > This isn't strictly a "cross-compilation" build of gcc.
> > Cheers,
> > T.mike
> 
> Hi --
> 
> I don't see why you believe that this has anything to do
> with building gcc.
> 
> If your program which parses core files needs headers from
> the target kernel, you can reference them in your source.
> Rather than "#include <stdio.h>" which would get the host
> definitions, put "#include "<target>/usr/include/stdio.h"" in
> the source for your parser, where <target> is the path to a
> copy of the target's root directory tree.
> 
> -- 
> Michael Eager	 eager@eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306  650-325-8077
> 

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

* Re: best practices on gcc building host tool for cross arch
  2007-01-15 18:15   ` T Michael Turney
@ 2007-01-15 18:32     ` Michael Eager
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Eager @ 2007-01-15 18:32 UTC (permalink / raw)
  To: T Michael Turney; +Cc: gcc-help

T Michael Turney wrote:
> Hi Michael,
> Thanks for the suggestion, which I had considered and tried already.
> The problem is that while I can directly include the top-level file,
> say elfcore.h, the files it includes will come from the host kernel
> and not the target kernel.

Take a look at the -nostdinc and -isystem options.

> Certainly one of the approaches I can take is to maintain a second
> copy of the target kernel header files that I need access to for this
> tool, and make sure they include from the target area.

Your target headers need to be somewhere accessible to the compiler.
There's no magic way that the compiler will know what they contain.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

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

end of thread, other threads:[~2007-01-15 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-12 18:21 best practices on gcc building host tool for cross arch tmike
2007-01-14 19:13 ` Michael Eager
2007-01-15 18:15   ` T Michael Turney
2007-01-15 18:32     ` Michael Eager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).