This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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]

[RFA]: Fix problems in libgloss for 68hc11/68hc12 (memory bank support)


Hi!

The linker scripts provided by libgloss for HC11/HC12 are out of date
  - the linker supports the gc and we must mark several parts with KEEP
  - the .tramp section is necessary to specify where the trampolines must go

The serial line support does not support the -mlong-calls (memory bank).

This patch fixes that (from http://savannah.gnu.org/projects/m68hc11/).

Can you approve it?

Thanks,
	Stephane

P.S: I think I have write access to CVS here.

2004-03-03 Stephane Carrez <stcarrez@nerim.fr>

	* m68hc11/sci-inout.S: Supports -mlong-calls.
	* m68hc11/sim-valid-m68hc11.ld (.tramp): New section for trampolines.
	(.text): Mark the .installN and .finiN section with KEEP.
	(.vectors): Likewise for .vectors.
	(.gcc_except_table): New section.
	* m68hc11/sim-valid-m68hc12.ld (.tramp): New section for trampolines.
	(.text): Mark the .installN and .finiN section with KEEP.
	(.vectors): Likewise for .vectors.
	(.gcc_except_table): New section.

Index: m68hc11/sci-inout.S
===================================================================
RCS file: /cvs/src/src/libgloss/m68hc11/sci-inout.S,v
retrieving revision 1.1
diff -u -p -r1.1 sci-inout.S
--- m68hc11/sci-inout.S	23 Jul 2002 21:56:27 -0000	1.1
+++ m68hc11/sci-inout.S	3 Mar 2004 22:10:09 -0000
@@ -1,5 +1,5 @@
 /* M68HC11/M68HC12 serial line operations
- * Copyright (C) 1999, 2001 Stephane Carrez (stcarrez@nerim.fr)	
+ * Copyright (C) 1999, 2001, 2003, 2004 Stephane Carrez (stcarrez@nerim.fr)
  *
  * The authors hereby grant permission to use, copy, modify, distribute,
  * and license this software and its documentation for any purpose, provided
@@ -12,6 +12,25 @@
  * they apply.
  */
 
+#ifdef __HAVE_SHORT_INT__
+	.mode mshort
+#else
+	.mode mlong
+#endif
+
+#if defined(__USE_RTC__)
+	.macro ret
+#if defined(mc68hc12)
+	rtc
+#else
+	jmp __return_32
+#endif
+	.endm
+#else
+	.macro ret
+	rts
+	.endm
+#endif
 #ifdef mc68hc12
 	SC0CR1 = 0xC2
 	SC0CR2 = 0xC3
@@ -39,7 +58,7 @@ L1:
 	ldab	SC0CR2,x
 	orab	#0x8
 	stab	SC0CR2,x
-	rts
+	ret
 
 	.sect .text
 	.globl inbyte
@@ -52,7 +71,7 @@ inbyte:
 	bita	#0x20
 	beq	inbyte
 	ldab	SC0CR2,x
-	rts
+	ret
 
 	.globl _sci_init
 	.sect .text
@@ -99,7 +118,7 @@ L1:
 	ldab	SCCR2,x
 	orab	#0x8
 	stab	SCCR2,x
-	rts
+	ret
 
 	.sect .text
 	.globl inbyte
@@ -112,7 +131,7 @@ inbyte:
 	bita	#0x20
 	beq	inbyte
 	ldab	SCDR,x
-	rts
+	ret
 
 	.globl _sci_init
 	.sect .text
Index: m68hc11/sim-valid-m68hc11.ld
===================================================================
RCS file: /cvs/src/src/libgloss/m68hc11/sim-valid-m68hc11.ld,v
retrieving revision 1.1
diff -u -p -r1.1 sim-valid-m68hc11.ld
--- m68hc11/sim-valid-m68hc11.ld	23 Jul 2002 21:56:27 -0000	1.1
+++ m68hc11/sim-valid-m68hc11.ld	3 Mar 2004 22:10:09 -0000
@@ -146,15 +146,21 @@ SECTIONS
   {
     *(.init) 
   } =0
+  /* Put trampolines at beginning of text at 0x4400 so that they
+     are not in memory bank window.  */
+  .tramp :
+  {
+    *(.tramp)
+  } > text
   .text  :
   {
     /* Put startup code at beginning so that _start keeps same address.  */
     /* Startup code.  */
-    *(.install0)	/* Section should setup the stack pointer.  */
-    *(.install1)	/* Place holder for applications.  */
-    *(.install2)	/* Optional installation of data sections in RAM.  */
-    *(.install3)	/* Place holder for applications.  */
-    *(.install4)	/* Section that calls the main.  */
+    KEEP (*(.install0))	/* Section should setup the stack pointer.  */
+    KEEP (*(.install1))	/* Place holder for applications.  */
+    KEEP (*(.install2))	/* Optional installation of data sections in RAM.  */
+    KEEP (*(.install3))	/* Place holder for applications.  */
+    KEEP (*(.install4))	/* Section that calls the main.  */
     *(.init)
     *(.text)
     *(.text.*)
@@ -162,11 +168,11 @@ SECTIONS
     *(.gnu.warning)
     *(.gnu.linkonce.t.*)
     /* Finish code.  */
-    *(.fini0)		/* Beginning of finish code (_exit symbol).  */
-    *(.fini1)		/* Place holder for applications.  */
-    *(.fini2)		/* C++ destructors.  */
-    *(.fini3)		/* Place holder for applications.  */
-    *(.fini4)		/* Runtime exit.  */
+    KEEP (*(.fini0))	/* Beginning of finish code (_exit symbol).  */
+    KEEP (*(.fini1))	/* Place holder for applications.  */
+    KEEP (*(.fini2))	/* C++ destructors.  */
+    KEEP (*(.fini3))	/* Place holder for applications.  */
+    KEEP (*(.fini4))	/* Runtime exit.  */
     _etext = .;
     PROVIDE (etext = .);
   }  > text
@@ -174,6 +180,10 @@ SECTIONS
   {
     *(.eh_frame)
   }  > text
+  .gcc_except_table :
+  {
+    *(.gcc_except_table)
+  } > text
   .rodata    :
   {
     *(.rodata)
@@ -188,25 +198,13 @@ SECTIONS
   .ctors   : 
   {
      PROVIDE (__CTOR_LIST__ = .); 
-    *(.ctors)
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors)) */
+     KEEP (*(.ctors))
      PROVIDE(__CTOR_END__ = .); 
   }  > text
     .dtors	  :
   {
      PROVIDE(__DTOR_LIST__ = .); 
-    *(.dtors)
-    /*
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors)) */
+     KEEP (*(.dtors))
      PROVIDE(__DTOR_END__ = .); 
   }  > text
   /* Start of the data section image in ROM.  */
@@ -274,7 +272,7 @@ SECTIONS
   PROVIDE (_vectors_addr = DEFINED (vectors_addr) ? vectors_addr : 0xffc0);
   .vectors DEFINED (vectors_addr) ? vectors_addr : 0xffc0 :
   {
-    *(.vectors)
+    KEEP (*(.vectors))
   }
   /* Stabs debugging sections.  */
   .stab		 0 : { *(.stab) }
Index: m68hc11/sim-valid-m68hc12.ld
===================================================================
RCS file: /cvs/src/src/libgloss/m68hc11/sim-valid-m68hc12.ld,v
retrieving revision 1.1
diff -u -p -r1.1 sim-valid-m68hc12.ld
--- m68hc11/sim-valid-m68hc12.ld	23 Jul 2002 21:56:27 -0000	1.1
+++ m68hc11/sim-valid-m68hc12.ld	3 Mar 2004 22:10:09 -0000
@@ -145,15 +145,21 @@ SECTIONS
   {
     *(.init) 
   } =0
+  /* Put trampolines at beginning of text at 0x4400 so that they
+     are not in memory bank window.  */
+  .tramp :
+  {
+    *(.tramp)
+  } > text
   .text  :
   {
     /* Put startup code at beginning so that _start keeps same address.  */
     /* Startup code.  */
-    *(.install0)	/* Section should setup the stack pointer.  */
-    *(.install1)	/* Place holder for applications.  */
-    *(.install2)	/* Optional installation of data sections in RAM.  */
-    *(.install3)	/* Place holder for applications.  */
-    *(.install4)	/* Section that calls the main.  */
+    KEEP (*(.install0))	/* Section should setup the stack pointer.  */
+    KEEP (*(.install1))	/* Place holder for applications.  */
+    KEEP (*(.install2))	/* Optional installation of data sections in RAM.  */
+    KEEP (*(.install3))	/* Place holder for applications.  */
+    KEEP (*(.install4))	/* Section that calls the main.  */
     *(.init)
     *(.text)
     *(.text.*)
@@ -161,11 +167,11 @@ SECTIONS
     *(.gnu.warning)
     *(.gnu.linkonce.t.*)
     /* Finish code.  */
-    *(.fini0)		/* Beginning of finish code (_exit symbol).  */
-    *(.fini1)		/* Place holder for applications.  */
-    *(.fini2)		/* C++ destructors.  */
-    *(.fini3)		/* Place holder for applications.  */
-    *(.fini4)		/* Runtime exit.  */
+    KEEP (*(.fini0))	/* Beginning of finish code (_exit symbol).  */
+    KEEP (*(.fini1))	/* Place holder for applications.  */
+    KEEP (*(.fini2))	/* C++ destructors.  */
+    KEEP (*(.fini3))	/* Place holder for applications.  */
+    KEEP (*(.fini4))	/* Runtime exit.  */
     _etext = .;
     PROVIDE (etext = .);
   }  > text
@@ -173,6 +179,10 @@ SECTIONS
   {
     *(.eh_frame)
   }  > text
+  .gcc_except_table :
+  {
+    *(.gcc_except_table)
+  } > text
   .rodata    :
   {
     *(.rodata)
@@ -187,25 +197,13 @@ SECTIONS
   .ctors   : 
   {
      PROVIDE (__CTOR_LIST__ = .); 
-    *(.ctors)
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors)) */
+     KEEP (*(.ctors))
      PROVIDE(__CTOR_END__ = .); 
   }  > text
     .dtors	  :
   {
      PROVIDE(__DTOR_LIST__ = .); 
-    *(.dtors)
-    /*
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors)) */
+     KEEP (*(.dtors))
      PROVIDE(__DTOR_END__ = .); 
   }  > text
   /* Start of the data section image in ROM.  */
@@ -274,7 +272,7 @@ SECTIONS
   PROVIDE (_vectors_addr = DEFINED (vectors_addr) ? vectors_addr : 0xffc0);
   .vectors DEFINED (vectors_addr) ? vectors_addr : 0xffc0 :
   {
-    *(.vectors)
+    KEEP (*(.vectors))
   }
   /* Stabs debugging sections.  */
   .stab		 0 : { *(.stab) }

Attachment: pgp00000.pgp
Description: PGP signature


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