This is the mail archive of the binutils@sources.redhat.com 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]: Fix special sections on HC11/HC12


Hi!

For HC11, the special section .vectors was defined as writable. This is not correct because
this section is intended to be in ROM, so readonly (bug savannah 4950). The patch also
fixes the HC12 to define the special sections it had before (when they were defined in gas).
Committed on mainline.

Stephane

2003-09-06 Stephane Carrez <stcarrez@nerim.fr>

	* elf32-m68hc12.c (elf32_m68hc12_special_sections): New for hc11.
	(elf_backend_special_sections): Define.a

	PR savannah/4950:
	* elf32-m68hc11.c (elf32_m68hc11_special_sections): The .vectors
	section is read-only.

Index: elf32-m68hc11.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc11.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf32-m68hc11.c
--- elf32-m68hc11.c	25 Jul 2003 14:35:55 -0000	1.21
+++ elf32-m68hc11.c	6 Sep 2003 20:49:22 -0000
@@ -1285,7 +1285,7 @@ m68hc11_elf_relax_delete_bytes (abfd, se
    - The .page0 is a data section that is mapped in [0x0000..0x00FF].
      Page0 accesses are faster on the M68HC11. Soft registers used by GCC-m6811
      are located in .page0.
-   - The .vectors is the data section that represents the interrupt
+   - The .vectors is the section that represents the interrupt
      vectors.  */
 static struct bfd_elf_special_section const elf32_m68hc11_special_sections[]=
 {
@@ -1296,7 +1296,7 @@ static struct bfd_elf_special_section co
   { ".page0",		0,	NULL,	0,
     SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE },
   { ".vectors",		0,	NULL,	0,
-    SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE },
+    SHT_PROGBITS,	SHF_ALLOC },
   { NULL,		0,	NULL,	0,
     0,			0 }
 };
Index: elf32-m68hc12.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc12.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-m68hc12.c
--- elf32-m68hc12.c	21 Apr 2003 13:22:14 -0000	1.14
+++ elf32-m68hc12.c	6 Sep 2003 20:49:22 -0000
@@ -538,6 +538,25 @@ m68hc12_elf_set_mach_from_flags (abfd)
   return TRUE;
 }
 
+/* Specific sections:
+   - The .page0 is a data section that is mapped in [0x0000..0x00FF].
+     Page0 accesses are faster on the M68HC12.
+   - The .vectors is the section that represents the interrupt
+     vectors.  */
+static struct bfd_elf_special_section const elf32_m68hc12_special_sections[]=
+{
+  { ".eeprom",		0,	NULL,	0,
+    SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE },
+  { ".softregs",	0,	NULL,	0,
+    SHT_NOBITS,	SHF_ALLOC + SHF_WRITE },
+  { ".page0",		0,	NULL,	0,
+    SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE },
+  { ".vectors",		0,	NULL,	0,
+    SHT_PROGBITS,	SHF_ALLOC },
+  { NULL,		0,	NULL,	0,
+    0,			0 }
+};
+
 #define ELF_ARCH		bfd_arch_m68hc12
 #define ELF_MACHINE_CODE	EM_68HC12
 #define ELF_MAXPAGESIZE		0x1000
@@ -554,6 +573,7 @@ m68hc12_elf_set_mach_from_flags (abfd)
 #define elf_backend_object_p		m68hc12_elf_set_mach_from_flags
 #define elf_backend_final_write_processing	0
 #define elf_backend_can_gc_sections		1
+#define elf_backend_special_sections elf32_m68hc12_special_sections
 #define elf_backend_post_process_headers     elf32_m68hc11_post_process_headers
 #define elf_backend_add_symbol_hook  elf32_m68hc11_add_symbol_hook
 

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