[U-Boot-Users] Are gnu liker scripts available for C files?

Grant Likely grant.likely at secretlab.ca
Mon May 8 06:04:45 CEST 2006


On 5/7/06, Grant Likely <grant.likely at secretlab.ca> wrote:
> On 5/7/06, Forrest Chan <chenm at scut.edu.cn> wrote:
> > Hello guys,
> > I know, to implement XIP(eXecute In Place) on linux, read-only data and read-writable data of linux have to be splitted by some certain means, say, by way of using gnu linker scripts. Yes, gnu linker scripts are available to assemble language, but what about C files? Can the scritps separate the two types of data in C files? You know, C source files don't have diretives, like "AREA", "DATA" and "CODE", as assemble source files do.
> > Any reply is appreciated.
>
> This question is a little off-topic for this list.
>
> Typically; the C compiler uses the following sections:
>
> machine code in .text
> initialized globals and statics in .data*
> uninitialized globals and statics in .bss (which init code is supposed
> to clear with zeros)
> constants in .rodata*

I forgot to mention; For individual variable and functions; GCC allow
you to override the default section assignments.  Look in the GCC
documentation:

http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Function-Attributes.html#index-g_t_0040code_007bsection_007d-function-attribute-1823
http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Variable-Attributes.html#index-g_t_0040code_007bsection_007d-variable-attribute-1861

g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
(403) 399-0195




More information about the U-Boot mailing list