------- Comment #6 from rob1weld at aol dot com  2007-08-02 17:18 -------
I can confirm this too. Here is the bug report I was to post - but I searched
to see if this was already reported ;) - Here are my notes:

tree-inline.c - sorry, unimplemented: inlining failed ... function body not
available

When compiling the kernel with GCC version 4.3.0 20070630 or 20070716 it seems
to remove (optimize away) functions which are needed. When GCC later discovers
it needs the function afterall it crys "function body not available" and
terminates the build with an error. 

This does not occur if I add "-O0" on the end of the command line. :(

I also do not have this problem when using GCC version 4.2.1 20070628 .


http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.22-rc2.tar.bz2

make V=1 vmlinux

...
/usr/test/bin/gcc -Wp,-MD,kernel/.futex.o.d  -nostdinc -isystem
/usr/test/lib/gcc/i686-pc-linux-gnu/4.3.0/include -D__KERNEL__ -Iinclude
-Iinclude2 -Ilinux-2.6.22-rc2-source/include -include include/linux/autoconf.h
-Ilinux-2.6.22-rc2-source/kernel -Ikernel -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -O2 -fprofile-arcs
-ftest-coverage -D__arch_um__ -DSUBARCH=\"i386\"
-Ilinux-2.6.22-rc2-source/arch/um/include -Iarch/um/include 
-Ilinux-2.6.22-rc2-source/arch/um/include 
-Ilinux-2.6.22-rc2-source/arch/um/include/skas -Dvmap=kernel_vmap
-Din6addr_loopback=kernel_in6addr_loopback -march=k8
-mpreferred-stack-boundary=2 -ffreestanding -D_LARGEFILE64_SOURCE
-Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask -Dmktime=kernel_mktime
-U__i386__ -Ui386 -fno-unit-at-a-time -fno-omit-frame-pointer
-fno-optimize-sibling-calls -g -fno-stack-protector
-Wdeclaration-after-statement -Wno-pointer-sign  -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(futex)"  
-D"KBUILD_MODNAME=KBUILD_STR(futex)" -c -o kernel/.tmp_futex.o
linux-2.6.22-rc2-source/kernel/futex.c

linux-2.6.22-rc2-source/kernel/futex.c: In function 'futex_requeue_pi':
linux-2.6.22-rc2-source/kernel/futex.c:272: sorry, unimplemented: inlining
failed in call to 'get_futex_key_refs': function body not available
linux-2.6.22-rc2-source/kernel/futex.c:908: sorry, unimplemented: called from
here
make[2]: *** [kernel/futex.o] Error 1
make[1]: *** [kernel] Error 2
make: *** [vmlinux] Error 2
make: Leaving directory `linux-2.6.22-rc2-source'


The message comes from this file: gcc-4_3-trunk/gcc/tree-inline.c , line 2443:

          sorry ("inlining failed in call to %q+F: %s", fn, reason);
          sorry ("called from here");

and from here, /opt/gcc-4_3-trunk/gcc/diagnostic.def :
DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ")


The same problem occurs when compiling these files:
linux-2.6.22-rc2-source/mm/filemap.c
linux-2.6.22-rc2-source/fs/buffer.c
linux-2.6.22-rc2-source/fs/bio.c
linux-2.6.22-rc2-source/fs/block_dev.c
linux-2.6.22-rc2-source/fs/reiserfs/do_balan.c
linux-2.6.22-rc2-source/fs/reiserfs/namei.c
linux-2.6.22-rc2-source/fs/reiserfs/stree.c
linux-2.6.22-rc2-source/block/elevator.c
linux-2.6.22-rc2-source/block/ll_rw_blk.c
linux-2.6.22-rc2-source/net/ipv4/ip_output.c
linux-2.6.22-rc2-source/net/ipv4/igmp.c and
linux-2.6.22-rc2-source/include/net/dst.h
linux-2.6.22-rc2-source/net/ipv4/xfrm4_output.c and
linux-2.6.22-rc2-source/include/net/dst.h
linux-2.6.22-rc2-source/fs/udf/partition.c
linux-2.6.22-rc2-source/net/ipv4/ipvs/ip_vs_xmit.c
linux-2.6.22-rc2-source/net/ipv4/netfilter/nf_nat_rule.c
linux-2.6.22-rc2-source/net/ipv6/ip6_output.c
linux-2.6.22-rc2-source/net/ipv6/ip6_input.c
linux-2.6.22-rc2-source/net/ipv6/ndisc.c
linux-2.6.22-rc2-source/net/ipv6/mcast.c


I tried this line in the kernel Makefile but still got the same error message:
CFLAGS_futex.o += $(call cc-ifversion, -ge, 0403, -fno-inline)

I would have preferred if that had worked rather than resorting to "-O0" since
there are so many files affected by this issue.


I worked around this problem by editing
"linux-2.6.22-rc2-source/kernel/Makefile" (and all the other makefiles) by
adding this sort of line near the top of the Makefile:

CFLAGS_futex.o += $(call cc-ifversion, -ge, 0403, -O0)


That allows the kernel to build with GCC 4.3 but does not "fix" GCC itself.


Here is the minimum command line to trigger the problem:

gcc -O1 -fno-unit-at-a-time -c -o futex.o futex.i 
linux-2.6.22-rc2-source/kernel/futex.c: In function 'futex_requeue_pi':
linux-2.6.22-rc2-source/kernel/futex.c:272: sorry, unimplemented: inlining
failed in call to 'get_futex_key_refs': function body not available
linux-2.6.22-rc2-source/kernel/futex.c:908: sorry, unimplemented: called from
here

If I use "-O0" or leave off "-fno-unit-at-a-time" I don't get the error. These
options are what are present in the kernel's makefile (not my preferences). The
kernel's makefiles are written in a particular way to allow various other
features
to work (so a full overhaul of the all makefiles is out (for me)). If this is
not a problem with GCC 4.3 but instead an issue with the way Linux was written
then we can't expect to be compiling Linux with GCC 4.3 any time soon.


The kernel's makefile options do work with 4.2.1 and (recent) earlier versions
of GCC.


I will enclose the ".i" file.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31886

Reply via email to