xref: /OK3568_Linux_fs/buildroot/boot/lpc32xxcdl/lpc32xxcdl-2.11-libnosys_gnu.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Fix compilation and eabi issues
2
3Since we are not linking with libc anymore, we need to define our own memset,
4strlen and memcpy. Also, as we are using a *libc compiler, we need to "handle"
5exceptions (mostly division by 0) by defining raise() and
6__aeabi_unwind_cpp_pr0.
7
8Signed-off-by: Alexandre Belloni <abelloni@adeneo-embedded.com>
9---
10 csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c  |   41 +++++++++++++++++++++++
11 csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c |   41 +++++++++++++++++++++++
12 csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c |   41 +++++++++++++++++++++++
13 3 files changed, 123 insertions(+), 0 deletions(-)
14
15diff --git a/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c b/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c
16index 385b0ab..f1f0a0a 100644
17--- a/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c
18+++ b/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c
19@@ -25,6 +25,7 @@
20 #include <errno.h>
21 #include <sys/times.h>
22 #include <sys/stat.h>
23+#include <sys/types.h>
24
25 /* errno definition */
26 #undef errno
27@@ -125,4 +126,44 @@ int _write(int file, char *ptr, int len){
28     return 0;
29 }
30
31+void * memset(void * s,int c,size_t count)
32+{
33+        char *xs = (char *) s;
34+
35+        while (count--)
36+                *xs++ = c;
37+
38+        return s;
39+}
40+
41+
42+size_t strlen(const char * s)
43+{
44+        const char *sc;
45+
46+        for (sc = s; *sc != '\0'; ++sc)
47+                /* nothing */;
48+        return sc - s;
49+}
50+
51+void * memcpy(void * dest,const void *src,size_t count)
52+{
53+        char *tmp = (char *) dest, *s = (char *) src;
54+
55+        while (count--)
56+                *tmp++ = *s++;
57+
58+        return dest;
59+}
60+
61+
62+/* Dummy functions to avoid linker complaints */
63+void __aeabi_unwind_cpp_pr0(void)
64+{
65+};
66+
67+void raise(void)
68+{
69+};
70+
71 #endif /*__GNUC__*/
72diff --git a/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c b/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c
73index 385b0ab..f1f0a0a 100644
74--- a/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c
75+++ b/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c
76@@ -25,6 +25,7 @@
77 #include <errno.h>
78 #include <sys/times.h>
79 #include <sys/stat.h>
80+#include <sys/types.h>
81
82 /* errno definition */
83 #undef errno
84@@ -125,4 +126,44 @@ int _write(int file, char *ptr, int len){
85     return 0;
86 }
87
88+void * memset(void * s,int c,size_t count)
89+{
90+        char *xs = (char *) s;
91+
92+        while (count--)
93+                *xs++ = c;
94+
95+        return s;
96+}
97+
98+
99+size_t strlen(const char * s)
100+{
101+        const char *sc;
102+
103+        for (sc = s; *sc != '\0'; ++sc)
104+                /* nothing */;
105+        return sc - s;
106+}
107+
108+void * memcpy(void * dest,const void *src,size_t count)
109+{
110+        char *tmp = (char *) dest, *s = (char *) src;
111+
112+        while (count--)
113+                *tmp++ = *s++;
114+
115+        return dest;
116+}
117+
118+
119+/* Dummy functions to avoid linker complaints */
120+void __aeabi_unwind_cpp_pr0(void)
121+{
122+};
123+
124+void raise(void)
125+{
126+};
127+
128 #endif /*__GNUC__*/
129diff --git a/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c b/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c
130index cfdb674..6b50c60 100644
131--- a/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c
132+++ b/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c
133@@ -25,6 +25,7 @@
134 #include <errno.h>
135 #include <sys/times.h>
136 #include <sys/stat.h>
137+#include <sys/types.h>
138
139 /* errno definition */
140 #undef errno
141@@ -125,4 +126,44 @@ int _write(int file, char *ptr, int len){
142     return 0;
143 }
144
145+void * memset(void * s,int c,size_t count)
146+{
147+        char *xs = (char *) s;
148+
149+        while (count--)
150+                *xs++ = c;
151+
152+        return s;
153+}
154+
155+
156+size_t strlen(const char * s)
157+{
158+        const char *sc;
159+
160+        for (sc = s; *sc != '\0'; ++sc)
161+                /* nothing */;
162+        return sc - s;
163+}
164+
165+void * memcpy(void * dest,const void *src,size_t count)
166+{
167+        char *tmp = (char *) dest, *s = (char *) src;
168+
169+        while (count--)
170+                *tmp++ = *s++;
171+
172+        return dest;
173+}
174+
175+
176+/* Dummy functions to avoid linker complaints */
177+void __aeabi_unwind_cpp_pr0(void)
178+{
179+};
180+
181+void raise(void)
182+{
183+};
184+
185 #endif /*__GNUC__*/
186--
1871.7.7.3
188
189