Index: c/src/lib/libbsp/powerpc/motorola_powerpc/ChangeLog
===================================================================
--- c/src/lib/libbsp/powerpc/motorola_powerpc/ChangeLog	(revision 69efcbc136263616ba5f203dcfad79ca3c5bc976)
+++ c/src/lib/libbsp/powerpc/motorola_powerpc/ChangeLog	(revision 5d81ce9b3d3eebde9e48944e94bbc51ef5c58d21)
@@ -1,2 +1,9 @@
+2002-11-14      Greg Menke <gregory.menke@gsfc.nasa.gov>
+
+	* bsp_specs: Added crtbegin,crtend objects so C++ global objects
+	constructors/destructors run correctly.  
+	* startup/linkcmds: Increased code length and updated the ctor/dtor
+	sections to handle crtbegin, crtend objects.
+> 	
 2002-10-21	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs
===================================================================
--- c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs	(revision 69efcbc136263616ba5f203dcfad79ca3c5bc976)
+++ c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs	(revision 5d81ce9b3d3eebde9e48944e94bbc51ef5c58d21)
@@ -11,9 +11,9 @@
 %{!qrtems: %(old_lib)} %{!nostdlib: %{qrtems: --start-group \
 %{!qrtems_debug: -lrtemsbsp -lrtemscpu} %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g} \
--lc -lgcc --end-group  ecrtn%O%s \
+-lc -lgcc --end-group  \
 %{!qnolinkcmds: -T linkcmds%s}}}
 
 *startfile:
-%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems:  ecrti%O%s \
+%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems:  ecrti%O%s  crtbegin.o%s  \
 %{!qrtems_debug: start.o%s} \
 %{qrtems_debug: start_g.o%s}}}
@@ -22,2 +22,4 @@
 %{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -e __rtems_entry_point -u __vectors}
 
+*endfile:
+%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s}
Index: c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds
===================================================================
--- c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds	(revision 69efcbc136263616ba5f203dcfad79ca3c5bc976)
+++ c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds	(revision 5d81ce9b3d3eebde9e48944e94bbc51ef5c58d21)
@@ -8,5 +8,5 @@
 MEMORY {
 	VECTORS	: ORIGIN = 0x0 ,  LENGTH = 0x3000
-	CODE : ORIGIN = 0x3000 , LENGTH = 0x100000 
+	CODE : ORIGIN = 0x3000 , LENGTH = 0x200000 
 }
 SECTIONS
@@ -60,6 +60,6 @@
     *(.gnu.linkonce.t*)
   }  > CODE
-  .init		  : { _init = .; *(.init)	} >CODE
-  .fini		  : { _fini = .; *(.fini)	} >CODE
+  .init		  : { _init = .; KEEP(*(.init))	} >CODE
+  .fini		  : { _fini = .; KEEP(*(.fini))	} >CODE
   .rodata         : { *(.rodata*) *(.gnu.linkonce.r*) }	> CODE
   .rodata1        : { *(.rodata1) }	> CODE
@@ -67,4 +67,23 @@
   _etext = .;
   PROVIDE (etext = .);
+
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  */
+  . = ALIGN(0x10000) + (. & (0x10000 - 1));
+  /* Ensure the __preinit_array_start label is properly aligned.  We
+     could instead move the label definition inside the section, but
+     the linker would then create the section even if it turns out to
+     be empty, which isn't pretty.  */
+  . = ALIGN(32 / 8);
+  PROVIDE (__preinit_array_start = .);
+  .preinit_array     : { *(.preinit_array) } >CODE
+  PROVIDE (__preinit_array_end = .);
+  PROVIDE (__init_array_start = .);
+  .init_array     : { *(.init_array) } >CODE
+  PROVIDE (__init_array_end = .);
+  PROVIDE (__fini_array_start = .);
+  .fini_array     : { *(.fini_array) } >CODE
+  PROVIDE (__fini_array_end = .);
+
   .sdata2   	  : { *(.sdata2) *(.gnu.linkonce.s2.*)	} >CODE
   .sbss2   	  : { *(.sbss2) *(.gnu.linkonce.sb2.*)	} >CODE
@@ -88,5 +107,5 @@
     *(.data)
     *(.gnu.linkonce.d*)	
-    CONSTRUCTORS
+    SORT(CONSTRUCTORS)
   } > CODE
   .data1   : { *(.data1) }	> CODE
@@ -101,4 +120,7 @@
                 PROVIDE (_GOT2_START_ = .);
   .got2           :  { *(.got2) }	> CODE
+
+
+/* removed 11/14, gregm
                 PROVIDE (__CTOR_LIST__ = .);
   .ctors          : { *(.ctors) }	> CODE
@@ -107,4 +129,36 @@
   .dtors          : { *(.dtors) }	> CODE
                 PROVIDE (__DTOR_END__ = .);
+*/
+
+
+  .ctors          :
+  {
+    /* gcc uses crtbegin.o to find the start of
+       the constructors, so we make sure it is
+       first.  Because this is a wildcard, it
+       doesn't matter if the user does not
+       actually link against crtbegin.o; the
+       linker won't look for a file to match a
+       wildcard.  The wildcard also means that it
+       doesn't matter which directory crtbegin.o
+       is in.  */
+    KEEP (*crtbegin.o(.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))
+  } > CODE
+  .dtors          :
+  {
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+  } > CODE
+
+
                 PROVIDE (_FIXUP_START_ = .);
   .fixup          : { *(.fixup) }	> CODE
@@ -112,7 +166,12 @@
                 PROVIDE (_GOT2_END_ = .);
                 PROVIDE (_GOT_START_ = .);
+
   .got            : { *(.got) }	> CODE
   .got.plt        : { *(.got.plt) }	> CODE
+
                 PROVIDE (_GOT_END_ = .);
+
+  .jcr            : { KEEP (*(.jcr)) } > CODE
+
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
