Re: [klibc 07/31] i386 support for klibc

H. Peter Anvin
2006-06-28T16:45:04Z

H. Peter Anvin wrote:
> Jan Engelhardt wrote:
>>> usr/klibc/arch/i386/libgcc/__ashldi3.S | 29 +++++++
>>> usr/klibc/arch/i386/libgcc/__ashrdi3.S | 29 +++++++
>>> usr/klibc/arch/i386/libgcc/__lshrdi3.S | 29 +++++++
>>> usr/klibc/arch/i386/libgcc/__muldi3.S | 34 ++++++++
>>> usr/klibc/arch/i386/libgcc/__negdi2.S | 21 +++++
>>
>> No divdi3?
>
> The i386 ones are a bit special... usually the reason I have added
> libgcc functions is that on some architectures, gcc has various problems
> linking with libgcc in some configurations. That is not the case on
> i386, but some of the libgcc functions are *way* bigger than the need to
> be (overall, the quality of code in libgcc seems horrid, across
> architectures.)
>
> Since i386 is such an important architecture I added a handful of
> assembly functions for stuff that could be done in a very small amount
> of space.
>

Correction... divdi3, moddi3, udivdi3, umoddi3 and udivmoddi4 are also
provided, but are implemented as generic subroutines in C instead of
assembly:

KLIBCARCHOBJS = \
arch/$(KLIBCARCH)/socketcall.o \
arch/$(KLIBCARCH)/setjmp.o \
arch/$(KLIBCARCH)/syscall.o \
arch/$(KLIBCARCH)/varsyscall.o \
arch/$(KLIBCARCH)/open.o \
arch/$(KLIBCARCH)/openat.o \
arch/$(KLIBCARCH)/sigreturn.o \
arch/$(KLIBCARCH)/vfork.o \
arch/$(KLIBCARCH)/libgcc/__ashldi3.o \
arch/$(KLIBCARCH)/libgcc/__ashrdi3.o \
arch/$(KLIBCARCH)/libgcc/__lshrdi3.o \
arch/$(KLIBCARCH)/libgcc/__muldi3.o \
arch/$(KLIBCARCH)/libgcc/__negdi2.o \
libgcc/__divdi3.o \
libgcc/__moddi3.o \
libgcc/__udivdi3.o \
libgcc/__umoddi3.o \
libgcc/__udivmoddi4.o

It probably would be more efficient if i386's native division
instructions could be exploited, but it hasn't been a pressing issue.

-hpa