public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] x86: Import the glibc memset implementation
Date: Wed, 9 Nov 2011 13:12:15 -0600	[thread overview]
Message-ID: <4EBAD08F.1080103@freescale.com> (raw)
In-Reply-To: <201111082355.17605.vapier@gentoo.org>

On 11/08/2011 10:55 PM, Mike Frysinger 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".

Plus, libgcc is closely bound to compiler internals.

> 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

IMHO it's reasonable for the compiler to want a way to report fatal
errors from its runtime -- define it in the linker script as NULL, or
point it at some existing exception/error code, if you don't want to
spend the few bytes on a stub implementation (though we typically spend
a bunch more bytes on exception vectors to handle similar errors...).

The environmental requirements of the compiler (which could come from
either libgcc or directly generated code) are documented in section 2.1
of the GCC manual:

>  Most of the compiler support routines used by GCC are present in
> `libgcc', but there are a few exceptions.  GCC requires the
> freestanding environment provide `memcpy', `memmove', `memset' and
> `memcmp'.  Finally, if `__builtin_trap' is used, and the target does
> not implement the `trap' pattern, then GCC will emit a call to `abort'.

The "if __builtin_trap is used" clause should be removed if libgcc uses
__builtin_trap() (or otherwise calls abort()), though.

> (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.

Last I tried, I couldn't get it to work even with USE_PRIVATE_LIBGCC,
because the compiler was generating calls to things that U-Boot didn't
implement.

-Scott

  parent reply	other threads:[~2011-11-09 19:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08  9:59 [U-Boot] [PATCH] Import the glibc implementation of x86 memset into u-boot Gabe Black
2011-11-08 13:49 ` Mike Frysinger
2011-11-08 22:40 ` [U-Boot] [PATCH v2] x86: Import the glibc memset implementation Gabe Black
2011-11-09  0:45   ` Graeme Russ
2011-11-09  0:59     ` Gabe Black
2011-11-09  1:10       ` Graeme Russ
2011-11-09  1:15         ` Gabe Black
2011-11-09  1:25           ` Graeme Russ
2011-11-09  1:52             ` Gabe Black
2011-11-09  2:53               ` Graeme Russ
2011-11-09  4:55                 ` Mike Frysinger
2011-11-09  4:04                   ` Gabe Black
2011-11-09 19:12                   ` Scott Wood [this message]
2011-11-09 20:47                     ` Mike Frysinger
2011-11-12  6:19                       ` Gabe Black
2011-11-12  9:20                         ` Graeme Russ
2011-11-09  6:01                 ` Graeme Russ
2011-11-09  5:36             ` Wolfgang Denk
2011-11-09  5:50               ` Graeme Russ
2011-11-12 10:28 ` [U-Boot] [PATCH] Import the glibc implementation of x86 memset into u-boot Graeme Russ
2011-11-13  3:00   ` [U-Boot] [PATCH v3] x86: Import the glibc memset implementation Gabe Black
2011-11-13 11:38     ` Graeme Russ
2011-11-14 12:38       ` Gabe Black
2011-11-14 21:49         ` Graeme Russ
2011-11-15  0:42           ` Gabe Black
2011-11-15  0:47           ` [U-Boot] [PATCH v4] " Gabe Black
2011-11-30 11:05             ` Graeme Russ
2011-11-14 16:48       ` [U-Boot] [PATCH v3] " Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EBAD08F.1080103@freescale.com \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox