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]

ldscript question


Hi all,

I am trying to do the conventional rom image building, with different
vma and lma for .data section. Here is the ldscript part:

...
    .tors :
    {
        ___ctors = . ;
        *(.ctors)
        ___ctors_end = . ;
        ___dtors = . ;
        *(.dtors)
        ___dtors_end = . ;
        _mdata = .
    }
    .data : AT(ADDR(.tors) + SIZEOF(.tors))
    {   
        _data = .;
        *(.data)
        _edata = .;
    }
...

Currently I directly load the program into RAM, so there is no AT
keyword, and I expect that _mdata == _data. Am I right?

(In start.s I copy the .data section from _mdata to _data.) But, there
is a problem, which can be seen from the objdump:

...
  1 .rodata       0000039f  ffffb098  ffffb098  00004998  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .tors         00000000  ffffb437  ffffb437  0000592c  2**0
                  CONTENTS
  3 .data         000007a8  ffffb438  ffffb437  00004d38  2**2
                  CONTENTS, ALLOC, LOAD, DATA
...
ffffb438 g       .data	00000000 _data
...
ffffbbe0 g       .data	00000000 _edata
...
ffffb437 g       *ABS*	00000000 _mdata

So, it can be seen that _mdata != _data, because of aligning, and, of
course my .data will be improperly initialized.

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.

- 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?

Thanks:
Ferenc

------
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]