Index: c/src/lib/libbsp/powerpc/shared/ChangeLog
===================================================================
--- c/src/lib/libbsp/powerpc/shared/ChangeLog	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/ChangeLog	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -1,2 +1,17 @@
+2003-03-18  Till Straumann <strauman@slac.stanford.edu>
+
+	PR 356/bsps
+	This patch makes RTEMS/powerpc/shared EABI compliant.
+	* irq/irq_init.c, start/Makefile.am, start/start.S, startup/bspstart.c,
+	startup/pgtbl_setup.c, vectors/vectors.h, vectors/vectors_init.c:
+	zero_bss() should clear not only bss but sbss and sbss2
+	also (this is probably a bugfix, as sbss/sbss2 are
+	probably used even if -msdata=eabi is not specified).
+	* start/rtems_crti.S: New file which must
+	be linked immediately after ecrti.o. rtems_crti.o contains
+	a code snippet who lets __init() return immediately. Also,
+	a new entry point '_init' to the C++ Ctors is generated
+	for use by the RTEMS Thread_Handler.
+
 2003-02-20	Till Straumann <strauman@slac.stanford.edu>
 
Index: c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/irq/irq_init.c	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/irq/irq_init.c	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -44,7 +44,7 @@
 static pci_isa_bridge_device bridge;
 
-extern unsigned int external_exception_vector_prolog_code_size;
+extern unsigned int external_exception_vector_prolog_code_size[];
 extern void external_exception_vector_prolog_code();
-extern unsigned int decrementer_exception_vector_prolog_code_size;
+extern unsigned int decrementer_exception_vector_prolog_code_size[];
 extern void decrementer_exception_vector_prolog_code();
 
@@ -297,5 +297,5 @@
     vectorDesc.hdl.vector	=	ASM_DEC_VECTOR;
     vectorDesc.hdl.raw_hdl	=	decrementer_exception_vector_prolog_code;
-    vectorDesc.hdl.raw_hdl_size	=	(unsigned) &decrementer_exception_vector_prolog_code_size;
+    vectorDesc.hdl.raw_hdl_size	=	(unsigned) decrementer_exception_vector_prolog_code_size;
     vectorDesc.on		=	nop_func;
     vectorDesc.off		=	nop_func;
@@ -307,5 +307,5 @@
     vectorDesc.hdl.vector	=	ASM_EXT_VECTOR;
     vectorDesc.hdl.raw_hdl	=	external_exception_vector_prolog_code;
-    vectorDesc.hdl.raw_hdl_size	=	(unsigned) &external_exception_vector_prolog_code_size;
+    vectorDesc.hdl.raw_hdl_size	=	(unsigned) external_exception_vector_prolog_code_size;
     if (!mpc60x_set_exception (&vectorDesc)) {
       BSP_panic("Unable to initialize RTEMS external raw exception\n");
Index: c/src/lib/libbsp/powerpc/shared/start/Makefile.am
===================================================================
--- c/src/lib/libbsp/powerpc/shared/start/Makefile.am	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/start/Makefile.am	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -4,7 +4,7 @@
 
 
-S_FILES = start.S
+S_FILES = start.S rtems_crti.S
 
-EXTRA_DIST = start.S
+EXTRA_DIST = start.S rtems_crti.S
 
 include $(top_srcdir)/../../../../../automake/local.am
Index: c/src/lib/libbsp/powerpc/shared/start/start.S
===================================================================
--- c/src/lib/libbsp/powerpc/shared/start/start.S	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/start/start.S	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -28,5 +28,6 @@
 	li	r10,0x63	;	\
 	sc
-			
+
+		
 	.text
 	.globl	__rtems_entry_point
@@ -87,4 +88,5 @@
 enter_C_code:
 	bl	MMUon
+	bl  __eabi	/* setup EABI and SYSV environment */
 	bl	zero_bss
 	/*
Index: c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/startup/bspstart.c	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/startup/bspstart.c	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -37,7 +37,5 @@
 
 extern void _return_to_ppcbug();
-extern unsigned long __rtems_end;
-extern unsigned long _end;
-extern unsigned long __bss_start;
+extern unsigned long __rtems_end[];
 extern void L1_caches_enables();
 extern unsigned get_L2CR();
@@ -136,5 +134,5 @@
     rtems_unsigned32        heap_size;
 
-    heap_start = ((rtems_unsigned32) &__rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE;
+    heap_start = ((rtems_unsigned32) __rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE;
     if (heap_start & (CPU_ALIGNMENT-1))
         heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
@@ -154,5 +152,10 @@
 void zero_bss()
 {
-  memset(&__bss_start, 0, ((unsigned) (&__rtems_end)) - ((unsigned) &__bss_start));
+  /* prevent these from being accessed in the short data areas */
+  extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
+  extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
+  memset(__SBSS_START__, 0, ((unsigned) __SBSS_END__) - ((unsigned)__SBSS_START__));
+  memset(__SBSS2_START__, 0, ((unsigned) __SBSS2_END__) - ((unsigned)__SBSS2_START__));
+  memset(__bss_start, 0, ((unsigned) __rtems_end) - ((unsigned)__bss_start));
 }
 
@@ -210,5 +213,5 @@
    * so that It can be printed without accessing R1.
    */
-  stack = ((unsigned char*) &__rtems_end) + INIT_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
+  stack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
 
  /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
@@ -223,7 +226,10 @@
    * some settings below...
    */
-  intrStack = ((unsigned char*) &__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
-
- /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
+  intrStack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
+
+  /* make sure it's properly aligned */
+  (unsigned32)intrStack &= ~(CPU_STACK_ALIGNMENT-1);
+
+  /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
   *((unsigned32 *)intrStack) = 0;
 
@@ -358,5 +364,5 @@
     (unsigned char *)BSP_mem_size - BSP_Configuration.work_space_size;
 
-  if ( work_space_start <= ((unsigned char *)&__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE) {
+  if ( work_space_start <= ((unsigned char *)__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE) {
     printk( "bspstart: Not enough RAM!!!\n" );
     bsp_cleanup();
Index: c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -51,5 +51,5 @@
 	 * NOTE THAT THE CORRECTNESS OF THE LINKER SCRIPT IS CRUCIAL
 	 */
-	extern unsigned long __DATA_START__, _etext;
+	extern unsigned long __DATA_START__[], _etext[];
 
 	/* map text and RO data read-only */
@@ -58,5 +58,5 @@
 						TRIV121_121_VSID,
 						0,
-						(PAGE_ALIGN((unsigned long)&_etext) - 0) >> PG_SHIFT,
+						(PAGE_ALIGN((unsigned long)_etext) - 0) >> PG_SHIFT,
 						0, /* WIMG */
 						TRIV121_PP_RO_PAGE);
@@ -70,6 +70,6 @@
 						pt,
 						TRIV121_121_VSID,
-						(unsigned long)&__DATA_START__,
-						(*pmemsize - (1<<ldPtSize) -  (unsigned long)&__DATA_START__ )>> PG_SHIFT,
+						(unsigned long)__DATA_START__,
+						(*pmemsize - (1<<ldPtSize) -  (unsigned long)__DATA_START__ )>> PG_SHIFT,
 						0, /* WIMG */
 						TRIV121_PP_RW_PAGE);
Index: c/src/lib/libbsp/powerpc/shared/vectors/vectors.h
===================================================================
--- c/src/lib/libbsp/powerpc/shared/vectors/vectors.h	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/vectors/vectors.h	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -76,5 +76,9 @@
 
 extern	void default_exception_vector_code_prolog();
-extern	int  default_exception_vector_code_prolog_size;
+/* This symbol is generated by the linker; prevent it from
+ * being accessed in one of the short data areas by declaring
+ * it as an array
+ */
+extern	int  default_exception_vector_code_prolog_size[];
 
 /* codemove is like memmove, but it also gets the cache line size
Index: c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c	(revision 2e0ee93e04753650c0b6eee42159fa98a0a1e2de)
+++ c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c	(revision 2ae52c7583f4f02c415b1721a9db958f10b212e9)
@@ -161,5 +161,5 @@
    * is not a bug as it is defined a .set directly in asm...
    */
-  exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) &default_exception_vector_code_prolog_size;
+  exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) default_exception_vector_code_prolog_size;
   for (i=0; i <= exception_config.exceptSize; i++) {
     if (!mpc60x_vector_is_valid (i)) {
