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: Address assignment


----Original Message----
>From: shreyas krishnan
>Sent: 14 September 2005 05:20

> Thanks for taking my question. My intention is the earlier that is to
> assign addresses to variables, like you have shown with my_struct. But
> currently I see my assembly file  containing .comm directives for all
> the global variables or .bss for static variable. So In this case is
> there a directive that I can add to the assembly file which will
> additionally specify the address of each variable. My addresses  are
> generated insider the compiler, so I would like something which works
> automatically -perhaps just additions to the assembler file or
> modifications in the assembler.

  Ah, you're using a compiler rather than writing assembly?  Well, in C,
rather than

>>         .global _my_struct
>> _my_struct = 0xa0001028

you'd want to use a pointer variable:

struct my_struct_type * const my_struct = (struct my_struct_type
*)0xa0001028;

  Putting const after the '*' like this means that the _pointer_ is constant
- always points to the same place - rather than the thing that it points to,
and that should be all the compiler needs to know to optimise references
through the pointer to direct memory operations.

  General questions about _using_ the compiler are best sent to the gcc-help
list; the main binutils and gcc lists are about modifying the source code of
the tools, understanding their internal operations, debugging them, and so
on; in other words, working _on_ them rather than _with_ them.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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