[PATCH] Always inline system calls

Paul Mundt lethal at linux-sh.org
Mon Dec 3 22:07:47 UTC 2007


On Mon, Dec 03, 2007 at 10:33:39PM +0100, Carmelo Amoroso wrote:
> Carmelo Amoroso wrote:
> while doing some test for SH4 to measure size increase for 'always inline' changes,
> doscovered suddenly that gcc-4.1.1 (cross sh4) fails with the following error:
> 
> ../ldso/ldso/dl-elf.c: In function '_dl_dprintf':
> ../ldso/ldso/dl-elf.c:858: error: unable to find a register to spill in class 'R0_REGS'
> ../ldso/ldso/dl-elf.c:858: error: this is the insn:
> (insn 916 917 24 1 (set (reg/f:SI 1 r1 [219])
>          (mem/u/c:SI (plus:SI (reg:SI 12 r12)
>                  (reg/f:SI 1 r1 [220])) [0 S4 A32])) 172 {movsi_ie} (nil)
>      (expr_list:REG_DEAD (reg/f:SI 1 r1 [220])
>          (expr_list:REG_EQUIV (symbol_ref:SI ("_dl_pagesize") <var_decl 0x313a720 _dl_pagesize>)
>              (nil))))
> 
> either running with -Os or -O0.
> I'll test tomorrow with gcc-4.2.1 to see if it makes difference,
> otherwise I suspect we should go back on my proposal in using always inline
> only for arch strictly requiring it.
> 
We've noticed this with some versions in buildroot also, so it seems to
be a more common issue:

	 CC ldso/ldso/ldso.oS
	  In file included from ./libpthread/linuxthreads.old/sysdeps/sh/tls.h:23,
	from ./include/bits/uClibc_errno.h:35,
	from ./include/errno.h:62,
	from ./include/bits/syscalls.h:16,
	from ./include/sys/syscall.h:34,
	from ./ldso/ldso/sh/dl-syscalls.h:3,
	from ./ldso/include/dl-syscall.h:12,
	from ./ldso/include/ldso.h:36,
	from ldso/ldso/ldso.c:33:
	./libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h:36: warning: C99 inline functions are not supported; using GNU89
	./libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h:36: warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
	ldso/ldso/dl-elf.c: In function '_dl_dprintf':
	ldso/ldso/dl-elf.c:803: error: unable to find a register to spill in class 'R0_REGS'
	ldso/ldso/dl-elf.c:803: error: this is the insn:
	(insn 884 885 23 3 (set (reg/f:SI 1 r1 [221])
		(mem/u/c:SI (plus:SI (reg:SI 12 r12)
			(reg/f:SI 1 r1 [222])) [0 S4 A32])) 171 {movsi_ie} (nil)
		(expr_list:REG_DEAD (reg/f:SI 1 r1 [222])
			(expr_list:REG_EQUIV (symbol_ref:SI ("_dl_pagesize") <var_decl 0x402d7660 _dl_pagesize>)
				(nil))))
	ldso/ldso/dl-elf.c:803: confused by earlier errors, bailing out
	make[1]: *** [ldso/ldso/ldso.oS] Error 1

So inlining itself may not really be a problem, but it might be worthwhile
hunting down the code that generates the immediate load and seeing if that can
be forced in to a memory access instead, so we avoid the R0 encoding dependence.
These are all in relation to _dl_pagesize at least.



More information about the uClibc mailing list