!9 LLVM平行宇宙:支持使用clang构建newlib

From: @ren-yi43 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2023-09-07 00:41:53 +00:00 committed by Gitee
commit 9ae55709eb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 157 additions and 2 deletions

View File

@ -0,0 +1,144 @@
From 48c25d7907a6909ed92db94da6d52ae3ca91f17e Mon Sep 17 00:00:00 2001
From: 15859157387 <977713017@qq.com>
Date: Wed, 6 Sep 2023 09:10:25 +0800
Subject: [PATCH] modify 2d to d
---
newlib/libc/machine/aarch64/memchr.S | 6 +++---
newlib/libc/machine/aarch64/strchr.S | 6 +++---
newlib/libc/machine/aarch64/strchrnul.S | 6 +++---
newlib/libc/machine/aarch64/strrchr.S | 10 +++++-----
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/newlib/libc/machine/aarch64/memchr.S b/newlib/libc/machine/aarch64/memchr.S
index 53f5d6b..81fcecc 100644
--- a/newlib/libc/machine/aarch64/memchr.S
+++ b/newlib/libc/machine/aarch64/memchr.S
@@ -110,7 +110,7 @@ def_fn memchr
and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */
addp vend.16b, vend.16b, vend.16b /* 128->64 */
- mov synd, vend.2d[0]
+ mov synd, vend.d[0]
/* Clear the soff*2 lower bits */
lsl tmp, soff, #1
lsr synd, synd, tmp
@@ -130,7 +130,7 @@ def_fn memchr
/* Use a fast check for the termination condition */
orr vend.16b, vhas_chr1.16b, vhas_chr2.16b
addp vend.2d, vend.2d, vend.2d
- mov synd, vend.2d[0]
+ mov synd, vend.d[0]
/* We're not out of data, loop if we haven't found the character */
cbz synd, .Lloop
@@ -140,7 +140,7 @@ def_fn memchr
and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */
addp vend.16b, vend.16b, vend.16b /* 128->64 */
- mov synd, vend.2d[0]
+ mov synd, vend.d[0]
/* Only do the clear for the last possible block */
b.hi .Ltail
diff --git a/newlib/libc/machine/aarch64/strchr.S b/newlib/libc/machine/aarch64/strchr.S
index 2448dbc..7061078 100644
--- a/newlib/libc/machine/aarch64/strchr.S
+++ b/newlib/libc/machine/aarch64/strchr.S
@@ -117,7 +117,7 @@ def_fn strchr
addp vend1.16b, vend1.16b, vend2.16b // 128->64
lsr tmp1, tmp3, tmp1
- mov tmp3, vend1.2d[0]
+ mov tmp3, vend1.d[0]
bic tmp1, tmp3, tmp1 // Mask padding bits.
cbnz tmp1, .Ltail
@@ -132,7 +132,7 @@ def_fn strchr
orr vend2.16b, vhas_nul2.16b, vhas_chr2.16b
orr vend1.16b, vend1.16b, vend2.16b
addp vend1.2d, vend1.2d, vend1.2d
- mov tmp1, vend1.2d[0]
+ mov tmp1, vend1.d[0]
cbz tmp1, .Lloop
/* Termination condition found. Now need to establish exactly why
@@ -146,7 +146,7 @@ def_fn strchr
addp vend1.16b, vend1.16b, vend2.16b // 256->128
addp vend1.16b, vend1.16b, vend2.16b // 128->64
- mov tmp1, vend1.2d[0]
+ mov tmp1, vend1.d[0]
.Ltail:
/* Count the trailing zeros, by bit reversing... */
rbit tmp1, tmp1
diff --git a/newlib/libc/machine/aarch64/strchrnul.S b/newlib/libc/machine/aarch64/strchrnul.S
index a0ac13b..fd2002f 100644
--- a/newlib/libc/machine/aarch64/strchrnul.S
+++ b/newlib/libc/machine/aarch64/strchrnul.S
@@ -109,7 +109,7 @@ def_fn strchrnul
addp vend1.16b, vend1.16b, vend1.16b // 128->64
lsr tmp1, tmp3, tmp1
- mov tmp3, vend1.2d[0]
+ mov tmp3, vend1.d[0]
bic tmp1, tmp3, tmp1 // Mask padding bits.
cbnz tmp1, .Ltail
@@ -124,7 +124,7 @@ def_fn strchrnul
orr vhas_chr2.16b, vhas_nul2.16b, vhas_chr2.16b
orr vend1.16b, vhas_chr1.16b, vhas_chr2.16b
addp vend1.2d, vend1.2d, vend1.2d
- mov tmp1, vend1.2d[0]
+ mov tmp1, vend1.d[0]
cbz tmp1, .Lloop
/* Termination condition found. Now need to establish exactly why
@@ -134,7 +134,7 @@ def_fn strchrnul
addp vend1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128
addp vend1.16b, vend1.16b, vend1.16b // 128->64
- mov tmp1, vend1.2d[0]
+ mov tmp1, vend1.d[0]
.Ltail:
/* Count the trailing zeros, by bit reversing... */
rbit tmp1, tmp1
diff --git a/newlib/libc/machine/aarch64/strrchr.S b/newlib/libc/machine/aarch64/strrchr.S
index d64fc09..1b6f075 100644
--- a/newlib/libc/machine/aarch64/strrchr.S
+++ b/newlib/libc/machine/aarch64/strrchr.S
@@ -120,10 +120,10 @@ def_fn strrchr
addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128
addp vhas_nul1.16b, vhas_nul1.16b, vhas_nul1.16b // 128->64
addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr1.16b // 128->64
- mov nul_match, vhas_nul1.2d[0]
+ mov nul_match, vhas_nul1.d[0]
lsl tmp1, tmp1, #1
mov const_m1, #~0
- mov chr_match, vhas_chr1.2d[0]
+ mov chr_match, vhas_chr1.d[0]
lsr tmp3, const_m1, tmp1
bic nul_match, nul_match, tmp3 // Mask padding bits.
@@ -146,15 +146,15 @@ def_fn strrchr
addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128
addp vend1.16b, vend1.16b, vend1.16b // 128->64
addp vhas_chr1.16b, vhas_chr1.16b, vhas_chr1.16b // 128->64
- mov nul_match, vend1.2d[0]
- mov chr_match, vhas_chr1.2d[0]
+ mov nul_match, vend1.d[0]
+ mov chr_match, vhas_chr1.d[0]
cbz nul_match, .Lloop
and vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
and vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
addp vhas_nul1.16b, vhas_nul1.16b, vhas_nul2.16b
addp vhas_nul1.16b, vhas_nul1.16b, vhas_nul1.16b
- mov nul_match, vhas_nul1.2d[0]
+ mov nul_match, vhas_nul1.d[0]
.Ltail:
/* Work out exactly where the string ends. */
--
2.27.0

View File

@ -2,13 +2,15 @@
%global _newlib newlib
Name: newlib
Version: 3.3.0
Release: 2
Release: 3
Summary: Newlib is a C library intended for use on embedded systems.
License: BSD
URL: https://sourceware.org/newlib/
Source0: ftp://sourceware.org/pub/newlib/newlib-%{version}.tar.gz
Patch01: Modify-neon-instruction.patch
BuildRequires: make gcc binutils texinfo texinfo-tex
%description
@ -19,14 +21,20 @@ usable on embedded products.
%prep
%autosetup
%autosetup -p1
%build
rm -rf build-newlib
mkdir build-newlib
cd build-newlib
%if "%toolchain" == "clang"
export CFLAGS="-O2 -D_FORTIFY_SOURCE=0 -ffreestanding"
%else
export CFLAGS="-O2 -D_FORTIFY_SOURCE=0"
%endif
../newlib/configure --prefix=%{_prefix}
make %{?_smp_mflags}
cd ..
@ -54,6 +62,9 @@ cd ..
%changelog
* Wed Sep 6 2023 renyi <977713017@qq.com> - 3.3.0-3
- Support building this package with clang
* Wed Dec 15 2021 jiangxinyu <jiangxinyu@kylinos.cn> - 3.3.0-2
- Remove the release suffix