Linker script help needed - section not included in S3R file

Alan Cudmore Alan.P.Cudmore.1@gsfc.nasa.gov
Wed Oct 23 13:47:00 GMT 2002


I am trying to create a linker script to build an embedded program using 
a mips toolchain ( gcc 2.95, ELF object format, big endian )

I want to have a small section of ROM code and data followed by the 
normal code and data that gets copied from ROM to RAM.
My problem is that the small section of ROM code and data are being left 
out of the S-record file that I produce using objcopy ( also tried 
producing the s-record directly from 'ld', no change ). Everything else 
that I put in ROM is in the s-record file. Here are the parts of my 
linker script and the output of objdump -x:


/* ------------------------ Part of the linker 
script ------------------- */
ENTRY(_CpuInit)
OUTPUT_ARCH("mips")
OUTPUT_FORMAT("elf32-bigmips")
__DYNAMIC  =  0;


SECTIONS
{
   /*
   **  This is the ROM startup code segment
   **  located in EEPROM
   */
   .romtext 0xBFC40000 :
   {
     *(sec_bstart)
   }

   .romdata : AT ( ADDR(.romtext) + SIZEOF (.romtext))
   {
     *(sec_dstart)
   }

   /*
   ** This is the RAM text segment
   ** that is linked to ROM , but gets copied to RAM
   */
   .text 0x80020000 :  AT ( ADDR (.romdata) + SIZEOF (.romdata) )
   {
      _ftext = . ;
     *(.text)
     *(.text.*)
     *(.gnu.linkonce.t*)
     *(.mips16.fn.*)
     *(.mips16.call.*)

/* ------------------------- end linker script fragment ---------------/


/* ------------ Part of the objdump -x output -------------------- */

Sections:
Idx Name          Size      VMA               LMA               File 
off  Algn
   0 .romtext      000003e4  ffffffffbfc40000  ffffffffbfc40000  
00061a60  2**0
                   CONTENTS
   1 .romdata      00000144  ffffffffbfc403e4  ffffffffbfc403e4  
00061e44  2**2
                   CONTENTS, READONLY
   2 .text         0004adb4  ffffffff80020000  ffffffffbfc40528  
000000a0  2**4
                   CONTENTS, ALLOC, LOAD, CODE

/* ----------------- end of the objdump -x output fragment -------- */

As you can see, the sections ( .romtext and .romdata ) have only the 
CONTENTS attribute and are being left out of the s-record file. The 
.text section has ALLOC and LOAD and is being included in the S-record 
file.

Does anyone know what I'm doing wrong here? Are there section attributes 
that I can set to allow these sections to be included in the S-record 
file?

Thanks,

Alan


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



More information about the crossgcc mailing list