4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-27 01:27:21 +08:00
Jeff Law dc7ee58132 Fix newlib H8/300 bits for C99/gcc-14
Similar to other patches.  This adds a missing prototype and #include to some
H8/300 specific code in newlib.  Pushed to the trunk given Jeff J's
pre-approval for these kinds of changes.
2023-12-22 20:25:10 -07:00

31 lines
554 B
C

#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
register char *stack_ptr asm ("sp");
extern int _write (int, char *, int);
caddr_t
_sbrk(incr)
int incr;
{
extern char end; /* Defined by the linker */
static char *heap_end;
char *prev_heap_end;
if (heap_end == 0)
{
heap_end = &end;
}
prev_heap_end = heap_end;
if (heap_end + incr > stack_ptr)
{
_write (1, "Heap and stack collision\n", 25);
abort ();
}
heap_end += incr;
return (caddr_t)prev_heap_end;
}