This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Patch to modify the default linker script for H8 (ELF) targets to incorporate Tiny Data Sections


Hi,

Please find the patch as below for H8/300 (ELF) target, which enhances
the 
existing "Binutils /ld " code to enhance the default linker script
generated
by the Linker to incorporate the sections ".tinyrodata" ,".tinydata" and

".tinybss" at the appropriate H8 memory locations. These sections get
created by the compiler upon passing a target specific option
"-mtinydata "  on the command line.The ".tinyrodata" section gets
created in the lower most 32KB of the memory from the memory map and the
".tinydata"  and ".tinybss " get created in the upper most 32KB of the
memory from memory map. All the global variables are placed into these
sections depending upon whether the variable is constant, initialized or
uninitialized. 

Please note that this requires a patch for GCC also which has been
posted 
separately on GCC mailing list. Please refer to the following link :
http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01733.html 

This patch reduces the code size and it increases the code efficiency.

No new regressions found.


=======================Start Of Patch================================
ChangeLog
2005-11-24  Santosh Raktawan <santoshr2@kpitcummins.com>
       	* ld/emulparms/h8300helf.sh : Sections " .tinyrodata, .tinydata

              and .tinybss "
              added at appropriate memory locations.
	      * ld/emulparms/h8300self.sh : Sections " .tinyrodata,
.tinydata   
              and .tinybss "
              added at appropriate memory locations.
	      * ld/emulparms/h8300sxelf.sh : Sections " .tinyrodata,
.tinydata 
              and .tinybss "
              added at appropriate memory locations.
	      * ld/scripttempl/elf.sc  : Default linker script template
is 
              modified to make provision for " .tinyrodata , .tinydata ,

              .tinybss " sections.
 
=======================================================================
--- binutils-051018/ld/emulparams/h8300helf.sh.orig	2001-11-22
14:38:04.000000000 +0530
+++ binutils-051018/ld/emulparams/h8300helf.sh	2005-10-24
12:34:36.000000000 +0530
@@ -1,3 +1,16 @@
 . ${srcdir}/emulparams/h8300elf.sh
 ARCH="h8300:h8300h"
 STACK_ADDR=0x2fefc
+TINY_READONLY_SECTION=".tinyrodata :
+  {
+	*(.tinyrodata)
+  } =0"
+TINY_DATA_SECTION=".tinydata	0xff8000 :
+  {
+	*(.tinydata)
+	_tinydata = .;
+  }"
+TINY_BSS_SECTION=".tinybss	: AT (_tinydata)
+  {
+	*(.tinybss)
+  }"

--- binutils-051018/ld/emulparams/h8300self.sh.orig	2005-10-24
12:15:21.000000000 +0530
+++ binutils-051018/ld/emulparams/h8300self.sh	2005-10-24
12:19:20.000000000 +0530
@@ -1,3 +1,16 @@
 . ${srcdir}/emulparams/h8300elf.sh
 ARCH="h8300:h8300s"
 STACK_ADDR=0x2fefc
+TINY_READONLY_SECTION=".tinyrodata :
+  {
+	*(.tinyrodata)
+  } =0"
+TINY_DATA_SECTION=".tinydata	0xff8000 :
+  {
+	*(.tinydata)
+	_tinydata = .;
+  }"
+TINY_BSS_SECTION=".tinybss	: AT (_tinydata)
+  {
+	*(.tinybss)
+  }"

--- binutils-051018/ld/emulparams/h8300sxelf.sh.orig	2003-06-04
03:13:52.000000000 +0530
+++ binutils-051018/ld/emulparams/h8300sxelf.sh	2005-10-24
12:35:12.000000000 +0530
@@ -1,3 +1,16 @@
 . ${srcdir}/emulparams/h8300elf.sh
 ARCH="h8300:h8300sx"
 STACK_ADDR=0x2fefc
+TINY_READONLY_SECTION=".tinyrodata :
+  {
+	*(.tinyrodata)
+  } =0"
+TINY_DATA_SECTION=".tinydata	0xff8000 :
+  {
+	*(.tinydata)
+	_tinydata = .;
+  }"
+TINY_BSS_SECTION=".tinybss	: AT (_tinydata)
+  {
+	*(.tinybss)
+  }"

--- binutils-051018/ld/scripttempl/elf.sc.orig	2005-10-24
12:16:19.000000000 +0530
+++ binutils-051018/ld/scripttempl/elf.sc	2005-10-24
12:47:10.000000000 +0530
@@ -57,7 +57,7 @@
 # when specifying the start address of the next.
 #
 
-#  Many sections come in three flavours.  There is the 'real' section,
+# Many sections come in three flavours.  There is the 'real'
sectiovectors : o = 0x0000, l = 0xc4n,
 #  like ".data".  Then there are the per-procedure or per-variable
 #  sections, generated by -ffunction-sections and -fdata-sections in
GCC,
 #  and useful for --gc-sections, which for a variable "foo" might be
@@ -334,6 +334,7 @@ cat <<EOF
   } =${NOP-0}
 
   ${TEXT_PLT+${PLT}}
+  ${TINY_READONLY_SECTION}
   .text         ${RELOCATING-0} :
   {
     ${RELOCATING+${TEXT_START_SYMBOLS}}
@@ -494,6 +495,9 @@ cat <<EOF
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
 
+  ${TINY_DATA_SECTION}
+  ${TINY_BSS_SECTION}
+
   ${STACK_ADDR+${STACK}}
   ${OTHER_SECTIONS}
   ${RELOCATING+${OTHER_SYMBOLS}}

=======================End Of Patch================================

Regards,

Santosh Raktawan.
KPIT Cummins Infosystems Ltd, 
Pune ( INDIA ) 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH and H8 Series.
The following site also offers free technical support to its users. 
Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on October 12, 2005.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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