Building an XIP application on arm-elf

Jeff Johnston jjohnstn@redhat.com
Fri Feb 24 19:55:00 GMT 2006


Shaun Jackman wrote:
> Hello Jeff,
> 
> On 2/23/06, Jeff Johnston <jjohnstn@redhat.com> wrote:
> 
>>Newlib can only be coerced to build two or more versions of libc.a in
>>the same build tree through a multilib option.  A multilib solution also
>>automatically takes care of libgcc.a and any other target libraries for you.
> 
> 
> multilib does seem like a good way to build a PIC libc.a. Which files
> would I need to modify to add a 'pic' multilib that adds -fPIC to
> TARGET_CFLAGS?
> 

If you have gcc checked out, take a look at gcc/gcc/config/arm/t-arm-elf

You specify options plus directory names.  You can also specify 
exceptions (i.e. combinations that should not be built).  For example, 
you might not be interested in permutating thumb with -fPIC in your case.

> 
>>Yes, the arm-linux configuration knows to add -fPIC, but not arm-elf, if
>>I read the gcc/config/arm files correctly.  I'm not sure how you
>>override the target flags in this case.
> 
> 
> Does arm-linux build libc.a as PIC by default as well, or is only
> libc.so compiled as PIC? I get the impression that a statically linked
> PIC executable is a rather unusual request, and untrodden ground.
> 

The arm-linux configured gcc compiler adds the -fPIC option by default 
when building libgcc.  Look at t-linux in the same directory as 
t-arm-elf above.

> Thanks,
> Shaun



More information about the Newlib mailing list