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

See the CrossGCC FAQ for lots more infromation.


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

Re: objcopy and s-record output


Ryan Bedwell wrote:
> 
> It's definitely possible that I'm doing something wrong.  I'm using a
> custom linker script as well; the SECTIONS part looks like this:
> 
> <SNIP>

I saw this problem a while back on an i386 target.  Use objdump -h
and look at the attributes for the .text and the .start sections.
Art's comment about NOLOAD is probably correct.  We ended up having to
use this for the special .reset section in the assembly file where it
was.

        .section .reset, "ax"

Which says it is "allocatable" and "executable".  This is from the 
".section" description in the GAS manual.

> SECTIONS
> {
>   .start :
>     {
>       start_s = . ;
>       *(.start) ;
>       start_e = . ;
>     } > rom
>   .text :
>     AT (ADDR(.start) + SIZEOF(.start))
>     {
>       text_s = . ;
>       *(.text)
>       *(.rodata) ;
>       text_e = . ;
>     } > ram
>     text_l = LOADADDR(.text) ;
>   .data :
>     AT (LOADADDR(.text) + SIZEOF(.text))
>     {
>       data_s = . ;
>       *(.data)
>       *(.got) ;
>       data_e = . ;
>     } > ram
>     data_l = LOADADDR(.data) ;
>   .bss (NOLOAD) :
>     {
>       bss_s = . ;
>       *(.bss)
>       *(.COMMON) ;
>       bss_e = . ;
>     } > ram
> }
> 
> </SNIP>
> 
> Specifically what I'm trying to do is relocate the text section to RAM
> at run time, but I need the startup and relocating code in ROM (hence
> the extra section).
> 
> Ryan
> 
> Art Berggreen wrote:
> >
> > Ryan Bedwell wrote:
> > > I'm using objcopy to convert an ELF file to s-record, and it looks like
> > > whenever I add a new section with a custom name -- i.e. ".start", it
> > > does not make it through to the output file.  I know that you can lose
> > > information in objcopy, but I haven't been able to locate documentation
> > > which says anything about custom section restrictions in s-records.  I
> > > can definitely see the sections set up correctly in the map file
> > > produced by ld (i.e. they're there in the ELF file), but the custom one
> > > seems to be gone in the s-record after running objcopy.
> > >
> > > I thought I'd ping the list to see if there is an obvious solution or
> > > explanation before digging in myself.
> >
> > Hmm, no explicit information to help you, just a little more input.
> >
> > We regularly use ld to produce COFF and ELF load files, and frequently
> > use objcopy to produce S-record files for other tools/utilities.  Most
> > of these load files have custom output sections (we use our own linker
> > scripts) that need to end up in the S-record file.  There isn't anything
> > special I can think of that we are doing that makes this work.
> >
> > Any chance that the missing output sections are acquiring the "NOLOAD"
> > attribute like the .bss section?  Such sections don't get into the
> > S-record file.
> >
> > Art
> >
> > ------
> > Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> > Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
> 
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

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


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