newlib and h8300s

Jeff Johnston jjohnstn@redhat.com
Thu Nov 16 20:17:00 GMT 2006


George Gallant wrote:
> Jeff,
> 
> The problem is the "C" functions are generated with parameters passed on
> the stack while the "S" functions use registers er0-er3. The default
> 4.1.1 compiler is stack based so the half dozen "S" function calls fail.
> Adding the "-mquickcall" makes my app work with the "S" functions and fail
> with the "C" functions.
> 

Does -mquickcall turn on a compile-time flag that can be checked?  If 
not, one should probably be added so that either a configuration check 
can be done so as not to build those overriding .S routines or to allow 
an alternate piece of assembler code in the .S routine to be compiled.

> My current solution is to generate newlib with "CFLAGS=-mquickcall". Another
> solution (perhaps better) would be to make the default compiler be
> QUICKCALL. As we no not need leading underscores and a compiler tends to be
> used for a long time, compiler mods are ok.
>

Another option is to make a multilib based on -mquickcall.  With a 
multilib option, newlib gets built with and without the option and the 
appropriate newlib library gets linked based on whether the end-user 
specifies the -mquickcall option or not.  Adding a multilib is done via 
a gcc change.

-- Jeff J.

> George
> 
> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org] On
> Behalf Of Jeff Johnston
> Sent: Wednesday, November 15, 2006 2:40 PM
> To: George Gallant
> Cc: newlib@sourceware.org
> Subject: Re: newlib and h8300s
> 
> George Gallant wrote:
>> I have built newlib-1.14.0 on both Linux and cygwin. Both cases seem
>> identical. The problem I am facing is that some of the memxxx and strxxx
>> functions are built using the registers er0-er2 while others are using the
>> stack. libc.a contains a mixture.
>>
>> George
>>
> 
> George,
> 
>    You'll have to elaborate more.  This is a problem because...?  How 
> are you configuring?
> 
>    By default, there are generic C implementations of the ANSI string 
> functions found in libc/string.  A platform can override these routines 
> (and other ANSI functions) with specialized versions which can be 
> written in assembler or C.  These routines are placed in the 
> machine-specific or system-specific directores and must have the same 
> name as the generic copies so that they form the same object name when 
> compiled as the generic C versions (e.g. memset.S or memset.c).  At 
> build time, object files are gathered from the machine and sys 
> directories and they end up overwriting the objects created in the 
> various generic directories.  In the case of h8300, the machine 
> directory is libc/machine/h8300.  There you will find a few of the 
> string routines.  If you need more, feel free to add.  If those 
> implementations should not be built under your configurations, then we 
> can deal with that as well.
> 
> -- Jeff J.
> 



More information about the Newlib mailing list