This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFH] Uses of output.h in the front ends


On Mon, Jun 4, 2012 at 7:20 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> The code for the case in Ada is this:
>>
>> ? /* Ada doesn't feature Fortran-like COMMON variables so we shouldn't
>> ? ? ?try to fiddle with DECL_COMMON. ?However, on platforms that don't
>> ? ? ?support global BSS sections, uninitialized global variables would
>> ? ? ?go in DATA instead, thus increasing the size of the executable. ?*/
>> ? if (!flag_no_common
>> ? ? ? && TREE_CODE (var_decl) == VAR_DECL
>> ? ? ? && TREE_PUBLIC (var_decl)
>> ? ? ? && !have_global_bss_p ())
>> ? ? DECL_COMMON (var_decl) = 1;
>>
>> That does look like premature optimization to me, but I don't really
>> understand the comment, or the effect of this code. Eric, could you
>> please have a look at this and help me out?
>
> Sure, but I don't understand what you don't understand... ?the comment seems
> clear enough to me: DECL_COMMON is needed on some platforms if you don't want
> uninitialized variables to go in DATA.

What I don't understand, is whether this is still something GNAT has
to support, or whether this code can be deprecated/removed. And I ask
for your help because you are one of the people who worked on this
so-many-years ago
(http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00550.html) and because
you obviously have much better understanding of GNAT and of how this
kind of low-level thing works in GCC than I do.

If this should continue to be supported:
For the corresponding option for G++ (-fconserve-space) the
documentation says that the flag isn't very useful anymore because:
"This option is no longer useful on most targets, now that support has
been added for putting variables into BSS without making them common."
What I don't understand, is what this means for GNAT. (Remember, I
help build aircraft for a living, not compilers! I can barely
distinguish .bss from .data, and don't understand at all where/how GCC
decides to put variables in one section or another :-D) I was hoping
maybe you know how to rewrite that piece of code such that you get
that uninitialized variable into BSS without DECL_COMMON.

Or maybe you can tell if this code is no longer needed, so I can
prepare a patch to remove it.

Hope you can help,

Ciao!
Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]