[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191022085709.GI28442@gate.crashing.org>
Date: Tue, 22 Oct 2019 03:57:09 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Nathan Chancellor <natechancellor@...il.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
clang-built-linux <clang-built-linux@...glegroups.com>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/3] powerpc/prom_init: Use -ffreestanding to avoid a reference to bcmp
On Mon, Oct 21, 2019 at 10:15:29PM -0700, Nathan Chancellor wrote:
> On Fri, Oct 18, 2019 at 03:02:10PM -0500, Segher Boessenkool wrote:
> > I think the proper solution is for the kernel to *do* use -ffreestanding,
> > and then somehow tell the kernel that memcpy etc. are the standard
> > functions. A freestanding GCC already requires memcpy, memmove, memset,
> > memcmp, and sometimes abort to exist and do the standard thing; why cannot
> > programs then also rely on it to be the standard functions.
> >
> > What exact functions are the reason the kernel does not use -ffreestanding?
> > Is it just memcpy? Is more wanted?
>
> I think Linus summarized it pretty well here:
>
> https://lore.kernel.org/lkml/CAHk-=wi-epJZfBHDbKKDZ64us7WkF=LpUfhvYBmZSteO8Q0RAg@mail.gmail.com/
GCC recognises __builtin_memcpy (or any other __builtin) just fine even
with -ffreestanding.
So the kernel wants a warning (or error) whenever a call to one of these
library functions is generated by the compiler without the user asking
for it directly (via a __builtin)? And that is all that is needed for
the kernel to use -ffreestanding?
That shouldn't be hard. Anything missing here?
Segher
Powered by blists - more mailing lists