This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: ldscript question


On Wed, Oct 15, 2003 at 06:01:35PM +0200, Fery wrote:
>     .tors :
>     {
>         ___ctors = . ;
>         *(.ctors)
>         ___ctors_end = . ;
>         ___dtors = . ;
>         *(.dtors)
>         ___dtors_end = . ;
>         _mdata = .
>     }
>     .data : AT(ADDR(.tors) + SIZEOF(.tors))
>     {   
>         _data = .;
>         *(.data)
>         _edata = .;
>     }

> I have 2 questions:
> 
> - how can I get the real load address of the .data section? The
> LOADADDR(.data) function gives the bad value (ffffb437), too.

Though no guru, I'd surmise that you've demonstrated that. Since _data
has the correct value, that's the one to use while you're not rectifying
the observed symptoms with explicit alignment, or an alternative method.

Have you tried not forcing LOADADDR(.data) to be misaligned through the
AT expression? Does the script have MEMORY segments, allowing you to
naturally concatenate sections, as in:

   .tor :
   { ...
   } > some_memory_segment
   
   .data :
   { ...
   } > some_memory_segment
   
It might then be that ld, freed from the AT constraint, gives more
pleasing LOADADDR(.data) results.

> - Where do ld gets the default align values of the sections from? I can
> solve this problem to align .tors section to 2**2, but how did ld get
> that it should not be aligned, and .data needs align?

Lacking information about your target, it's only possible to guess that
it might require (half)word aligned data. The dialect of ld built for
that target would then be remiss if it did not implicitly align the
.data section. Any unrecognised section would not receive that
treatment.

Let us hear how it goes. :-)

Good luck,
Erik

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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