program crashes on startup when compiled with 'recent' gcc

Ian Lance Taylor iant@google.com
Tue Oct 6 15:43:00 GMT 2009


Zdeněk Sojka <zsojka@seznam.cz> writes:

> The problem may be in placing the symbol in wrong section group as
> -	.section	.bss._ZGVZN1A4InitEvE1i,"awG",@nobits,_ZZN1A4InitEvE1i,comdat
> +	.section	.bss._ZGVZN1A4InitEvE1i,"awG",@nobits,_ZGVZN1A4InitEvE1i,comdat
> applied (at least to) file.s fixes the problem.

In your test case as written there should not be any such section in
file.s.  file.h only includes header.h, and does not actually define
any variables at all.

The section group symbol looks right to me--the guard variable should
be associated with the variable it is guarding, it shouldn't be in its
own group.


> Failing instruction is:
>     0x0000000000400853 <_ZN1A4InitEv+63>:   mov    %rax,-0x40085a(%rip)        # 0x0
> (writing to NULL)
> which is
> 	movq	%rax, _ZZN1A4InitEvE1i(%rip)
> in .s file

If that is writing to NULL, it suggests that _ZZN1A4InitEvE1i
(A::Init()::i) was somehow never defined.  What do you see for that
symbol using readelf -s on the executable and on the input object
files?

Ian



More information about the Gcc-help mailing list