1 From 06827e81c976d16aa5861a40ac0d780b63a4d470 Mon Sep 17 00:00:00 2001
2 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 Date: Thu, 11 Apr 2013 23:02:03 +0200
4 Subject: [PATCH 8/8] arm: move check for BX to its own header
6 As Will noticed, the header this check is currently done in
7 is asm-only, and is not meant to be included from C code.
8 This breaks compilation when compiled for a Thumb2-aware CPU.
10 Move the BX check to its own header, and revert 7a246fd.
12 Reported-by: Will Newton <will.newton@gmail.com>
13 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
14 Cc: Will Newton <will.newton@gmail.com>
15 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17 ldso/ldso/arm/dl-startup.h | 2 +-
18 ldso/ldso/arm/resolve.S | 1 +
19 libc/string/arm/_memcpy.S | 1 +
20 libc/string/arm/memcmp.S | 1 +
21 libc/string/arm/memset.S | 1 +
22 libc/string/arm/strcmp.S | 1 +
23 libc/string/arm/strlen.S | 1 +
24 libc/sysdeps/linux/arm/__longjmp.S | 2 +-
25 libc/sysdeps/linux/arm/bits/arm_asm.h | 8 --------
26 libc/sysdeps/linux/arm/bits/arm_bx.h | 34 ++++++++++++++++++++++++++++++++++
27 libc/sysdeps/linux/arm/clone.S | 1 +
28 libc/sysdeps/linux/arm/mmap64.S | 1 +
29 libc/sysdeps/linux/arm/syscall-eabi.S | 1 +
30 libc/sysdeps/linux/arm/sysdep.h | 2 +-
31 libc/sysdeps/linux/arm/vfork.S | 1 +
32 15 files changed, 47 insertions(+), 11 deletions(-)
33 create mode 100644 libc/sysdeps/linux/arm/bits/arm_bx.h
35 diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h
36 index f7d6052..8d6122b 100644
37 --- a/ldso/ldso/arm/dl-startup.h
38 +++ b/ldso/ldso/arm/dl-startup.h
43 -#include <bits/arm_asm.h>
44 +#include <bits/arm_bx.h>
46 #if !defined(__thumb__)
48 diff --git a/ldso/ldso/arm/resolve.S b/ldso/ldso/arm/resolve.S
49 index 08889d0..600d3af 100644
50 --- a/ldso/ldso/arm/resolve.S
51 +++ b/ldso/ldso/arm/resolve.S
54 #include <sys/syscall.h>
55 #include <bits/arm_asm.h>
56 +#include <bits/arm_bx.h>
60 diff --git a/libc/string/arm/_memcpy.S b/libc/string/arm/_memcpy.S
61 index b26080d..c59f5b8 100644
62 --- a/libc/string/arm/_memcpy.S
63 +++ b/libc/string/arm/_memcpy.S
67 #include <bits/arm_asm.h>
68 +#include <bits/arm_bx.h>
70 #if !defined(THUMB1_ONLY)
72 diff --git a/libc/string/arm/memcmp.S b/libc/string/arm/memcmp.S
73 index 65409f4..9f78415 100644
74 --- a/libc/string/arm/memcmp.S
75 +++ b/libc/string/arm/memcmp.S
79 #include <bits/arm_asm.h>
80 +#include <bits/arm_bx.h>
84 diff --git a/libc/string/arm/memset.S b/libc/string/arm/memset.S
85 index 66aa603..6f78128 100644
86 --- a/libc/string/arm/memset.S
87 +++ b/libc/string/arm/memset.S
90 #include <sys/syscall.h>
91 #include <bits/arm_asm.h>
92 +#include <bits/arm_bx.h>
96 diff --git a/libc/string/arm/strcmp.S b/libc/string/arm/strcmp.S
97 index 97363c1..8b77ab0 100644
98 --- a/libc/string/arm/strcmp.S
99 +++ b/libc/string/arm/strcmp.S
102 #include <features.h>
103 #include <bits/arm_asm.h>
104 +#include <bits/arm_bx.h>
108 diff --git a/libc/string/arm/strlen.S b/libc/string/arm/strlen.S
109 index 949e918..141f849 100644
110 --- a/libc/string/arm/strlen.S
111 +++ b/libc/string/arm/strlen.S
114 #include <sys/syscall.h>
115 #include <bits/arm_asm.h>
116 +#include <bits/arm_bx.h>
118 /* size_t strlen(const char *S)
119 * entry: r0 -> string
120 diff --git a/libc/sysdeps/linux/arm/__longjmp.S b/libc/sysdeps/linux/arm/__longjmp.S
121 index 5faf4ec..7418dc2 100644
122 --- a/libc/sysdeps/linux/arm/__longjmp.S
123 +++ b/libc/sysdeps/linux/arm/__longjmp.S
126 #include <features.h>
127 #include <bits/arm_asm.h>
128 +#include <bits/arm_bx.h>
131 #include <bits/setjmp.h>
135 .type __longjmp,%function
137 diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
138 index 921c9a3..ff8ea92 100644
139 --- a/libc/sysdeps/linux/arm/bits/arm_asm.h
140 +++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
142 #define THUMB1_ONLY 1
145 -#if defined(__USE_BX__)
146 -# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \
147 - || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
149 -# error Use of BX was requested, but is not available on the target processor.
150 -# endif /* ARCH level */
151 -#endif /* __USE_BX__ */
153 #endif /* _ARM_ASM_H */
154 diff --git a/libc/sysdeps/linux/arm/bits/arm_bx.h b/libc/sysdeps/linux/arm/bits/arm_bx.h
156 index 0000000..321490e
158 +++ b/libc/sysdeps/linux/arm/bits/arm_bx.h
160 +/* Copyright (C) 2013 Yann E. MORIN <yann.morin.1998@free.fr>
162 + * This file is free software; you can redistribute it and/or modify
163 + * it under the terms of the GNU Lesser General Public License as
164 + * published by the Free Software Foundation; either version 2.1 of
165 + * the License, or (at your option) any later version.
167 + * This file is distributed in the hope that it will be useful, but
168 + * WITHOUT ANY WARRANTY; without even the implied warranty of
169 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
170 + * Lesser General Public License for more details.
172 + * You should have received a copy of the GNU Lesser General Public
173 + * License along with the GNU C Library; if not, see
174 + * <http://www.gnu.org/licenses/>.
180 +/* We need features.h first */
181 +#if !defined _FEATURES_H
182 +#error Please include features.h first
183 +#endif /* features.h not yet included */
185 +#if defined(__USE_BX__)
186 +# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \
187 + || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
189 +# error Use of BX was requested, but is not available on the target processor.
190 +# endif /* ARCH level */
191 +#endif /* __USE_BX__ */
193 +#endif /* _ARM_BX_H */
194 diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
195 index 1f7f09d..4d646be 100644
196 --- a/libc/sysdeps/linux/arm/clone.S
197 +++ b/libc/sysdeps/linux/arm/clone.S
199 #include <bits/errno.h>
200 #include <sys/syscall.h>
201 #include <bits/arm_asm.h>
202 +#include <bits/arm_bx.h>
204 #if defined(__NR_clone)
205 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
206 diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
207 index 7071541..bd2cfb8 100644
208 --- a/libc/sysdeps/linux/arm/mmap64.S
209 +++ b/libc/sysdeps/linux/arm/mmap64.S
211 #include <bits/errno.h>
212 #include <sys/syscall.h>
213 #include <bits/arm_asm.h>
214 +#include <bits/arm_bx.h>
216 #if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
218 diff --git a/libc/sysdeps/linux/arm/syscall-eabi.S b/libc/sysdeps/linux/arm/syscall-eabi.S
219 index b931882..019f701 100644
220 --- a/libc/sysdeps/linux/arm/syscall-eabi.S
221 +++ b/libc/sysdeps/linux/arm/syscall-eabi.S
224 #include <sys/syscall.h>
225 #include <bits/arm_asm.h>
226 +#include <bits/arm_bx.h>
228 /* In the EABI syscall interface, we don't need a special syscall to
229 implement syscall(). It won't work reliably with 64-bit arguments
230 diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
231 index e498695..9c1dbca 100644
232 --- a/libc/sysdeps/linux/arm/sysdep.h
233 +++ b/libc/sysdeps/linux/arm/sysdep.h
235 #define _LINUX_ARM_SYSDEP_H 1
237 #include <common/sysdep.h>
238 -#include <bits/arm_asm.h>
239 +#include <bits/arm_bx.h>
241 #include <sys/syscall.h>
242 /* For Linux we can use the system call table in the header file
243 diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
244 index 17d6a4d..6c55d71 100644
245 --- a/libc/sysdeps/linux/arm/vfork.S
246 +++ b/libc/sysdeps/linux/arm/vfork.S
249 #include <features.h>
250 #include <bits/arm_asm.h>
251 +#include <bits/arm_bx.h>
254 #include <bits/errno.h>