Need -un-initialized memory allocation
Chris Demetriou
cgd@google.com
Fri Jul 4 07:36:00 GMT 2008
More information about the Binutils mailing list
Fri Jul 4 07:36:00 GMT 2008
- Previous message (by thread): Need -un-initialized memory allocation
- Next message (by thread): Need -un-initialized memory allocation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Sorry for the dup, Anton. Meant to reply to the list, but failed the first time.] 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 $ as x.s $ objdump -xd a.out a.out: file format elf32-i386 a.out architecture: i386, flags 0x00000010: HAS_SYMS start address 0x00000000 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000000 00000000 00000000 00000034 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00000000 00000000 00000034 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 00000034 2**2 ALLOC SYMBOL TABLE: 00000000 l d .text 00000000 .text 00000000 l d .data 00000000 .data 00000000 l d .bss 00000000 .bss 00000000 l .text 00000000 symbol1 01234567 l .text 00000000 symbol2 02468ace l .text 00000000 symbol3 ("=" works similarly, e.g. code like "symbol2 = symbol1 + 0x1234567".) That's just an example to show expressions, you can also use absolute addresses, etc. http://sourceware.org/binutils/docs-2.18/as/Set.html#Set There are several similar directives that might be useful to you as well, e.g. .equiv and .eqv. chris
- Previous message (by thread): Need -un-initialized memory allocation
- Next message (by thread): Need -un-initialized memory allocation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list