[klibc] [klibc 04/31] alpha support for klibc

H. Peter Anvin hpa at zytor.com
Wed Jun 28 08:51:56 PDT 2006

Richard Henderson wrote:
> On Tue, Jun 27, 2006 at 10:17:04PM -0700, H. Peter Anvin wrote:
>> +# Special CFLAGS for the divide code
>> +	-O3 -fomit-frame-pointer -fcall-saved-1 -fcall-saved-2 \
>> +	-fcall-saved-3 -fcall-saved-4 -fcall-saved-5 -fcall-saved-6 \
>> +	-fcall-saved-7 -fcall-saved-8 -ffixed-15 -fcall-saved-16 \
>> +	-fcall-saved-17 -fcall-saved-18 -fcall-saved-19 -fcall-saved-20 \
>> +	-fcall-saved-21 -fcall-saved-22 -ffixed-23 -fcall-saved-24 \
>> +	-ffixed-25 -ffixed-27
> These routines absolutely cannot be written in C.  The return value
> goes in a different register, which you cannot modify via compiler
> flags.  Please use the hand-coded assembly from linux/arch/alpha/lib/.

Funny, we had this discussion a couple of years ago...

What the above does is generate a calling convention with the right 
number of (various types of) registers.  Then the Makefile swaps the 
registers that the compiler outputs.  It's a bit of a hack, but it's 
reliable and works.  The resulting code isn't as compact at divide.S, 

However, I've tried to keep the code under the BSD license, mostly for 
the benefit of the standalone klibc version (static linkage being the 
norm, after all); so I don't want to crib kernel code unless the owner 
consents to relicensing.  I have cribbed some NetBSD code in some 
places, though.


More information about the klibc mailing list