Discussion:
SIGSEGV in pcc produced executables on linux/i686.
Gregory McGarry
2011-04-15 01:39:11 UTC
Permalink
Hi

The recent changes to crtbegin.c should fix this problem with binutils
2.21.



-------- Original Message --------
Subject: Re: SIGSEGV in pcc produced executables on linux/i686.
From: Ramil Farkhshatov <***@gmx.co.uk>
Date: Thu, February 24, 2011 11:57 am
Program received signal SIGSEGV, Segmentation fault.
0x00000001 in ?? ()
(gdb) bt full
#0 0x00000001 in ?? ()
No symbol table info available.
#1 0x08048307 in __do_global_ctors_aux ()
Try to disassemble the instruction here. You might hit a classic bug of
Linux in that it doesn't use SYSV ABI anymore, but requires stricter
stack aligned...
Here is the disassembly:
(gdb) disassemble
Dump of assembler code for function __do_global_ctors_aux:
0x080482b4 <+0>: push %ebp
0x080482b5 <+1>: mov %esp,%ebp
0x080482b7 <+3>: push %esi
0x080482b8 <+4>: push %ebx
0x080482b9 <+5>: cmpl $0x0,0x80494e8
0x080482c0 <+12>: jne 0x804830c <__do_global_ctors_aux+88>
0x080482c2 <+14>: movl $0x1,0x80494e8
0x080482cc <+24>: mov 0x8049400,%esi
0x080482d2 <+30>: cmp $0xffffffff,%esi
0x080482d5 <+33>: jne 0x80482f5 <__do_global_ctors_aux+65>
0x080482d7 <+35>: mov $0x1,%esi
0x080482dc <+40>: cmpl $0x0,0x8049404
0x080482e3 <+47>: je 0x80482f2 <__do_global_ctors_aux+62>
0x080482e5 <+49>: add $0x1,%esi
0x080482e8 <+52>: cmpl $0x0,0x8049400(,%esi,4)
0x080482f0 <+60>: jne 0x80482e5 <__do_global_ctors_aux+49>
0x080482f2 <+62>: sub $0x1,%esi
0x080482f5 <+65>: test %esi,%esi
0x080482f7 <+67>: je 0x804830c <__do_global_ctors_aux+88>
0x080482f9 <+69>: lea 0x8049400(,%esi,4),%ebx
0x08048300 <+76>: mov (%ebx),%eax
0x08048302 <+78>: sub $0x4,%ebx
0x08048305 <+81>: call *%eax
=> 0x08048307 <+83>: sub $0x1,%esi
0x0804830a <+86>: jne 0x8048300 <__do_global_ctors_aux+76>
0x0804830c <+88>: pop %ebx
0x0804830d <+89>: pop %esi
0x0804830e <+90>: pop %ebp
0x0804830f <+91>: ret
End of assembler dump.
(gdb) print $eax
$1 = 1
(gdb) print $esi
$2 = 1
(gdb) p/x $ebx
$3 = 0x8049400
(gdb) print/x ****@8
$30 = {0x1, 0x1, 0xc, 0x8048234, 0xd, 0x80483dc, 0x4, 0x8048148}

So I (with my limited knowledge on this matters) suspect that there is
something wrong with __CTOR_LIST__ since it contains two consecutive
0x00000001's.
Ramil Farkhshatov
2011-04-15 05:19:21 UTC
Permalink
Post by Gregory McGarry
Hi
The recent changes to crtbegin.c should fix this problem with binutils
2.21.
Yes, it does. Thanks.
Post by Gregory McGarry
-------- Original Message --------
Subject: Re: SIGSEGV in pcc produced executables on linux/i686.
Date: Thu, February 24, 2011 11:57 am
Program received signal SIGSEGV, Segmentation fault.
0x00000001 in ?? ()
(gdb) bt full
#0 0x00000001 in ?? ()
No symbol table info available.
#1 0x08048307 in __do_global_ctors_aux ()
Try to disassemble the instruction here. You might hit a classic bug of
Linux in that it doesn't use SYSV ABI anymore, but requires stricter
stack aligned...
(gdb) disassemble
0x080482b4 <+0>: push %ebp
0x080482b5 <+1>: mov %esp,%ebp
0x080482b7 <+3>: push %esi
0x080482b8 <+4>: push %ebx
0x080482b9 <+5>: cmpl $0x0,0x80494e8
0x080482c0 <+12>: jne 0x804830c <__do_global_ctors_aux+88>
0x080482c2 <+14>: movl $0x1,0x80494e8
0x080482cc <+24>: mov 0x8049400,%esi
0x080482d2 <+30>: cmp $0xffffffff,%esi
0x080482d5 <+33>: jne 0x80482f5 <__do_global_ctors_aux+65>
0x080482d7 <+35>: mov $0x1,%esi
0x080482dc <+40>: cmpl $0x0,0x8049404
0x080482e3 <+47>: je 0x80482f2 <__do_global_ctors_aux+62>
0x080482e5 <+49>: add $0x1,%esi
0x080482e8 <+52>: cmpl $0x0,0x8049400(,%esi,4)
0x080482f0 <+60>: jne 0x80482e5 <__do_global_ctors_aux+49>
0x080482f2 <+62>: sub $0x1,%esi
0x080482f5 <+65>: test %esi,%esi
0x080482f7 <+67>: je 0x804830c <__do_global_ctors_aux+88>
0x080482f9 <+69>: lea 0x8049400(,%esi,4),%ebx
0x08048300 <+76>: mov (%ebx),%eax
0x08048302 <+78>: sub $0x4,%ebx
0x08048305 <+81>: call *%eax
=> 0x08048307 <+83>: sub $0x1,%esi
0x0804830a <+86>: jne 0x8048300 <__do_global_ctors_aux+76>
0x0804830c <+88>: pop %ebx
0x0804830d <+89>: pop %esi
0x0804830e <+90>: pop %ebp
0x0804830f <+91>: ret
End of assembler dump.
(gdb) print $eax
$1 = 1
(gdb) print $esi
$2 = 1
(gdb) p/x $ebx
$3 = 0x8049400
$30 = {0x1, 0x1, 0xc, 0x8048234, 0xd, 0x80483dc, 0x4, 0x8048148}
So I (with my limited knowledge on this matters) suspect that there is
something wrong with __CTOR_LIST__ since it contains two consecutive
0x00000001's.
Loading...