Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-12 Thread Geert Uytterhoeven
On Thu, Apr 11, 2013 at 8:04 PM, Geert Uytterhoeven wrote: > On Wed, Apr 10, 2013 at 5:22 PM, Michal Marek wrote: >> Subject: [PATCH] m68k: Remove inline strlen() implementation >> >> GCC can replace a strncat() call with constant second argument into a >> strlen + store, which results in a link

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-11 Thread Geert Uytterhoeven
On Wed, Apr 10, 2013 at 5:22 PM, Michal Marek wrote: > Subject: [PATCH] m68k: Remove inline strlen() implementation > > GCC can replace a strncat() call with constant second argument into a > strlen + store, which results in a link error: > > ERROR: "strlen" [net/ipv4/ip_tunnel.ko] undefined! > >

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread Andi Kleen
> My understanding is, that with -fnobuiltin, the compiler is not allowed > to make assumptions about functions if it does not see their definition, > even if they resemble standard functions. E.g. on x86_64, strlen() is > out-of-line, so gcc would have to assume, that strcmp() has side > effects.

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread David Miller
From: Geert Uytterhoeven Date: Wed, 10 Apr 2013 11:24:39 +0200 > Without -ffreestanding, gcc may replace calls to standard C library > functions by calls to other standard C library functions and/or inline > code. This may cause link errors if the replacement code calls a standard > C library fu

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread Michal Marek
On Wed, Apr 10, 2013 at 04:19:14PM +0200, Geert Uytterhoeven wrote: > Thanks for the patch, but modpost still fails with > > ERROR: "strlen" [net/ipv4/ip_tunnel.ko] undefined! OK OK, I am convinced. Then how about this? If you prefer speed over size, the the other option is to add size_t strlen(

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread Geert Uytterhoeven
Hi Michal, On Wed, Apr 10, 2013 at 2:26 PM, Michal Marek wrote: > On Wed, Apr 10, 2013 at 12:59:44PM +0200, Geert Uytterhoeven wrote: >> On Wed, Apr 10, 2013 at 12:18 PM, Michal Marek wrote: >> > On 10.4.2013 11:24, Geert Uytterhoeven wrote: >> > My understanding is, that with -fnobuiltin, the c

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread Michal Marek
On Wed, Apr 10, 2013 at 12:59:44PM +0200, Geert Uytterhoeven wrote: > On Wed, Apr 10, 2013 at 12:18 PM, Michal Marek wrote: > > On 10.4.2013 11:24, Geert Uytterhoeven wrote: > > My understanding is, that with -fnobuiltin, the compiler is not allowed > > to make assumptions about functions if it do

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread Geert Uytterhoeven
On Wed, Apr 10, 2013 at 12:18 PM, Michal Marek wrote: > (Added Andi to CC) > > On 10.4.2013 11:24, Geert Uytterhoeven wrote: > [...] >> E.g. gcc turned >> >> strncat(name, "%d", 2); >> >> into a call to strlen() and a 16-bit store, causing a link failure, as >> arch/m68k/include/asm/string.h p

Re: [PATCH/RFC] m68k: Add -ffreestanding to KBUILD_CFLAGS

2013-04-10 Thread Michal Marek
(Added Andi to CC) On 10.4.2013 11:24, Geert Uytterhoeven wrote: [...] > E.g. gcc turned > > strncat(name, "%d", 2); > > into a call to strlen() and a 16-bit store, causing a link failure, as > arch/m68k/include/asm/string.h provides strlen() using a macro: > > ERROR: "strlen" [net/ipv4