[U-Boot] [PATCH v2] x86: Import the glibc memset implementation
Gabe Black
gabeblack at chromium.org
Wed Nov 9 05:04:22 CET 2011
On Tue, Nov 8, 2011 at 8:55 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Tuesday 08 November 2011 21:53:04 Graeme Russ wrote:
> > Oops, I meant U-Boot implements a subset of (g)libc. I think I understand
> > why - U-Boot needs specific implementations of stdio (printf() and
> friends)
> > Because we need to implement _some_ of glibc, we need to implement all
> (or
> > at least all the functions we use) otherwise we will get all sorts of
> > symbol conflicts in the linker
>
> glibc assumes an OS. there's no way around that. u-boot doesn't have an
> OS,
> so it has never linked against glibc (ignoring the "sandbox" arch).
> libgcc is
> a different issue: it rarely (if ever) relies on an OS. it's largely pure
> math
> functions, so u-boot has historically used it since things "just worked".
>
> the reason for arm getting the private libgcc is because (1) newer
> versions of
> libgcc started to rely on the OS (see the whole
> libgcc-likes-to-call-abort())
> and (2) the ABI hell that ARM is currently in -- the hard/soft/vfp/etc...,
> and
> little vs big endian. it ends up being pretty hard to get a single sane
> arm
> toolchain to build all the u-boot arm targets.
>
> for most arches though, these libgcc issues don't come up, so they don't
> support the private libgcc option. i think wrapping the few bad funcs like
> coreboot does (i.e. Gabe's patch here) makes sense.
> -mike
>
I do understand what you (Graeme) are worried about and was initially
worried about the same thing myself, but people who have experience with
these sorts of things were of the opinion that it isn't a big problem.
I expect the regparm option is there for performance reasons. The i386 ABI
says that arguments should go on the stack, but performance is better if
they go in registers. X86 processors put a lot of effort into making the
stack fast since the ISA is register poor and has a lot of stack-centric
features, but apparently it's still not as fast as using registers.
Gabe
More information about the U-Boot
mailing list