public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/3692: gcc-3.0:  error in startup code crtbegin.o?
@ 2001-07-15  9:36 Urs Thuermann
  0 siblings, 0 replies; only message in thread
From: Urs Thuermann @ 2001-07-15  9:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3692
>Category:       other
>Synopsis:       gcc-3.0:  error in startup code. crtbegin.o?
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 15 09:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Urs Thuermann
>Release:        3.0
>Organization:
>Environment:
System: Linux isnogud 2.4.6 #21 Thu Jul 5 08:48:11 CEST 2001 i686 unknown
Architecture: i686

        
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /usr/src/gcc-3.0/configure --prefix=/usr/local/gnu --enable-shared --disable-nls --enable-languages=c++,f77
>Description:
        
I get a segmentation fault or illegal instruction in all programs
compiled with gcc-3.0.

Some more info, that might be relevant.  My primary compiler is still
egcs-1.1.2.  I have also install gcc-2.95.3 in /usr/local/gnu since
egcs-1.1.2 were rejected as too old when I tried to compile
glibc-2.2.3.

glibc-2.2.3 (and therefore ld-linux.so.2 and /usr/lib/crt*) was
compiled with gcc-2.95.3.

I have GNU binutils-2.11.2 compiled with egcs-1.1.2.

Then I installed gcc-3.0 in /usr/local/gnu using

    mkdir /usr/src/gcc-build; cd /usr/src/gcc-build
    /usr/src/gcc-3.0/configure --prefix=/usr/local/gnu --enable-shared -disable-nls \
	--enable-languages=c++,f77
    make bootstrap

The compile went without any problem.

All programs compiled with gcc-3.0 crash before reaching the main()
function:

    isnogud:src$ cat /proc/cpuinfo |grep model\ name
    model name      : Pentium II (Deschutes)
    isnogud:src$ cat foo.c
    int main(int argc, char **argv){}
    isnogud:src$ gcc-3.0 -ggdb -v foo.c -o foo
    Reading specs from /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
    Configured with: /usr/src/gcc-3.0/configure --prefix=/usr/local/gnu --enable-shared --disable-nls --enable-languages=c++,f77
    Thread model: single
    gcc version 3.0
     /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/cc1 -lang-c -v -iprefix /usr/local/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.0/ -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ foo.c -quiet -dumpbase foo.c -ggdb -version -o /tmp/ccJ0RwCa.s
    GNU CPP version 3.0 (cpplib) (i386 Linux/ELF)
    GNU C version 3.0 (i686-pc-linux-gnu)
    	    compiled by GNU C version 3.0.
    ignoring nonexistent directory "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include"
    ignoring nonexistent directory "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../../../i686-pc-linux-gnu/include"
    #include "..." search starts here:
    #include <...> search starts here:
     /usr/local/include
     /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/include
     /usr/local/gnu/i686-pc-linux-gnu/include
     /usr/include
    End of search list.
     as --traditional-format -V -Qy -o /tmp/ccwiGVud.o /tmp/ccJ0RwCa.s
    GNU assembler version 2.11.2 (i686-pc-linux-gnu) using BFD version 2.11.2
     /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o foo /usr/lib/crt1.o /usr/lib/crti.o /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/crtbegin.o -L/usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0 -L/usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../.. /tmp/ccwiGVud.o -lgcc -lc -lgcc /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/crtend.o /usr/lib/crtn.o
    isnogud:src$ ./foo
    Illegal instruction (core dumped)
    isnogud:src$ gdb foo core
    GNU gdb 5.0
    Copyright 2000 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i686-pc-linux-gnu"...
    Core was generated by `./foo'.
    Program terminated with signal 4, Illegal instruction.
    Reading symbols from /lib/libc.so.6...done.
    Loaded symbols for /lib/libc.so.6
    Reading symbols from /lib/ld-linux.so.2...done.
    Loaded symbols for /lib/ld-linux.so.2
    #0  0x804822b in _init ()
    (gdb) bt
    #0  0x804822b in _init ()
    #1  0x4003d7c1 in __libc_start_main () from /lib/libc.so.6
    (gdb) quit

However, if I use the ctrbegin.o and crtend.o from egcs-1.1.2, the
program runs ok:

    isnogud:src$ gcc-3.0 -S -ggdb foo.c -o foo.s
    isnogud:src$ as --traditional-format -V -Qy -o foo.o foo.s
    GNU assembler version 2.11.2 (i686-pc-linux-gnu) using BFD version 2.11.2
    isnogud:src$ /usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o foo /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/crtbegin.o -L/usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0 -L/usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../.. foo.o -lgcc -lc -lgcc /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/crtend.o /usr/lib/crtn.o
    isnogud:src$ ./foo
    isnogud:src$ 

Interestingly, only using crtbegin.o from egcs and crtend.o from
gcc-3.0 does not help.  How is crtend.o used before main() returns?

When the program uses printf() it does a segmentation fault instead of
illegal instruction (also before main() is even entered):

    isnogud:src$ cat bar.c
    int main(int argc, char **argv){ printf("hello\n"); }
    isnogud:src$ gcc-3.0 bar.c -o bar
    isnogud:src$ ./bar
    Segmentation fault (core dumped)
    



>How-To-Repeat:

echo "int main(){}" >foo.c; gcc-3.0 foo.c -o foo; ./foo
        
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-07-15  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-15  9:36 other/3692: gcc-3.0: error in startup code crtbegin.o? Urs Thuermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).