On Fri, Nov 14, 2003 at 09:42:34AM -0800, Teresa Tao wrote:
> Does anyone know how to put my userland program's data in a specified section?
>
> I know there is an attribute "section" to put my data inside a specified
> section, for example, int data __attribute__ ((section("INITDAT"));
> But how do I initialize/setup the INITDAT section? We use the
> commercial toolchain, and we don't have the source code for it, is
> there still a way to specify the postion of the INITDAT section?
If your commercial toolchain understands the __attribute__ syntax then
I suspect it's based on gcc which would mean you have a right to the
sourcecode.
No initialization needed; Ld will use the flags of the first instance
of an input section for the output section which usually is right. In
the rare case this isn't suitable you can use a .section pseudo-op
in inline assembler or assembler to setup the section with the right
flags. Just make sure this section is linked first.
Ralf
|