avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Using .data & bss


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Using .data & bss
Date: Mon, 26 Nov 2001 13:05:56 +0100 (MET)

Klaus Rudolph <address@hidden> wrote:

> But there is no .bss in avr-gcc. What is the solution. 

RTFinfo.

The simplest way to find about it is to declare a BSS variable inside
a C program snippet, and have avr-gcc compile it into a .s file.  Then
you'll notice that the GNU assembler uses the .comm pseudo-op to
declare BSS variables:

        .comm foo,2,1

Here's the part of the respective section of the gas info file:

File: as.info,  Node: Comm,  Next: Data,  Prev: Byte,  Up: Pseudo Ops

`.comm SYMBOL , LENGTH '
========================

   `.comm' declares a common symbol named SYMBOL.  When linking, a
common symbol in one object file may be merged with a defined or common
symbol of the same name in another object file.  If `ld' does not see a
definition for the symbol-just one or more common symbols-then it will
allocate LENGTH bytes of uninitialized memory.  LENGTH must be an
absolute expression.  If `ld' sees multiple common symbols with the
same name, and they do not all have the same size, it will allocate
space using the largest size.

   When using ELF, the `.comm' directive takes an optional third
argument.  This is the desired alignment of the symbol, specified as a
byte boundary (for example, an alignment of 16 means that the least
significant 4 bits of the address should be zero).  The alignment must
be an absolute expression, and it must be a power of two.  If `ld'
allocates uninitialized memory for the common symbol, it will use the
alignment when placing the symbol.  If no alignment is specified, `as'
will set the alignment to the largest power of two less than or equal
to the size of the symbol, up to a maximum of 16.

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]