This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
egcs on UnixWare 2.1.2
- To: egcs at cygnus dot com
- Subject: egcs on UnixWare 2.1.2
- From: acs at acm dot org
- Date: Wed, 19 Nov 1997 00:57:55 -0500
Executive Summary: #undef HAVE_ATEXIT in i386/sys4.h prevents
my hello world program from dumping core.
The egcs distributions have been broken for me since late September
on UnixWare 2.1.2. A hello world progam would dump core after
having been compiled with the stage1 compiler.
Here is the source code:
(BTW, the _exit() call inhibited the core dump, when it was
enabled.)
#include <stdio.h>
main()
{
printf("Hello world!\n");
/*_exit(0); */
}
Here's how I compile it:
: ~ Wed 19 0:26; ./egcs-971114/gcc/xgcc -B./egcs-971114/gcc/ -v -g x.c
Reading specs from ./egcs-971114/gcc/specs
gcc version egcs-2.90.17 971114 (gcc2-970802 experimental)
./egcs-971114/gcc/cpp -lang-c -v -isystem ./egcs-971114/gcc/include -undef -D__GNUC__=2 -D__GNUC_MINOR__=90 -Di386 -Dunix -D__svr4__ -D__i386__ -D__unix__ -D__svr4__ -D__i386 -D__unix -Asystem(unix) -Asystem(svr4) -Acpu(i386) -Amachine(i386) -g x.c /var/tmp/cca001-h.i
GNU CPP version egcs-2.90.17 971114 (gcc2-970802 experimental) (i386 System V Release 4)
#include "..." search starts here:
#include <...> search starts here:
egcs-971114/gcc/include
/usr/local/include
/usr/include
End of search list.
./egcs-971114/gcc/cc1 /var/tmp/cca001-h.i -quiet -dumpbase x.c -g -version -o /var/tmp/cca001-h.s
GNU C version egcs-2.90.17 971114 (gcc2-970802 experimental) (i386-pc-sysv4.2uw2.1.2) compiled by GNU C version egcs-2.90.06 970907 (gcc2-970802 experimental).
./egcs-971114/gcc/as -V -Qy -o /var/tmp/cca001-h1.o /var/tmp/cca001-h.s
GNU assembler version 970731 (i386-pc-sysv4.2uw2.1.2), using BFD version linux-2.8.1.0.15
./egcs-971114/gcc/ld -V -Y P,/usr/ccs/lib:/usr/lib -Qy /usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o ./egcs-971114/gcc/crtbegin.o -L./egcs-971114/gcc -L/usr/ccs/bin -L/usr/ccs/lib /var/tmp/cca001-h1.o -lgcc -lc -lgcc ./egcs-971114/gcc/crtend.o /usr/ccs/lib/crtn.o
UX:ld: INFO: Optimizing C Compilation System (CCS) 3.0 12/10/95 (eiger8)
: ~ Wed 19 0:27; ./a.out
Hello world!
zsh: IOT instruction (core dumped) ./a.out
Now, here's what happens when I run gdb on the executable:
: ~ Wed 19 0:28; gdb ./a.out
GDB is free software and you are welcome to 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.
GDB 4.15 (unixware2), Copyright 1995 Free Software Foundation, Inc...
(gdb) b __do_global_dtors_aux
Breakpoint 1 at 0x8048501
(gdb) run
Starting program: /home/acs/./a.out
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to process 6533]
Hello world!
Breakpoint 1, 0x8048501 in __do_global_dtors_aux ()
(gdb) bt
#0 0x8048501 in __do_global_dtors_aux ()
#1 0x8049035 in _fini ()
(gdb) cont
Continuing.
Breakpoint 1, 0x8048501 in __do_global_dtors_aux ()
(gdb) bt
#0 0x8048501 in __do_global_dtors_aux ()
#1 0x8049035 in _fini ()
(gdb) cont
Continuing.
Program received signal SIGABRT, Aborted.
0xbffb3783 in kill ()
(gdb) q
The program is running. Quit anyway (and kill it)? (y or n) y
As I wrote, the *second* time through __do_global_dtors_aux is when it
dies. (Note, I never said that there were *nested* calls to
__do_global_dtors_aux.)
After I added #undef'ed HAVE_ATEXIT in i386/sys4.h, my hello world
program no dumps core. It also no longer calls
__do_global_dtors_aux, as you can see here:
: ~ Wed 19 0:48; gdb ./a.out
GDB is free software and you are welcome to 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.
GDB 4.15 (unixware2), Copyright 1995 Free Software Foundation, Inc...
(gdb) b __do_global_dtors_aux
Breakpoint 1 at 0x8048835
(gdb) run
Starting program: /home/acs/./a.out
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to process 18277]
Hello world!
Program exited with code 015.
(gdb) q
Thanks for the help. I'm not sure if this is the correct fix, but it
certainly has gotten me back on track.
vin shelton