Linker script help needed - section not included in S3R file

Alan Cudmore
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 ------------------- */
__DYNAMIC  =  0;

   **  This is the ROM startup code segment
   **  located in EEPROM
   .romtext 0xBFC40000 :

   .romdata : AT ( ADDR(.romtext) + SIZEOF (.romtext))

   ** This is the RAM text segment
   ** that is linked to ROM , but gets copied to RAM
   .text 0x80020000 :  AT ( ADDR (.romdata) + SIZEOF (.romdata) )
      _ftext = . ;

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

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

Idx Name          Size      VMA               LMA               File 
off  Algn
   0 .romtext      000003e4  ffffffffbfc40000  ffffffffbfc40000  
00061a60  2**0
   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 

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 



Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list