This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


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: linker generated "subsections"


 

> -----Original Message-----
> From: Michael Hennebry [mailto:hennebry@web.cs.ndsu.nodak.edu] 
> Sent: Thursday, January 29, 2009 2:36 PM
> To: binutils@sourceware.org
> Subject: linker generated "subsections"
> 
> avr-ld will mangle the names of user-named sections.
> If I try to name a section "fred",
> code in the first file to use that section name
> will be put in section fred.
> Code in the subsequent files will be put
> in section fred.1, fred.2 and so forth.
> When I first encountered this,
> it defeated my effort to make a multi-file bootloader.
> 
> Where is the documentation on this?
> On this matter, google has not been my friend.
> 
> I can't even find any documentation that says it will do that,
> much less how to fix it.
> 
> C:\ATMel_PROJ\backlight\image\build>avr-ld --version
> GNU ld (GNU Binutils) 2.18 (WinAVR 20080610)
> Copyright 2007 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under 
> the terms of
> the GNU General Public License version 3 or (at your option) 
> a later version.
> This program has absolutely no warranty.

Hi Michael,

Yeah, I don't know why ld starting doing that too. I've been bitten by that before. However, you can work around it with a custom linker script.

For example from avr5.x, the .eeprom output section:

  .eeprom  :
  {
    *(.eeprom*)
     __eeprom_end = . ;
  }  > eeprom

In the input section definition, the first asterisk matches any file, and the section name is .eeprom*, and that last asterisk will match anything after the initial ".eeprom", which means that it will grab any subsections like ".eeprom.1".

I have done this successfully for bootloader sections like what you're trying to do.

Eric Weddington



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