What is the best way to add a target specific system header directory

Fiodar Stryzhniou via gcc-help gcc-help@gcc.gnu.org
Thu May 11 04:32:00 GMT 2017


Gcc may use variable for that like $GCC_TARGET_HEADERS=path1;path2. However gcc does nothing if variable empty.
Fiodar Stryzhniou

исходное сбщ
Тема: Re: What is the best way to add a target specific system header directory
От: Xi Ruoyao <ryxi@stu.xidian.edu.cn>
Дата: 09.05.2017 07.04

On 2017-05-08 19:46 +0100, Martin J. O'Riordan wrote:
> I am building GCC as a cross compiler for the Sparc Leon processor, it has
> been working well for me for several years and is currently at v6.3.0.
> 
> However, a recent change I want to make is to provide an additional
> non-standard system header directory to be searched when '<...>' is used,
> and this directory is located relative to the 'gcc' binary; in this case
> relative to:
> 
>     <wherever>/bin/triple-gcc

So you have to determine where the executable triple-gcc is.  For linux
we should readlink /proc/self/exe, but it's not portable.

> I have tried using '--with-native-system-header-dir' but this wants an
> absolute path.  I want to avoid redefining 'INCLUDE_DEFAULTS' with my own
> custom replacement.  Substituting for '/usr/include' is okay too, because
> the host version is not meaningful the context of cross compilation.
> 
> Any recommendations on how to configure for this, or should I add something
> (a '#define' for example) to 'gcc/gcc/config/sparc/sparc.h'?

It seems GCC doesn't have this functionality.  I think we have to implement
this ourselves.

> Thanks,
> 
>     MartinO
> 
> 
-- 
Xi Ruoyao <ryxi@stu.xidian.edu.cn>
School of Aerospace Science and Technology, Xidian University




More information about the Gcc-help mailing list