ARM linux-2.6.8 build fail with gcc-3.4.x

Dan Kegel dank@kegel.com
Sun Sep 12 05:53:00 GMT 2004


[Background:
The fix for http://gcc.gnu.org/PR13169 added a new error message
"'regname' cannot be used in asm here".
http://gcc.gnu.org/ml/gcc/2004-01/msg01713.html described
one buglet this caused/exposed in glibc/mips.  Here's another in linux/arm.
Also, for what it's worth, http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01924.html
said "asms ought to be able to use the frame pointer reg when
-fomit-frame-pointer and other requirements like no alloca in the function are met".]

The vanilla linux kernel for ARM has a function get_fiq_regs() which
contains an asm which marks the high 8 registers (including r11,
the frame pointer under apcs) as clobbered to keep gcc from putting
any inputs there.  The kernel is not compiled with -fomit-frame-pointer,
so compilation fails with gcc-3.4.x with the error described below.
What's the right way to fix this?  The code in question is the 30 lines at
http://lxr.linux.no/source/arch/arm/kernel/fiq.c#L152
and I'd be happy to try to supply a cut-down testcase if needed.
Thanks for any tips.
- Dan

-------- Original Message --------
Subject: Re: arch/arm/kernel/fiq.c and gcc-3.4.1
Date: Sun, 12 Sep 2004 00:32:40 +0100
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Dan Kegel <dank@kegel.com>
CC: ARM Linux <linux-arm@lists.arm.linux.org.uk>
References: <41437DF3.3020802@kegel.com>

On Sat, Sep 11, 2004 at 03:36:35PM -0700, Dan Kegel wrote:
> Building the 2.6 kernel for arm with gcc-3.4.1 fails with
>  > >>  CC      arch/arm/kernel/fiq.o
>  > >>arch/arm/kernel/fiq.c: In function `set_fiq_regs':
>  > >>arch/arm/kernel/fiq.c:126: error: fp cannot be used in asm here
> 
> This is apparantly because APCS defines r11 as the frame pointer,
> but set_fiq_regs in fiq.c is marking r11 as a clobber, which
> gcc-3.4.1 doesn't like.
> 
> See http://sources.redhat.com/ml/crossgcc/2004-09/msg00009.html
> for the first report, and
> http://nic.funet.fi/pub/Linux/PEOPLE/Linus/v2.2/patch-html/patch-2.2.18/linux_arch_arm_kernel_fiq.c.html
> for the patch that seems to have introduced the code in question.
> 
> Is it ok to fix this by removing r11 from the clobber list, or is
> that asking for trouble?

It's probably asking for trouble.

The thing is that the code isn't actually touching the frame pointer.
It just doesn't want any inputs to be in any of the high 8 registers
because if it were, the assembly breaks.  In fact, the comment there
is accurate, so gcc people should be able to see what's going on and
why it's needed without asking any questions.

Maybe someone needs to ask the gcc people precisely how the error is
generated - or maybe ask them for some replacement code which fits
their new restricted criteria while still maintaining code correctness.



-- 
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change



More information about the Gcc mailing list