This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Need -un-initialized memory allocation


On Fri, 2008-07-04 at 00:36 -0700, Chris Demetriou wrote:
> [Sorry for the dup, Anton.  Meant to reply to the list, but failed the
> first time.]

Also sorry for my dups :)

> 
> On Thu, Jul 3, 2008 at 13:48, Anton Tichawa <anton.tichawa@chello.at> wrote:
> > I looked for a directive that allocates uninitialized memory, but didn't
> > find any. What I want is something like
> >
> > Symbol1:    <reserve 0x10000 longwords>
> > Symbol2:    <reserve 200 bytes>
> > ...
> >
> > So the only effect would be the definition of the symbols.
> >
> 
> If definition of the symbols is truly the only effect that you want (i.e.,
> you don't care about changing the value of '.' -- not clear from your
> description where you that you want to "reserve" space), then your solution
> may simply be ".set".
> 
> For instance:
> 
> $ cat x.s
>     .set symbol1, .
>     .set symbol2, symbol1 + 0x1234567
>     .set symbol3, symbol2 + 0x1234567

Let me explain: There is e. g. one table of 0x10000 long sine values,
initialized only at runtime, and two more buffers for intermediate
results, i. e. no initialization required, of the same size. Years ago I
programmed in an 68000 assembler, like that:

           ORG  RAM_START

SineTable: DS.L $10000  // DS = define storage longword; $ = hex.
Buffer1:   DS.L $10000
Buffer2:   DS.L $10000
...

This directive assigned the location counter to the symbol
(SineTable=RAM_START, Buffer1=RAM_START+0x40000 etc.) and then advanced
the location counter by 0x40000. But it did not emit a large object
file.

Is there no such directive in gas?

The same happens when I use the ".section bss". The doc (4.2. Linker
sections) states that

"The bss section was invented to eliminate those explicit zeros from
object files."

So I tried:

           .section  bss
           .org      0
SineTable:  . = . + 0x40000
Buffer1:    . = . + 0x40000
Buffer2:    . = . + 0x40000

But the object file is a huge bunch of mainly zeroes. Am I doing
something wrong here?

Thanks,

Anton.



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