This is the mail archive of the bfd@sourceware.cygnus.com mailing list for the bfd project.


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

Patch to add .eh_frame and .gcc_except_table to ELF.SC


Hi Guys,

  [This is a resend to a wider audience].

  Does anyone have any comments to my applying the following patch to
  the default ELF linker script: 

Index: elf.sc
===================================================================
RCS file: /cvs/cvsfiles/devo/ld/scripttempl/elf.sc,v
retrieving revision 1.57
diff -p -r1.57 elf.sc
*** elf.sc	1999/02/25 21:21:19	1.57
--- elf.sc	1999/03/01 20:08:55
*************** SECTIONS
*** 171,176 ****
--- 171,178 ----
      ${RELOCATING+*(.gnu.linkonce.r*)}
    }
    .rodata1 ${RELOCATING-0} : { *(.rodata1) }
+   .eh_frame : { *(.eh_frame) }
+   .gcc_except_table : { *(.gcc_except_table) }
    ${RELOCATING+${OTHER_READONLY_SECTIONS}}
  
    /* Adjust the address for the data segment.  We want to adjust up to


  The purpose of the patch is to explicitly add the .eh_frame and
  .gcc_except_table sections to the linker script, rather than
  allowing them to be orphans and just tagged onto the end of the
  executable's image.  The reason this is necessary is that some ports
  use the symbol '_end' as the start of allocatable memory for use by
  malloc, via a system call to _sbrk().  Unfortunately orphan sections
  are append after the location assigned by the elf.sc script to
  '_end' and so they get stompped on by whomever uses the results of a
  call to malloc.  (Creating a new symbol to be placed at the end of
  the linker script, after the OTHER_SECTIONS, would not work because
  then there would be now way to specify a 'stack' symbol which starts
  in high memory and grows downwards into the area being used by
  '_end' for mallocs).

Cheers
	Nick