This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fzero-initialized-in-bss again
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Eric Botcazou <ebotcazou at act-europe dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: 30 Apr 2004 14:52:21 -0700
- Subject: Re: -fzero-initialized-in-bss again
- References: <200404302109.55902.ebotcazou@act-europe.fr>
Eric Botcazou <ebotcazou@act-europe.fr> writes:
> Here's what happens: the change from 'Dynamic' to '10' for Sec_Stack_Ratio
> causes the comparison that initializes Sec_Stack_Dynamic to become false,
> hence Sec_Stack_Dynamic is effectively initialized to 0. Given that the
> option -fzero-initialized-in-bss is enabled by default, the symbol
> system__parameters__sec_stack_dynamic is moved from .data to the
> uninitialized data section. Now -fcommon is also on by default so the Ada
> compiler puts uninitialized symbols in the .common section. We eventually
> end up with system__parameters__sec_stack_dynamic in the .common section.
>
> So the local object has system__parameters__sec_stack_dynamic in .common
> while the runtime has it in .data. Therefore the linker imports s-parame.o
> from libgnat.a, thus leading to conflicts for other symbols.
All this is correct behaviour, except for what the Ada compiler does.
The problem appears to be that ada/utils.c unconditionally does this
when building a var_decl:
DECL_COMMON (var_decl) = !flag_no_common;
Is the Ada compiler really trying to make all variables, including
ones which are initialised, common? I don't believe this is
well-supported in the backend, and I'm not even sure what it means. I
would suggest changing this, possibly by simply deleting this line,
or modifying it based on Ada language semantics.
--
- Geoffrey Keating <geoffk@geoffk.org>