33
33
34
34
extern " C" int errno;
35
35
36
- extern " C" ssize_t _write (int fd, const void *buf, size_t count) {
36
+ extern " C"
37
+ __attribute ((weak))
38
+ ssize_t _write(int fd, const void *buf, size_t count) {
37
39
#if defined DEBUG_RP2040_PORT
38
40
(void ) fd;
39
41
return DEBUG_RP2040_PORT.write ((const char *)buf, count);
@@ -45,15 +47,19 @@ extern "C" ssize_t _write(int fd, const void *buf, size_t count) {
45
47
#endif
46
48
}
47
49
48
- extern " C" int _chown (const char *path, uid_t owner, gid_t group) {
50
+ extern " C"
51
+ __attribute ((weak))
52
+ int _chown(const char *path, uid_t owner, gid_t group) {
49
53
(void ) path;
50
54
(void ) owner;
51
55
(void ) group;
52
56
errno = ENOSYS;
53
57
return -1 ;
54
58
}
55
59
56
- extern " C" int _close (int fd) {
60
+ extern " C"
61
+ __attribute ((weak))
62
+ int _close(int fd) {
57
63
(void ) fd;
58
64
errno = ENOSYS;
59
65
return -1 ;
@@ -72,7 +78,9 @@ extern "C" int _fork(void) {
72
78
return -1 ;
73
79
}
74
80
75
- extern " C" int _fstat (int fd, struct stat *st) {
81
+ extern " C"
82
+ __attribute ((weak))
83
+ int _fstat(int fd, struct stat *st) {
76
84
(void ) fd;
77
85
(void ) st;
78
86
errno = ENOSYS;
@@ -115,7 +123,9 @@ extern "C" void __setSystemTime(unsigned long long sec, unsigned long usec) {
115
123
__timedelta_us = newnow_us - now_us;
116
124
}
117
125
118
- extern " C" int _isatty (int file) {
126
+ extern " C"
127
+ __attribute ((weak))
128
+ int _isatty(int file) {
119
129
(void ) file;
120
130
errno = ENOSYS;
121
131
return 0 ;
@@ -128,53 +138,67 @@ extern "C" int _kill(int pid, int sig) {
128
138
return -1 ;
129
139
}
130
140
131
- extern " C" int _link (char *existing, char *newlink) {
141
+ extern " C"
142
+ __attribute ((weak))
143
+ int _link(char *existing, char *newlink) {
132
144
(void ) existing;
133
145
(void ) newlink;
134
146
errno = ENOSYS;
135
147
return -1 ;
136
148
}
137
149
138
- extern " C" int _lseek (int file, int ptr, int dir) {
150
+ extern " C"
151
+ __attribute ((weak))
152
+ int _lseek(int file, int ptr, int dir) {
139
153
(void ) file;
140
154
(void ) ptr;
141
155
(void ) dir;
142
156
errno = ENOSYS;
143
157
return -1 ;
144
158
}
145
159
146
- extern " C" int _open (char *file, int flags, int mode) {
160
+ extern " C"
161
+ __attribute ((weak))
162
+ int _open(char *file, int flags, int mode) {
147
163
(void ) file;
148
164
(void ) flags;
149
165
(void ) mode;
150
166
errno = ENOSYS;
151
167
return -1 ;
152
168
}
153
169
154
- extern " C" int _read (int file, char *ptr, int len) {
170
+ extern " C"
171
+ __attribute ((weak))
172
+ int _read(int file, char *ptr, int len) {
155
173
(void ) file;
156
174
(void ) ptr;
157
175
(void ) len;
158
176
// return Serial.read(ptr, len);
159
177
return -1 ;
160
178
}
161
179
162
- extern " C" int _readlink (const char *path, char *buf, size_t bufsize) {
180
+ extern " C"
181
+ __attribute ((weak))
182
+ int _readlink(const char *path, char *buf, size_t bufsize) {
163
183
(void ) path;
164
184
(void ) buf;
165
185
(void ) bufsize;
166
186
errno = ENOSYS;
167
187
return -1 ;
168
188
}
169
189
170
- extern " C" int _stat (const char *file, struct stat *st) {
190
+ extern " C"
191
+ __attribute ((weak))
192
+ int _stat(const char *file, struct stat *st) {
171
193
(void ) file;
172
194
(void ) st;
173
195
errno = ENOSYS;
174
196
return -1 ;
175
197
}
176
198
177
- extern " C" int _symlink (const char *path1, const char *path2) {
199
+ extern " C"
200
+ __attribute ((weak))
201
+ int _symlink(const char *path1, const char *path2) {
178
202
(void ) path1;
179
203
(void ) path2;
180
204
errno = ENOSYS;
@@ -187,7 +211,9 @@ extern "C" clock_t _times(struct tms *buf) {
187
211
return -1 ;
188
212
}
189
213
190
- extern " C" int _unlink (char *name) {
214
+ extern " C"
215
+ __attribute ((weak))
216
+ int _unlink(char *name) {
191
217
(void ) name;
192
218
errno = ENOSYS;
193
219
return -1 ;
0 commit comments