User account creation filtered due to spam.

Bug 39641 - Compiling Linux ends with a segfault on net/core/skbuff.c
Summary: Compiling Linux ends with a segfault on net/core/skbuff.c
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2009-04-04 22:22 UTC by Lasse Kliemann
Modified: 2009-04-23 06:42 UTC (History)
1 user (show)

See Also:
Target: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:

Preprocessed source file (161.89 KB, application/octet-stream)
2009-04-04 22:27 UTC, Lasse Kliemann
Kernel configuration which triggers the problem (12.26 KB, text/plain)
2009-04-04 22:29 UTC, Lasse Kliemann

Note You need to log in before you can comment on or make changes to this bug.
Description Lasse Kliemann 2009-04-04 22:22:52 UTC
Compiling Linux ends with a segfault.

I will attach preprocessed source files and kernel configuration file when I find out how to do this with this interface. Here is some information for now:

Configure switches for gcc (besides prefix):
--enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-checking --disable-werror --enable-bootstrap --enable-languages=c,c++

Thread model: posix

Command line:
gcc -Wp,-MD,net/core/.skbuff.o.d  -nostdinc -isystem /package/host/localhost/sepbuilt/gcc41-4.1.2-01-03/prefix/lib/gcc/i686-pc-linux-gnu/4.1.2/include -D__KERNEL__ -Iinclude  -I/fs/tmp/mount/tmp/linux- -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2 -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=i586 -mtune=i686 -Wa,-mtune=generic32 -ffreestanding -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Iarch/x86/include/asm/mach-default -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(skbuff)"  -D"KBUILD_MODNAME=KBUILD_STR(skbuff)"  -c -o net/core/skbuff.o net/core/skbuff.c

net/core/skbuff.c:2673: internal compiler error: Segmentation fault
Comment 1 Lasse Kliemann 2009-04-04 22:27:15 UTC
Created attachment 17588 [details]
Preprocessed source file

The file is over 1 MB when uncompressed.
Comment 2 Lasse Kliemann 2009-04-04 22:29:22 UTC
Created attachment 17589 [details]
Kernel configuration which triggers the problem

Maybe this can help.

The problem is _not_ triggered when using 'make defconfig'.
Comment 3 Lasse Kliemann 2009-04-05 15:19:44 UTC
Segfault does not occur when omitting '-ffreestanding'.

Segfault does not occur when using '-save-temps'.

When I add '-save-temps' to 'arch/x86/Makefile' in the same location in which '-ffreestanding' occurs, 'make' runs through. I have not tested whether the resulting kernel works.

Moreover, in that Makefile, it reads:

# temporary until string.h is fixed
KBUILD_CFLAGS += -ffreestanding

So, it appears that '-ffreestanding' is itself a workaround for something.

Another approach: obtain 'skbuff.i' via '-save-temps' and then copy it to 'net/core/skbuff.c'. Then 'make' will also run through.
Comment 4 Andrew Pinski 2009-04-22 23:39:14 UTC
Can you give the output of gcc -v?
Comment 5 Lasse Kliemann 2009-04-23 06:42:52 UTC
(In reply to comment #4)
> Can you give the output of gcc -v?

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /package/host/localhost/sepbuilt/gcc41-4.1.2-01-03/src/unpack/gcc-4.1.2/configure --prefix=/package/host/localhost/sepbuilt/gcc41-4.1.2-01-03/prefix --libexecdir=/package/host/localhost/sepbuilt/gcc41-4.1.2-01-03/prefix/libexec --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-checking --disable-werror --enable-bootstrap --enable-languages=c,c++
Thread model: posix
gcc version 4.1.2

By the way, this gcc was compiled roughly following the instructions from the HLFS project. In particular, this includes the following patches:

I can go and try to reproduce with a vanilla gcc, if that helps.