From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Clifton To: bfd@cygnus.com Subject: Patch to add .eh_frame and .gcc_except_table to ELF.SC Date: Tue, 02 Mar 1999 15:21:00 -0000 Message-id: <199903022321.PAA15656@elmo.cygnus.com> X-SW-Source: 1999/msg00032.html 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