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: Custom section attributes (and more...)


>-----Original Message-----
>From: Davide Viti [mailto:Davide.Viti@icn.siemens.it]
>Sent: 20 February 2002 10:21

  Right, I'm in way over my head here, but I have a suggestion, or at
any rate, something that I don't understand...

>.vtable : AT(ADDR(.text)+SIZEOF(.text))
>{
>	_vtstart = .;
>	*(.vtable)
>	_vtend = .;
>} > sram

  That only has an AT command, but no start address.  Check this bit
from the ld docs:

---------begin quote---------
Optional Section Attributes
[SNIP]

SECTIONS {
...
secname start BLOCK(align) (NOLOAD) : AT ( ldadr )
  { contents } >region :phdr =fill
...
}

[SNIP]

start 
You can force the output section to be loaded at a specified address by
specifying start immediately following the section name. start can be
represented as any expression. The following example generates section
output at location 0x40000000: 
SECTIONS {
  ...
  output 0x40000000: {
    ...
    }
  ...
}

[SNIP]

AT ( ldadr ) 
The expression ldadr that follows the AT keyword specifies the load address
of the section. The default (if you do not use the AT keyword) is to make
the load address the same as the relocation address. This feature is
designed to make it easy to build a ROM image. For example, this SECTIONS
definition creates two output sections: one called `.text', which starts at
0x1000, and one called `.mdata', which is loaded at the end of the `.text'
section even though its relocation address is 0x2000. The symbol _data is
defined with the value 0x2000: 

----------end quote----------

  And then there's an example, which looks very like your .vtable section,
except for having both a start addr and an AT:

---------begin quote---------
SECTIONS
  {
  .text 0x1000 : { *(.text) _etext = . ; }
  .mdata 0x2000 : 
    AT ( ADDR(.text) + SIZEOF ( .text ) )
    { _data = . ; *(.data); _edata = . ;  }
  .bss 0x3000 :
    { _bstart = . ;  *(.bss) *(COMMON) ; _bend = . ;}
}
----------end quote----------

  Now that documentation seems to me to be in error or unclear at any rate
(but it is from binutils 2.6, so may have been fixed since), since it seems
to say that both start and AT give the load address; the example makes it
clear that AT gives the address where it will be loaded to, but start is the
address that it should have relocations calculated as if it was at.  So....
I think you need to fix your linker script by giving it a start addr
corresponding to where the vector table actually goes, perhaps?

       DaveK
-- 
Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

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