comp.lang.c
[Top] [All Lists]

Re: How to group objects from static library in a section?

Subject: Re: How to group objects from static library in a section?
From:
Date: Thu, 27 Mar 2008 12:46:03 -0700 PDT
Newsgroups: comp.lang.c

Hi,

   Putting all the library routines in .rom_code section has a
important drawback - it will place in ROM also the library routines
called by the code in RAM. It is a problem for me because the ROM
contents shouldn't depend on the code in RAM. Answering your question,
I can't put all the code in ROM because ROM contents behaves like a
library for RAM code - ROM is programmed *before* the code targetted
to RAM is compiled, which is dynamically loaded by a bootstrap code in
ROM reading the code targetted to RAM through a special interface in
my board.

   What I am looking for is a way to extend the section attribute
attached to a routine to all its dependencies. There are some
compilers/linkers that allow that (CodeWarrior, but not using
attributes) and GNU linker seems to be equiped for that - there is a
call graph analysis done during --gc-section optimization.

   Any help is welcome.

   Tks

On Mar 27, 2:14 pm, jacob navia <ja...@xxxxxxxxxx> wrote:
> I think you have to rebuild the C library to put the
> __attribute__((section(".rom_code")))
> in each of the functions you want in ROM.
>
> Normally, the linker assumes certain sections from the
> attributes of the sections in the object files.
> (See my previous articles about linkers in this forum).
>
> To put your library functions in the rom you should
> recompile the library with the attributes in the object
> file. This is surely not an easy task!
>
> P.S. Why don't you put ALL code in the ROM?
>
> IN that case you would just modify the linker script.
>
> --
> jacob navia
> jacob at jacob point remcomp point fr
> logiciels/informatiquehttp://www.cs.virginia.edu/~lcc-win32


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy