c3031b418bdc3324d2e12c7a9d5761741e39dc3d
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0008-arm-move-check-for-BX-to-its-own-header.patch
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
5
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.
9
10 Move the BX check to its own header, and revert 7a246fd.
11
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>
16 ---
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
34
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
39 @@ -7,7 +7,7 @@
40   */
41  
42  #include <features.h>
43 -#include <bits/arm_asm.h>
44 +#include <bits/arm_bx.h>
45  
46  #if !defined(__thumb__)
47  __asm__(
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
52 @@ -92,6 +92,7 @@
53  
54  #include <sys/syscall.h>
55  #include <bits/arm_asm.h>
56 +#include <bits/arm_bx.h>
57  
58  #include <features.h>
59  
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
64 @@ -40,6 +40,7 @@
65  #include <features.h>
66  #include <endian.h>
67  #include <bits/arm_asm.h>
68 +#include <bits/arm_bx.h>
69  
70  #if !defined(THUMB1_ONLY)
71  /*
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
76 @@ -31,6 +31,7 @@
77  
78  #include <features.h>
79  #include <bits/arm_asm.h>
80 +#include <bits/arm_bx.h>
81  
82  .text
83  .global memcmp
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
88 @@ -20,6 +20,7 @@
89  #include <features.h>
90  #include <sys/syscall.h>
91  #include <bits/arm_asm.h>
92 +#include <bits/arm_bx.h>
93  
94  .text
95  .global memset
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
100 @@ -31,6 +31,7 @@
101  
102  #include <features.h>
103  #include <bits/arm_asm.h>
104 +#include <bits/arm_bx.h>
105  
106  .text
107  .global strcmp
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
112 @@ -21,6 +21,7 @@
113  #include <endian.h>
114  #include <sys/syscall.h>
115  #include <bits/arm_asm.h>
116 +#include <bits/arm_bx.h>
117  
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
124 @@ -19,11 +19,11 @@
125  
126  #include <features.h>
127  #include <bits/arm_asm.h>
128 +#include <bits/arm_bx.h>
129  #define _SETJMP_H
130  #define _ASM
131  #include <bits/setjmp.h>
132  
133 -
134  .global __longjmp
135  .type __longjmp,%function
136  .align 2
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
141 @@ -24,12 +24,4 @@
142  #define THUMB1_ONLY 1
143  #endif
144  
145 -#if defined(__USE_BX__)
146 -# if (   defined (__ARM_ARCH_2__)  || defined (__ARM_ARCH_3__) \
147 -      || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
148 -     )
149 -#  error Use of BX was requested, but is not available on the target processor.
150 -# endif /* ARCH level */
151 -#endif /* __USE_BX__ */
152 -
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
155 new file mode 100644
156 index 0000000..321490e
157 --- /dev/null
158 +++ b/libc/sysdeps/linux/arm/bits/arm_bx.h
159 @@ -0,0 +1,34 @@
160 +/* Copyright (C) 2013 Yann E. MORIN <yann.morin.1998@free.fr>
161 + *
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.
166 + *
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.
171 + *
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/>.
175 + */
176 +
177 +#ifndef _ARM_BX_H
178 +#define _ARM_BX_H
179 +
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 */
184 +
185 +#if defined(__USE_BX__)
186 +# if (   defined (__ARM_ARCH_2__)  || defined (__ARM_ARCH_3__) \
187 +      || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
188 +     )
189 +#  error Use of BX was requested, but is not available on the target processor.
190 +# endif /* ARCH level */
191 +#endif /* __USE_BX__ */
192 +
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
198 @@ -25,6 +25,7 @@
199  #include <bits/errno.h>
200  #include <sys/syscall.h>
201  #include <bits/arm_asm.h>
202 +#include <bits/arm_bx.h>
203  
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
210 @@ -21,6 +21,7 @@
211  #include <bits/errno.h>
212  #include <sys/syscall.h>
213  #include <bits/arm_asm.h>
214 +#include <bits/arm_bx.h>
215  
216  #if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
217  
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
222 @@ -18,6 +18,7 @@
223  
224  #include <sys/syscall.h>
225  #include <bits/arm_asm.h>
226 +#include <bits/arm_bx.h>
227  
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
234 @@ -21,7 +21,7 @@
235  #define _LINUX_ARM_SYSDEP_H 1
236  
237  #include <common/sysdep.h>
238 -#include <bits/arm_asm.h>
239 +#include <bits/arm_bx.h>
240  
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
247 @@ -7,6 +7,7 @@
248  
249  #include <features.h>
250  #include <bits/arm_asm.h>
251 +#include <bits/arm_bx.h>
252  
253  #define _ERRNO_H
254  #include <bits/errno.h>
255 -- 
256 1.8.1.2
257