change log for rtems (2010-08-03)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue Aug 3 22:10:19 UTC 2010


 *joel*:
2010-08-03	Joel Sherrill <joel.sherrilL at OARcorp.com>

	* shared/startup/sbrk.c: Make bsp's sbrk a weak reference so that the
	test of having sbrk() support in malloc can link.

M  1.236  c/src/lib/libbsp/powerpc/ChangeLog
M   1.10  c/src/lib/libbsp/powerpc/shared/startup/sbrk.c

diff -u rtems/c/src/lib/libbsp/powerpc/ChangeLog:1.235 rtems/c/src/lib/libbsp/powerpc/ChangeLog:1.236
--- rtems/c/src/lib/libbsp/powerpc/ChangeLog:1.235	Wed Jul  7 09:08:04 2010
+++ rtems/c/src/lib/libbsp/powerpc/ChangeLog	Tue Aug  3 17:02:30 2010
@@ -1,3 +1,8 @@
+2010-08-03	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	* shared/startup/sbrk.c: Make bsp's sbrk a weak reference so that the
+	test of having sbrk() support in malloc can link.
+
 2010-07-07	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	PR 1606/cpukit

diff -u rtems/c/src/lib/libbsp/powerpc/shared/startup/sbrk.c:1.9 rtems/c/src/lib/libbsp/powerpc/shared/startup/sbrk.c:1.10
--- rtems/c/src/lib/libbsp/powerpc/shared/startup/sbrk.c:1.9	Sun Nov 29 22:29:47 2009
+++ rtems/c/src/lib/libbsp/powerpc/shared/startup/sbrk.c	Tue Aug  3 17:02:30 2010
@@ -7,13 +7,13 @@
  * ----------
  * This software was created by
  *     Till Straumann <strauman at slac.stanford.edu>, 2002,
- * 	   Stanford Linear Accelerator Center, Stanford University.
+ *        Stanford Linear Accelerator Center, Stanford University.
  *
  * Acknowledgement of sponsorship
  * ------------------------------
  * This software was produced by
  *     the Stanford Linear Accelerator Center, Stanford University,
- * 	   under Contract DE-AC03-76SFO0515 with the Department of Energy.
+ *        under Contract DE-AC03-76SFO0515 with the Department of Energy.
  *
  * Government disclaimer of liability
  * ----------------------------------
@@ -100,40 +100,45 @@
     /* clip at LIMIT_32M */
     rval = remaining_start + remaining_size - LIMIT_32M;
     *heap_size_p = LIMIT_32M - remaining_start;
-	remaining_start = LIMIT_32M;
-	remaining_size  = rval;
+    remaining_start = LIMIT_32M;
+    remaining_size  = rval;
   }
 
   if ( 0 != &BSP_sbrk_policy ) {
-  	switch ( BSP_sbrk_policy ) {
-		case (uint32_t)(-1):
-			*heap_size_p    += rval;
-			remaining_start  = heap_start + *heap_size_p;
-			remaining_size   = 0;
-			/* return a nonzero sbrk_amount because the libsupport code
-			 * at some point divides by this number prior to trying an
-			 * sbrk() which will fail.
-			 */
-			rval = 1;
-		break;
-
-		case 0:
-			remaining_size = 0;
-			/* see above for why we return 1 */
-			rval = 1;
-		break;
-
-		default:
-			if ( rval > BSP_sbrk_policy )
-				rval = BSP_sbrk_policy;
-		break;
-	}
+    switch ( BSP_sbrk_policy ) {
+      case (uint32_t)(-1):
+	*heap_size_p    += rval;
+	remaining_start  = heap_start + *heap_size_p;
+	remaining_size   = 0;
+	/* return a nonzero sbrk_amount because the libsupport code
+	 * at some point divides by this number prior to trying an
+	 * sbrk() which will fail.
+	 */
+	rval = 1;
+	break;
+
+      case 0:
+	remaining_size = 0;
+	/* see above for why we return 1 */
+	rval = 1;
+	break;
+
+      default:
+	if ( rval > BSP_sbrk_policy )
+	    rval = BSP_sbrk_policy;
+	break;
+    }
   }
 
   return rval;
 }
 
-void * sbrk(ptrdiff_t incr)
+/*
+ * This is just so the sbrk test can force its magic. All normal applications
+ * should just use the default implementation in this file.
+ */
+void *sbrk(ptrdiff_t incr) __attribute__ (( weak, alias("bsp_sbrk") ));
+void *bsp_sbrk(ptrdiff_t incr)
 {
   void *rval=(void*)-1;
 
@@ -145,8 +150,8 @@
   } else {
     errno = ENOMEM;
   }
-#ifdef DEBUG
-  printk("************* SBRK 0x%08x (ret 0x%08x) **********\n", incr, rval);
-#endif
+  #ifdef DEBUG
+    printk("************* SBRK 0x%08x (ret 0x%08x) **********\n", incr, rval);
+  #endif
   return rval;
 }



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100803/32f5f586/attachment.html>


More information about the vc mailing list