Messages in this thread | | | Date | Tue, 22 Oct 2019 03:57:09 -0500 | From | Segher Boessenkool <> | 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
| |