OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [rtems/] [crt0.c] - Blame information for rev 326

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 *  RTEMS Fake crt0
3
 *
4
 *  Each RTEMS BSP provides its own crt0 and linker script.  Unfortunately
5
 *  this means that crt0 and the linker script are not available as
6
 *  each tool is configured.  Without a crt0 and linker script, some
7
 *  targets do not successfully link "conftest.c" during the configuration
8
 *  process.  So this fake crt0.c provides all the symbols required to
9
 *  successfully link a program.  The resulting program will not run
10
 *  but this is enough to satisfy the autoconf macro AC_PROG_CC.
11
 */
12
 
13
#include <reent.h>
14
 
15
void rtems_provides_crt0( void ) {}  /* dummy symbol so file always has one */
16
 
17
/* RTEMS provides some of its own routines including a Malloc family */
18
 
19
void *malloc() { return 0; }
20
void *realloc() { return 0; }
21
void free() { ; }
22
void abort() { ; }
23
int raise() { return -1; }
24
 
25
#if defined(__GNUC__)
26
/*
27
 * stubs for libstdc++ rtems-threads support functions from gcc/gthr-rtems.h
28
 */
29
int rtems_gxx_once() { return -1; }
30
int rtems_gxx_key_create() { return -1; }
31
int rtems_gxx_key_delete() { return -1; }
32
void *rtems_gxx_getspecific() { return 0; }
33
int rtems_gxx_setspecific() { return -1; }
34
 
35
void rtems_gxx_mutex_init() { }
36
int rtems_gxx_mutex_lock() { return -1; }
37
int rtems_gxx_mutex_trylock() { return -1; }
38
int rtems_gxx_mutex_unlock() { return -1; }
39
 
40
void rtems_gxx_recursive_mutex_init() { }
41
int rtems_gxx_recursive_mutex_lock() { return -1; }
42
int rtems_gxx_recursive_mutex_trylock() { return -1; }
43
int rtems_gxx_recursive_mutex_unlock() { return -1; }
44
#endif
45
 
46
/* stubs for functions from reent.h */
47
int _close_r (struct _reent *r, int fd) { return -1; }
48
#if NOT_USED_BY_RTEMS
49
int _execve_r (struct _reent *r, char *, char **, char **) { return -1; }
50
#endif
51
int _fcntl_r (  struct _reent *ptr, int fd, int cmd, int arg ) { return -1;}
52
#if NOT_USED_BY_RTEMS
53
int _fork_r (struct _reent *r) { return -1; }
54
#endif
55
int _fstat_r (struct _reent *r, int fd, struct stat *buf) { return -1; }
56
int _getpid_r (struct _reent *r) { return -1; }
57
int _kill_r ( struct _reent *r, int pid, int sig ) { return -1; }
58
int _link_r ( struct _reent *ptr, const char *existing, const char *new) { return -1; }
59
_off_t _lseek_r ( struct _reent *ptr, int fd, _off_t offset, int whence ) { return -1; }
60
int _open_r (struct _reent *r, const char *buf, int flags, int mode) { return -1; }
61
_ssize_t _read_r (struct _reent *r, int fd, void *buf, size_t nbytes) { return -1; }
62
#if NOT_USED_BY_RTEMS 
63
void *_sbrk_r (struct _reent *r, ptrdiff_t) { return -1; }
64
#endif
65
int _stat_r (struct _reent *r, const char *path, struct stat *buf) { return -1; }
66
_CLOCK_T_ _times_r (struct _reent *r, struct tms *ptms) { return -1; }
67
int _unlink_r (struct _reent *r, const char *path) { return -1; }
68
#if NOT_USED_BY_RTEMS
69
int _wait_r (struct _reent *r, int *) { return -1; }
70
#endif
71
_ssize_t _write_r (struct _reent *r, int fd, const void *buf, size_t nbytes) { return -1; }
72
 
73
int isatty( int fd ) { return -1; }
74
 
75
_realloc_r() {}
76
_calloc_r() {}
77
_malloc_r() {}
78
_free_r() {}
79
 
80
/* stubs for functions required by libc/posix */
81
int getdents(int fd, void *dp, int count) { return -1; }
82
struct timespec;
83
int nanosleep(const struct timespec *req, struct timespec *rem) { return -1; }
84
int _execve(const char *path, char * const *argv, char * const *envp) { return -1; }
85
int _exit(int status) { return -1; }
86
 
87
/* gcc can implicitly generate references to these */
88
/* strcmp() {} */
89
/* strcpy() {} */
90
/* strlen() {} */
91
/* memcmp() {} */
92
/* memcpy() {} */
93
/* memset() {} */
94
 
95
/* The PowerPC expects certain symbols to be defined in the linker script. */
96
 
97
#if defined(__PPC__)
98
  int __SDATA_START__;  int __SDATA2_START__;
99
  int __GOT_START__;    int __GOT_END__;
100
  int __GOT2_START__;   int __GOT2_END__;
101
  int __SBSS_END__;     int __SBSS2_END__;
102
  int __FIXUP_START__;  int __FIXUP_END__;
103
  int __EXCEPT_START__; int __EXCEPT_END__;
104
  int __init;           int __fini;
105
  int __CTOR_LIST__;    int __CTOR_END__;
106
  int __DTOR_LIST__;    int __DTOR_END__;
107
#endif
108
 
109
/* The SH expects certain symbols to be defined in the linker script. */
110
 
111
#if defined(__sh__)
112
int __EH_FRAME_BEGIN__;
113
#endif
114
 
115
/*  The hppa expects this to be defined in the real crt0.s.
116
 *  Also for some reason, the hppa1.1 does not find atexit()
117
 *  during the AC_PROG_CC tests.
118
 */
119
 
120
#if defined(__hppa__)
121
/*
122
  asm ( ".subspa \$GLOBAL\$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40");
123
  asm ( ".export \$global\$" );
124
  asm ( "\$global\$:");
125
*/
126
 
127
  asm (".text");
128
  asm (".global");
129
  asm (".EXPORT $$dyncall,ENTRY");
130
  asm ("$$dyncall:");
131
  int atexit(void (*function)(void)) { return 0; }
132
#endif
133
 
134
 
135
/*
136
 *  The AMD a29k generates code expecting the following.
137
 */
138
 
139
#if defined(_AM29000) || defined(_AM29K)
140
asm (".global V_SPILL, V_FILL" );
141
asm (".global V_EPI_OS, V_BSD_OS" );
142
 
143
asm (".equ    V_SPILL, 64" );
144
asm (".equ    V_FILL, 65" );
145
 
146
asm (".equ    V_BSD_OS, 66" );
147
asm (".equ    V_EPI_OS, 69" );
148
#endif
149
 
150
#if defined(__AVR__)
151
/*
152
 * Initial stack pointer address "__stack"
153
 *  hard coded into GCC instead of providing it through ldscripts
154
 */
155
const char* __stack ;
156
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.