public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] x86: Do no use reparm as it break libgcc linkage
Date: Thu, 10 Nov 2011 19:23:41 -0500	[thread overview]
Message-ID: <201111101923.43701.vapier@gentoo.org> (raw)
In-Reply-To: <CALButC+vQRHEmi2Uw6jFs1eSEjWL+5i3NrzvGtrb5f1C7U7pMw@mail.gmail.com>

On Thursday 10 November 2011 17:53:06 Graeme Russ wrote:
> The biggest con with wrappers is that the proposed patch only wraps four
> functions. arch/arm/lib/ has private libgcc implementations for eight
> libgcc functions - I can only assume they are used somewhere.

i don't think you can look across arches like that.  arm provides a lot more 
libgcc funcs because it, like most RISC/embedded cpus, do not provide 
dedicated math insns in the ISA.  or the number of insns is so large, that 
creating a dedicated library func and emitting a function call makes more 
sense than emitting them inline.  x86 is a fairly "fat" ISA in that most math 
operations can be accomplished in single or a few insns, and is certainly 
better than emitting func calls to an external library.

in fact, building the current eNET board (the only x86 board) shows that it 
doesn't use *any* calls from libgcc:
	make PLATFORM_LIBGCC= eNET -j4

> The kicker
> is that if anyone uses a libgcc function which is not one of the four
> already wrapped, and they do not realise this and fail to wrap them
> themselves, no warning will be given by the compiler or linker. Now that
> unwrapped function may be in a rarely executed code path (as evidenced by
> the fact that this bug has been dormant for a year now). So you could have
> in-the-wild version of U-Boot which start exhibiting strange behaviour and
> nobody knows why

yes, but the better question is whether those funcs should be called in the 
first place

> The final (trivially small) con is the overhead added to these calls

this con is insignificant when weighed against the alternatives: not using 
regparm anywhere.  further, these funcs are rarely used, so you're talking 
about adding a minor amount of overhead to one or two call sites.

> Now if we use USE_PRIVATE_LIBGCC, unimplemented libgcc functions will
> result in link errors, so using an unimplemented libgcc will be obvious at
> build time - It may lead to a posting on the mailing list, but at least we
> won't have latent libgcc related bugs in-the-wild.

perhaps x86 should be setting PLATFORM_LIBGCC to nothing all the time.  the 
funcs Gabe wants to wrap are 64bit operations.  u-boot should not be doing 64-
bit operations.  that's why we have do_div().
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111110/1ed27e65/attachment.pgp 

  reply	other threads:[~2011-11-11  0:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08  9:27 [U-Boot] [PATCH] [x86] Wrap small helper functions from libgcc to avoid an ABI mismatch Gabe Black
2011-11-08 13:33 ` Mike Frysinger
2011-11-08 22:27   ` Gabe Black
2011-11-08 22:34 ` [U-Boot] [PATCH v2] x86: " Gabe Black
2011-11-08 23:14   ` Graeme Russ
2011-11-09  4:49     ` Mike Frysinger
2011-11-09  3:57       ` Graeme Russ
2011-11-09  5:34         ` Mike Frysinger
2011-11-17  9:01           ` [U-Boot] [PATCH v3] " Gabe Black
2011-11-17  9:13             ` Gabe Black
2011-11-30 11:03             ` Graeme Russ
2011-11-09  3:05   ` [U-Boot] [PATCH v2] " Graeme Russ
2011-11-09 10:32   ` [U-Boot] [RFC] x86: Do no use reparm as it break libgcc linkage Graeme Russ
2011-11-09 17:12     ` Mike Frysinger
2011-11-09 21:42       ` Graeme Russ
2011-11-10  4:13         ` Mike Frysinger
2011-11-10  4:22           ` Graeme Russ
2011-11-10  5:10             ` Graeme Russ
2011-11-10 17:15             ` Mike Frysinger
2011-11-10 22:53               ` Graeme Russ
2011-11-11  0:23                 ` Mike Frysinger [this message]
2011-11-11  1:23                   ` Graeme Russ
2011-11-11  1:40                     ` Mike Frysinger
2011-11-11  1:51                       ` Graeme Russ
2011-11-11  1:55                         ` Mike Frysinger
2011-11-11  1:59                           ` Graeme Russ
2011-11-11  2:10                             ` Gabe Black
2011-11-11  2:22                               ` Graeme Russ
2011-11-11  2:41                                 ` Gabe Black
2011-11-11  4:49                                   ` Graeme Russ
2011-11-11  5:04                                     ` Mike Frysinger
2011-11-11  5:16                                       ` Graeme Russ
2011-11-11 16:24                                         ` Mike Frysinger
2011-11-11  2:44                             ` Mike Frysinger
2011-11-11 19:59                           ` Scott Wood
2011-11-16 23:00     ` Graeme Russ

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=201111101923.43701.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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