linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: kill off the libgcc dependency
Date: Wed, 14 Jan 2015 13:37:42 +0000	[thread overview]
Message-ID: <20150114133742.GI4050@arm.com> (raw)
In-Reply-To: <CAKv+Gu-E=0Fm7woFSWcdBLfmxB+5diGtO91c2zy-t2M1_NTNeg@mail.gmail.com>

On Wed, Jan 14, 2015 at 12:52:49PM +0000, Ard Biesheuvel wrote:
> On 14 January 2015 at 12:38, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Wednesday 14 January 2015 11:48:27 Will Deacon wrote:
> >> On Wed, Jan 14, 2015 at 11:35:22AM +0000, Arnd Bergmann wrote:
> >> > On Wednesday 14 January 2015 10:48:26 Will Deacon wrote:
> >> > > On Wed, Jan 14, 2015 at 10:38:54AM +0000, Kevin Hao wrote:
> >> > > > The arm64 doesn't depend on the libgcc to build the vmlinux image.
> >> > >
> >> > > Yes it does; we make use of __builtin_* for our bitops, for example.
> >> > > The compiler guys don't guarantee that these will be inlined.
> >> >
> >> > Is that an architecture-specific statement?
> >>
> >> I think the inlining guarantees apply to all architectures, but it affects
> >> the arm64 kernel because we include <asm-generic/bitops/builtin-*>.
> >
> > Is it realistic to expect those to ever be implemented out of line?
> > I would expect them to behave like assembler intrinsics, at least
> > with the normal optimization level.
> >
> >> > The debate has been going on for ages in Linux, most architecture
> >> > maintainers however decided against using libgcc and copy the functions
> >> > that are actually needed into the kernel sources.
> >>
> >> What's the benefit of copying them?
> >
> > You have a better control over what is included. On 32-bit architectures,
> > the 64-bit division is notorious here, we really don't want to accidentally
> > call the libgcc implementation but instead have our own do_div() helper.
> >
> > Similarly I'd think that if we get a compiler that uses an external
> > __ffs implementation, we should implement an inline assembly instead
> > of taking the libgcc version.
> >
> > Another problem that has happened in the past is libgcc functions that
> > in turn call glibc functions. To avoid that, you'd really want to build
> > the kernel with -ffreestanding, but that opens another can of worms.
> >
> 
> IMO libgcc.a cannot be used at all in the kernel, as it is not built
> with -mgeneral-regs-only so we have no guarantee that it will leave
> the NEON registers alone.

That's a very good point. In which case, we'd need to extend this patch
to implement the bitops that we currently rely on the __builtins for.

Will

  reply	other threads:[~2015-01-14 13:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 10:38 [PATCH] arm64: kill off the libgcc dependency Kevin Hao
2015-01-14 10:48 ` Will Deacon
2015-01-14 11:35   ` Arnd Bergmann
2015-01-14 11:48     ` Will Deacon
2015-01-14 12:38       ` Arnd Bergmann
2015-01-14 12:52         ` Ard Biesheuvel
2015-01-14 13:37           ` Will Deacon [this message]
2015-01-15  7:07             ` Kevin Hao
2015-01-15  9:59               ` Will Deacon
2015-01-15 11:21                 ` Ard Biesheuvel
2015-01-15 11:36                   ` Will Deacon
2015-01-14 14:39           ` Russell King - ARM Linux
2015-01-15  7:09             ` Kevin Hao

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=20150114133742.GI4050@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).