Question about keywords and declarations in assembly code

Jafa jafa@silicondust.com
Mon Oct 13 21:55:00 GMT 2003


Cool - Thanks - I will turn that warning on.

Is there any way to tell gcc not to create common variables?
(I have a few .o manipulations that I like to do that need everything to be
in sections).

As far as I can tell if a variable is not pre-initialized then gcc always
uses the .comm section. If it is static then it adds a private directive (I
can't remember the actual directive name) so you end up with a private .comm
which gas allocates into .bss rather than leaving it .comm for the linker to
group.

BTW - I already use -fdata-sections (and -gc-sections on the linker).

Thanks

Nick

----- Original Message ----- 
From: "Ian Lance Taylor" <ian@wasabisystems.com>
To: "Jafa" <jafa@silicondust.com>
Cc: <spr03@uow.edu.au>; <binutils@sources.redhat.com>
Sent: Monday, October 13, 2003 10:18 AM
Subject: Re: Question about keywords and declarations in assembly code


> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> "Jafa" <jafa@silicondust.com> writes:
>
> > The way I figure it if you have two global variables of the same name
then
> > you should get a linker error... merging the two may be the worst thing
it
> > can do. Maybe there is some obscure C spec that requires this - hopfully
> > someone will clarify.
>
> There is no spec for it, but it is traditional Unix linker behaviour.
> The C standard permits it as an extension.  Existing programs depend
> on it.
>
> If you don't like it, use the linker --warn-common option.
>
> Ian
>
>



More information about the Binutils mailing list