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


Just to clarify my question again, I am looking for steps the compiler
can do at the end assembly file generation. So source file
modifications would not help. In other words,  I have modified the
compiler to analyze and find offsets. Now I want to change the default
addresses to the new addrsses So the input to my process is a C file.
Now I want to assign addresses by modifying the assembly file that the
compiler generates inside the compiler itself or do that some where
else. But  I find that the assembly file generated already has .comm,
.lcomm or .bss generated based on the kind of  global variable and it
would not take the 2 lines  ( .global mystruct ....). My target is
mcore-elf.

Any pointers to what I can do ? 

thanks again 
Shrey 

On 9/14/05, Dave Korn <dave.korn@artimi.com> wrote:
> ----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]