1- From 0e1475e5112b986ef5d9caee23dac554c749c54b Mon Sep 17 00:00:00 2001
2- From: David Candler <david.candler @arm.com>
3- Date: Thu, 28 Nov 2024 15:31:35 +0000
4- Subject: [PATCH] Enable newlib build
1+ From ff1718e7c6fdb4cace44c90213a00bc6db6450f5 Mon Sep 17 00:00:00 2001
2+ From: Volodymyr Turanskyy <volodymyr.turanskyy @arm.com>
3+ Date: Thu, 2 Jan 2025 16:23:27 +0000
4+ Subject: [PATCH] Update patch for newlib-4.5.0 tag
55
6+ Change-Id: Iec24f4305ad35a3a6df1672bb14555bf81249130
67---
7- libgloss/aarch64/syscalls.c | 6 ++
8- libgloss/arm/cpu-init/rdimon-aem.S | 107 ++++++++++++------------
9- libgloss/arm/crt0.S | 2 +-
10- libgloss/arm/linux-crt0.c | 2 +-
11- libgloss/arm/syscalls.c | 6 +-
12- libgloss/arm/trap.S | 2 +-
13- libgloss/libnosys/configure | 2 +-
14- newlib/libc/include/sys/features.h | 2 +
15- newlib/libc/machine/aarch64/memchr.S | 6 +-
16- newlib/libc/machine/aarch64/strchr.S | 6 +-
17- newlib/libc/machine/aarch64/strchrnul.S | 6 +-
18- newlib/libc/machine/aarch64/strrchr.S | 10 +--
19- newlib/libc/stdlib/aligned_alloc.c | 1 +
20- newlib/libc/sys/arm/crt0.S | 2 +-
21- newlib/libc/sys/arm/trap.S | 2 +-
22- newlib/libm/machine/arm/sf_ceil.c | 2 +-
23- newlib/libm/machine/arm/sf_floor.c | 2 +-
24- newlib/libm/machine/arm/sf_nearbyint.c | 2 +-
25- newlib/libm/machine/arm/sf_rint.c | 2 +-
26- newlib/libm/machine/arm/sf_round.c | 2 +-
27- newlib/libm/machine/arm/sf_trunc.c | 2 +-
28- 21 files changed, 92 insertions(+), 82 deletions(-)
8+ libgloss/aarch64/syscalls.c | 6 ++
9+ libgloss/arm/cpu-init/rdimon-aem.S | 107 +++++++++++++++--------------
10+ libgloss/arm/crt0.S | 2 +-
11+ libgloss/arm/linux-crt0.c | 2 +-
12+ libgloss/arm/syscalls.c | 6 +-
13+ libgloss/arm/trap.S | 2 +-
14+ newlib/libc/include/sys/features.h | 2 +
15+ newlib/libc/machine/arm/setjmp.S | 4 +-
16+ newlib/libc/sys/arm/crt0.S | 2 +-
17+ newlib/libc/sys/arm/trap.S | 2 +-
18+ 10 files changed, 72 insertions(+), 63 deletions(-)
2919
3020diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c
31- index 7343cc61f..2c4b63c17 100644
21+ index 5b4071893..cfe1d6d23 100644
3222--- a/libgloss/aarch64/syscalls.c
3323+++ b/libgloss/aarch64/syscalls.c
3424@@ -172,6 +172,12 @@ newslot (void)
@@ -325,10 +315,10 @@ index 95b86e4d4..b91034ae6 100644
325315 movt r9, #0xff0f
326316 and r8, r8, r9
327317diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
328- index 8490bde2f..8b85b28f4 100644
318+ index 9ff0e6323..b9e768007 100644
329319--- a/libgloss/arm/crt0.S
330320+++ b/libgloss/arm/crt0.S
331- @@ -565 ,7 +565 ,7 @@ change_back:
321+ @@ -566 ,7 +566 ,7 @@ change_back:
332322
333323 /* For Thumb, constants must be after the code since only
334324 positive offsets are supported for PC relative addresses. */
@@ -351,7 +341,7 @@ index 6b2d62a9b..000a2c728 100644
351341 #endif
352342 {
353343diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c
354- index fc394f94b..0b3287df4 100644
344+ index 710a741ee..9e710b09a 100644
355345--- a/libgloss/arm/syscalls.c
356346+++ b/libgloss/arm/syscalls.c
357347@@ -180,7 +180,7 @@ initialise_monitor_handles (void)
@@ -393,21 +383,8 @@ index 845ad0173..2056c2adf 100644
393383 .global __rt_stkovf_split_big
394384 .global __rt_stkovf_split_small
395385
396- diff --git a/libgloss/libnosys/configure b/libgloss/libnosys/configure
397- index 7c23c7a0a..2fc584169 100755
398- --- a/libgloss/libnosys/configure
399- +++ b/libgloss/libnosys/configure
400- @@ -2058,7 +2058,7 @@ case "${target}" in
401- esac
402-
403- case "${target}" in
404- - *-*-elf)
405- + *-*-elf|*-*-eabi*)
406- $as_echo "#define HAVE_ELF 1" >>confdefs.h
407-
408-
409386diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
410- index 218807178..b86caeaff 100644
387+ index 325acdf5f..12cb6465b 100644
411388--- a/newlib/libc/include/sys/features.h
412389+++ b/newlib/libc/include/sys/features.h
413390@@ -27,6 +27,8 @@ extern "C" {
@@ -419,152 +396,28 @@ index 218807178..b86caeaff 100644
419396 /* Macro to test version of GCC. Returns 0 for non-GCC or too old GCC. */
420397 #ifndef __GNUC_PREREQ
421398 # if defined __GNUC__ && defined __GNUC_MINOR__
422- diff --git a/newlib/libc/machine/aarch64/memchr.S b/newlib/libc/machine/aarch64/memchr.S
423- index 53f5d6bc0..81fcecccd 100644
424- --- a/newlib/libc/machine/aarch64/memchr.S
425- +++ b/newlib/libc/machine/aarch64/memchr.S
426- @@ -110,7 +110,7 @@ def_fn memchr
427- and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
428- addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */
429- addp vend.16b, vend.16b, vend.16b /* 128->64 */
430- - mov synd, vend.2d[0]
431- + mov synd, vend.d[0]
432- /* Clear the soff*2 lower bits */
433- lsl tmp, soff, #1
434- lsr synd, synd, tmp
435- @@ -130,7 +130,7 @@ def_fn memchr
436- /* Use a fast check for the termination condition */
437- orr vend.16b, vhas_chr1.16b, vhas_chr2.16b
438- addp vend.2d, vend.2d, vend.2d
439- - mov synd, vend.2d[0]
440- + mov synd, vend.d[0]
441- /* We're not out of data, loop if we haven't found the character */
442- cbz synd, .Lloop
443-
444- @@ -140,7 +140,7 @@ def_fn memchr
445- and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
446- addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */
447- addp vend.16b, vend.16b, vend.16b /* 128->64 */
448- - mov synd, vend.2d[0]
449- + mov synd, vend.d[0]
450- /* Only do the clear for the last possible block */
451- b.hi .Ltail
452-
453- diff --git a/newlib/libc/machine/aarch64/strchr.S b/newlib/libc/machine/aarch64/strchr.S
454- index 2448dbc7d..706107836 100644
455- --- a/newlib/libc/machine/aarch64/strchr.S
456- +++ b/newlib/libc/machine/aarch64/strchr.S
457- @@ -117,7 +117,7 @@ def_fn strchr
458- addp vend1.16b, vend1.16b, vend2.16b // 128->64
459- lsr tmp1, tmp3, tmp1
460-
461- - mov tmp3, vend1.2d[0]
462- + mov tmp3, vend1.d[0]
463- bic tmp1, tmp3, tmp1 // Mask padding bits.
464- cbnz tmp1, .Ltail
465-
466- @@ -132,7 +132,7 @@ def_fn strchr
467- orr vend2.16b, vhas_nul2.16b, vhas_chr2.16b
468- orr vend1.16b, vend1.16b, vend2.16b
469- addp vend1.2d, vend1.2d, vend1.2d
470- - mov tmp1, vend1.2d[0]
471- + mov tmp1, vend1.d[0]
472- cbz tmp1, .Lloop
473-
474- /* Termination condition found. Now need to establish exactly why
475- @@ -146,7 +146,7 @@ def_fn strchr
476- addp vend1.16b, vend1.16b, vend2.16b // 256->128
477- addp vend1.16b, vend1.16b, vend2.16b // 128->64
478-
479- - mov tmp1, vend1.2d[0]
480- + mov tmp1, vend1.d[0]
481- .Ltail:
482- /* Count the trailing zeros, by bit reversing... */
483- rbit tmp1, tmp1
484- diff --git a/newlib/libc/machine/aarch64/strchrnul.S b/newlib/libc/machine/aarch64/strchrnul.S
485- index a0ac13b7f..fd2002f0d 100644
486- --- a/newlib/libc/machine/aarch64/strchrnul.S
487- +++ b/newlib/libc/machine/aarch64/strchrnul.S
488- @@ -109,7 +109,7 @@ def_fn strchrnul
489- addp vend1.16b, vend1.16b, vend1.16b // 128->64
490- lsr tmp1, tmp3, tmp1
491-
492- - mov tmp3, vend1.2d[0]
493- + mov tmp3, vend1.d[0]
494- bic tmp1, tmp3, tmp1 // Mask padding bits.
495- cbnz tmp1, .Ltail
496-
497- @@ -124,7 +124,7 @@ def_fn strchrnul
498- orr vhas_chr2.16b, vhas_nul2.16b, vhas_chr2.16b
499- orr vend1.16b, vhas_chr1.16b, vhas_chr2.16b
500- addp vend1.2d, vend1.2d, vend1.2d
501- - mov tmp1, vend1.2d[0]
502- + mov tmp1, vend1.d[0]
503- cbz tmp1, .Lloop
504-
505- /* Termination condition found. Now need to establish exactly why
506- @@ -134,7 +134,7 @@ def_fn strchrnul
507- addp vend1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128
508- addp vend1.16b, vend1.16b, vend1.16b // 128->64
509-
510- - mov tmp1, vend1.2d[0]
511- + mov tmp1, vend1.d[0]
512- .Ltail:
513- /* Count the trailing zeros, by bit reversing... */
514- rbit tmp1, tmp1
515- diff --git a/newlib/libc/machine/aarch64/strrchr.S b/newlib/libc/machine/aarch64/strrchr.S
516- index d64fc09b1..1b6f07562 100644
517- --- a/newlib/libc/machine/aarch64/strrchr.S
518- +++ b/newlib/libc/machine/aarch64/strrchr.S
519- @@ -120,10 +120,10 @@ def_fn strrchr
520- addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128
521- addp vhas_nul1.16b, vhas_nul1.16b, vhas_nul1.16b // 128->64
522- addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr1.16b // 128->64
523- - mov nul_match, vhas_nul1.2d[0]
524- + mov nul_match, vhas_nul1.d[0]
525- lsl tmp1, tmp1, #1
526- mov const_m1, #~0
527- - mov chr_match, vhas_chr1.2d[0]
528- + mov chr_match, vhas_chr1.d[0]
529- lsr tmp3, const_m1, tmp1
530-
531- bic nul_match, nul_match, tmp3 // Mask padding bits.
532- @@ -146,15 +146,15 @@ def_fn strrchr
533- addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128
534- addp vend1.16b, vend1.16b, vend1.16b // 128->64
535- addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr1.16b // 128->64
536- - mov nul_match, vend1.2d[0]
537- - mov chr_match, vhas_chr1.2d[0]
538- + mov nul_match, vend1.d[0]
539- + mov chr_match, vhas_chr1.d[0]
540- cbz nul_match, .Lloop
541-
542- and vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
543- and vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
544- addp vhas_nul1.16b, vhas_nul1.16b, vhas_nul2.16b
545- addp vhas_nul1.16b, vhas_nul1.16b, vhas_nul1.16b
546- - mov nul_match, vhas_nul1.2d[0]
547- + mov nul_match, vhas_nul1.d[0]
548-
549- .Ltail:
550- /* Work out exactly where the string ends. */
551- diff --git a/newlib/libc/stdlib/aligned_alloc.c b/newlib/libc/stdlib/aligned_alloc.c
552- index feb22c24b..06b3883cf 100644
553- --- a/newlib/libc/stdlib/aligned_alloc.c
554- +++ b/newlib/libc/stdlib/aligned_alloc.c
555- @@ -28,6 +28,7 @@
556-
557- #include <reent.h>
558- #include <stdlib.h>
559- + #include <malloc.h>
560-
561- void *
562- aligned_alloc (size_t align, size_t size)
399+ diff --git a/newlib/libc/machine/arm/setjmp.S b/newlib/libc/machine/arm/setjmp.S
400+ index 0070f17cd..a53f7918e 100644
401+ --- a/newlib/libc/machine/arm/setjmp.S
402+ +++ b/newlib/libc/machine/arm/setjmp.S
403+ @@ -78,10 +78,10 @@
404+ covers all the cases we need in this file for hardware
405+ floating-point and should be compatible with all required FPUs
406+ that we need to support. */
407+ - # if __ARM_FP
408+ + # if __ARM_FP && !__clang__
409+ .fpu vfpxd
410+ # endif
411+ - # if __ARM_FEATURE_MVE
412+ + # if __ARM_FEATURE_MVE && !__clang__
413+ .arch_extension mve
414+ # endif
415+ #endif
563416diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S
564- index 5e677a23c..6faf74096 100644
417+ index dae0f0465..51e86d549 100644
565418--- a/newlib/libc/sys/arm/crt0.S
566419+++ b/newlib/libc/sys/arm/crt0.S
567- @@ -556 ,7 +556 ,7 @@ change_back:
420+ @@ -557 ,7 +557 ,7 @@ change_back:
568421
569422 /* For Thumb, constants must be after the code since only
570423 positive offsets are supported for PC relative addresses. */
@@ -586,84 +439,6 @@ index 681b3dbe0..8a49f39f3 100644
586439 .global __rt_stkovf_split_big
587440 .global __rt_stkovf_split_small
588441
589- diff --git a/newlib/libm/machine/arm/sf_ceil.c b/newlib/libm/machine/arm/sf_ceil.c
590- index b6efbff0b..44fdf834a 100644
591- --- a/newlib/libm/machine/arm/sf_ceil.c
592- +++ b/newlib/libm/machine/arm/sf_ceil.c
593- @@ -24,7 +24,7 @@
594- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
595- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
596-
597- - #if __ARM_ARCH >= 8 && !defined (__SOFTFP__)
598- + #if __ARM_ARCH >= 8 && (__ARM_FP & 0x4) && !defined (__SOFTFP__)
599- #include <math.h>
600-
601- float
602- diff --git a/newlib/libm/machine/arm/sf_floor.c b/newlib/libm/machine/arm/sf_floor.c
603- index 7bc95808c..44c38c42c 100644
604- --- a/newlib/libm/machine/arm/sf_floor.c
605- +++ b/newlib/libm/machine/arm/sf_floor.c
606- @@ -24,7 +24,7 @@
607- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
608- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
609-
610- - #if __ARM_ARCH >= 8 && !defined (__SOFTFP__)
611- + #if __ARM_ARCH >= 8 && (__ARM_FP & 0x4) && !defined (__SOFTFP__)
612- #include <math.h>
613-
614- float
615- diff --git a/newlib/libm/machine/arm/sf_nearbyint.c b/newlib/libm/machine/arm/sf_nearbyint.c
616- index c70d84442..126673e97 100644
617- --- a/newlib/libm/machine/arm/sf_nearbyint.c
618- +++ b/newlib/libm/machine/arm/sf_nearbyint.c
619- @@ -24,7 +24,7 @@
620- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
621- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
622-
623- - #if __ARM_ARCH >= 8 && !defined (__SOFTFP__)
624- + #if __ARM_ARCH >= 8 && (__ARM_FP & 0x4) && !defined (__SOFTFP__)
625- #include <math.h>
626-
627- float
628- diff --git a/newlib/libm/machine/arm/sf_rint.c b/newlib/libm/machine/arm/sf_rint.c
629- index d9c383a7e..5def21009 100644
630- --- a/newlib/libm/machine/arm/sf_rint.c
631- +++ b/newlib/libm/machine/arm/sf_rint.c
632- @@ -24,7 +24,7 @@
633- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
634- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
635-
636- - #if __ARM_ARCH >= 8 && !defined (__SOFTFP__)
637- + #if __ARM_ARCH >= 8 && (__ARM_FP & 0x4) && !defined (__SOFTFP__)
638- #include <math.h>
639-
640- float
641- diff --git a/newlib/libm/machine/arm/sf_round.c b/newlib/libm/machine/arm/sf_round.c
642- index 232fc0848..88c53ba13 100644
643- --- a/newlib/libm/machine/arm/sf_round.c
644- +++ b/newlib/libm/machine/arm/sf_round.c
645- @@ -24,7 +24,7 @@
646- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
647- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
648-
649- - #if __ARM_ARCH >= 8 && !defined (__SOFTFP__)
650- + #if __ARM_ARCH >= 8 && (__ARM_FP & 0x4) && !defined (__SOFTFP__)
651- #include <math.h>
652-
653- float
654- diff --git a/newlib/libm/machine/arm/sf_trunc.c b/newlib/libm/machine/arm/sf_trunc.c
655- index 64e4aeb9a..c08fa6fed 100644
656- --- a/newlib/libm/machine/arm/sf_trunc.c
657- +++ b/newlib/libm/machine/arm/sf_trunc.c
658- @@ -24,7 +24,7 @@
659- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
660- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
661-
662- - #if __ARM_ARCH >= 8 && !defined (__SOFTFP__)
663- + #if __ARM_ARCH >= 8 && (__ARM_FP & 0x4) && !defined (__SOFTFP__)
664- #include <math.h>
665-
666- float
667442- -
668- 2.43.0
443+ 2.47.1
669444
0 commit comments