Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

COMMON symbols flagging

1 view
Skip to first unread message

spam...@crayne.org

unread,
Jul 22, 2006, 11:43:35 PM7/22/06
to
Hey guys,

How should I flag a COMMON(ly) declared symbol in my assembler, so that
when the COFF object file is generated the linker will know that symbol
was declared as COMMON?

Chris Barts

unread,
Jul 23, 2006, 5:21:45 AM7/23/06
to
On Sat, 22 Jul 2006 20:43:35 -0700, spamtrap wrote:

> Hey guys,
>
> How should I flag a COMMON(ly) declared symbol in my assembler

Which assembler? Or are you asking for good syntax to use in an assembler
you're currently writing?

--
My address happens to be com (dot) gmail (at) usenet (plus) chbarts,
wardsback and translated.
It's in my header if you need a spoiler.


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

binaryONE

unread,
Jul 23, 2006, 4:30:01 PM7/23/06
to
Oops I wa not clear enough, sorry about that.

I am writing an assembler, as a project, and I am trying to allow for
coff file generation.

However I am having trouble understand how a COMMON defined symbol will
be known to the linker to be COMMON because, in COFF documentation, I
don't see any difference between a COMMON and an EXTERN or GLOBAL
symbols...

Bjarni Juliusson

unread,
Jul 24, 2006, 1:15:32 AM7/24/06
to

These are three different things. It works like this:

If a symbol is declared as GLOBAL, by say .global, it is defined in this
object and exported to other objects. This means that other objects can
refer to this same symbol and get the same value.

If a symbol is declared EXTERNAL, by say .extern, it is defined in some
other object and gets its value at link time. It is an error to refer to
an external symbol which is not defined anywhere else.

If a symbol is declared COMMON, by say .common, it is placed in the .bss
section and merged with all other instances of the same symbol at link
time. This means that more than one object may declare the symbol as
common, but if it is only declared here, it is still defined. All
objects linked together will get the same instance of the symbol, as
long as they all declare it as common.


Bjarni
--

INFORMATION WANTS TO BE FREE

0 new messages