target/560: Solaris 8 x86 static code segfaults before main
rami.lehti@finland.sun.com
rami.lehti@finland.sun.com
Thu Sep 21 07:56:00 GMT 2000
>Number: 560
>Category: target
>Synopsis: Solaris 8 x86 static code segfaults before main
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Sep 21 07:56:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: rami.lehti@finland.sun.com
>Release: 2.95.2
>Organization:
>Environment:
Solaris 8 x86
>Description:
If you compile static code, any code, with gcc on Solaris 8
on x86 architecture, the resulting binary will segfault
before reaching user code.
To be more precise in _init ()
>How-To-Repeat:
# cat hello.c
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
};
# gcc -static -g -o hello hello.c
# ./hello
zsh: segmentation fault (core dumped) ./hello
# gdb ./hello core
GNU gdb 4.18
Copyright 1998 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 "i386-pc-solaris2.8"...
Core was generated by `./hello'.
Program terminated with signal 11, Segmentation Fault.
#0 0x8069815 in _init ()
(gdb) disass
Dump of assembler code for function _init:
0x8069800 <_init>: call 0x8050198 <frame_dummy>
0x8069805 <_init+5>: nop
0x8069806 <_init+6>: nop
0x8069807 <_init+7>: nop
0x8069808 <_init+8>: nop
0x8069809 <_init+9>: nop
0x806980a <_init+10>: nop
0x806980b <_init+11>: nop
0x806980c <_init+12>: nop
0x806980d <_init+13>: nop
0x806980e <_init+14>: nop
0x806980f <_init+15>: nop
0x8069810 <_init+16>: call 0x8050200 <_atexit_init>
0x8069815 <_init+21>: add %al,(%eax)
0x8069817 <_init+23>: add %al,(%eax)
0x8069819 <_init+25>: add %al,(%eax)
0x806981b <_init+27>: add %al,(%eax)
0x806981d <_init+29>: add %al,(%eax)
0x806981f <_init+31>: add %ch,%al
0x8069821 <_init+33>: xchg %edi,%edi
0x8069823 <_init+35>: (bad)
0x8069824 <_init+36>: call *0x90909090(%eax)
0x806982a <_init+42>: nop
0x806982b <_init+43>: nop
0x806982c <_init+44>: nop
0x806982d <_init+45>: nop
0x806982e <_init+46>: nop
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) inf reg
eax 0x0 0
ecx 0x808497c 134760828
edx 0x8047d80 134512000
ebx 0x0 0
esp 0x8047d5c 0x8047d5c
ebp 0x8047d74 0x8047d74
esi 0x0 0
edi 0x0 0
eip 0x8069815 0x8069815
eflags 0x10246 66118
cs 0x17 23
ss 0x1f 31
ds 0x1f 31
es 0x1f 31
fs 0x0 0
gs 0x0 0
(gdb) quit
#
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list