aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarian Buschsieweke <marian.buschsieweke@ovgu.de>2021-11-12 12:58:18 +0100
committerSören Tempel <soeren+git@soeren-tempel.net>2021-11-28 10:32:53 +0100
commitbae610dad09fa1a4a4519684a9794e5b451c04eb (patch)
tree2a14e931ce27d10e82acbd1fb06424300db9b083
parent708001c84d52a6bb78d9c6f582666590ffe23a72 (diff)
downloadaports-bae610dad09fa1a4a4519684a9794e5b451c04eb.tar.gz
aports-bae610dad09fa1a4a4519684a9794e5b451c04eb.tar.bz2
aports-bae610dad09fa1a4a4519684a9794e5b451c04eb.tar.xz
community/newlib: re-enable mips-mti-elf
- re-enable mips-mti-elf which is patched to work - enable retargetable locking - Use CFLAGS_FOR_TARGET instead of CFLAGS to greatly reduce the size of firmwares built - apply some alphabetical sorting
-rw-r--r--community/newlib/APKBUILD27
-rw-r--r--community/newlib/fix-mips-mti-elf.patch21
2 files changed, 38 insertions, 10 deletions
diff --git a/community/newlib/APKBUILD b/community/newlib/APKBUILD
index 03b9afb33a..efa848b953 100644
--- a/community/newlib/APKBUILD
+++ b/community/newlib/APKBUILD
@@ -1,11 +1,11 @@
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
-# mips-mti-elf fails with "Error: unrecognized opcode `cfc1 $3,$31'"
_targets="
+ aarch64-none-elf
arm-none-eabi
+ mips-mti-elf
msp430-elf
riscv-none-elf
- aarch64-none-elf
"
# or1k-elf fails to build on 32-bit architectures
case "$CARCH" in
@@ -13,14 +13,17 @@ case "$CARCH" in
esac
pkgname=newlib
pkgver=4.1.0
-pkgrel=1
+pkgrel=2
pkgdesc="C standard library implementation intended for use on embedded systems"
url="https://www.sourceware.org/newlib/"
makedepends="texinfo"
# s390x, mips64 and riscv64 blocked by gcc-cross-embedded
arch="all !s390x !mips64 !riscv64"
license="GPL-2.0-only AND LGPL-2.1-only AND 0BSD AND BSD-3-Clause AND GPL-3.0-only AND LGPL-3.0-only"
-source="https://sourceware.org/pub/newlib/newlib-$pkgver.tar.gz"
+source="
+ https://sourceware.org/pub/newlib/newlib-$pkgver.tar.gz
+ fix-mips-mti-elf.patch
+ "
options="!check"
for target in $_targets; do
@@ -45,6 +48,7 @@ build() {
mkdir "$builddir/build-$target" "$builddir/build-$target-nano"
# nano version
cd "$builddir/build-$target-nano"
+ export CFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections -fshort-wchar"
"$builddir"/configure \
--target=$target \
--prefix=/usr/ \
@@ -52,17 +56,18 @@ build() {
--mandir=/deleteme/man \
--htmldir=/deleteme/html \
--pdfdir=/deleteme/pdf \
- --disable-newlib-supplied-syscalls \
- --disable-nls \
--disable-newlib-fseek-optimization \
--disable-newlib-fvwrite-in-streamio \
+ --disable-newlib-supplied-syscalls \
--disable-newlib-unbuf-stream-opt \
--disable-newlib-wide-orient \
+ --disable-nls \
--enable-lite-exit \
--enable-newlib-global-atexit \
--enable-newlib-nano-formatted-io \
--enable-newlib-nano-malloc \
--enable-newlib-reent-small \
+ --enable-newlib-retargetable-locking \
CC_FOR_TARGET="$target"-gcc \
GCC_FOR_TARGET="$target"-gcc \
AR_FOR_TARGET="$target"-ar \
@@ -72,12 +77,12 @@ build() {
OBJDUMP_FOR_TARGET="$target"-objdump \
RANLIB_FOR_TARGET="$target"-ranlib \
READELF_FOR_TARGET="$target"-readelf \
- STRIP_FOR_TARGET="$target"-strip \
- CFLAGS="-Os -ffunction-sections -fdata-sections -fshort-wchar"
+ STRIP_FOR_TARGET="$target"-strip
make
# regular version
cd "$builddir/build-$target"
+ export CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections"
"$builddir"/configure \
--host=$CHOST \
--target=$target \
@@ -88,8 +93,10 @@ build() {
--pdfdir=/deleteme/pdf \
--disable-newlib-supplied-syscalls \
--disable-nls \
+ --enable-newlib-io-c99-formats \
--enable-newlib-io-long-long \
--enable-newlib-register-fini \
+ --enable-newlib-retargetable-locking \
CC_FOR_TARGET="$target"-gcc \
GCC_FOR_TARGET="$target"-gcc \
AR_FOR_TARGET="$target"-ar \
@@ -99,8 +106,7 @@ build() {
OBJDUMP_FOR_TARGET="$target"-objdump \
RANLIB_FOR_TARGET="$target"-ranlib \
READELF_FOR_TARGET="$target"-readelf \
- STRIP_FOR_TARGET="$target"-strip \
- CFLAGS="-O2 -ffunction-sections -fdata-sections -pipe"
+ STRIP_FOR_TARGET="$target"-strip
make
done
}
@@ -161,4 +167,5 @@ aarch64_none_elf() {
sha512sums="
6a24b64bb8136e4cd9d21b8720a36f87a34397fd952520af66903e183455c5cf19bb0ee4607c12a05d139c6c59382263383cb62c461a839f969d23d3bc4b1d34 newlib-4.1.0.tar.gz
+cae689987feb543cf62f65b81e902d7c345c610f6c75366eafe5b6e4fa63bfc775e012af67d45a4eb0f1457b29273fd3516dcb7c896683a2118a0494e4aa44ba fix-mips-mti-elf.patch
"
diff --git a/community/newlib/fix-mips-mti-elf.patch b/community/newlib/fix-mips-mti-elf.patch
new file mode 100644
index 0000000000..9be3c6649b
--- /dev/null
+++ b/community/newlib/fix-mips-mti-elf.patch
@@ -0,0 +1,21 @@
+The code accessing the floating point control/status register, namely
+
+ #define __cfc1(__fcsr) __asm __volatile("cfc1 %0, $31" : "=r" (__fcsr)
+
+does not compile with mips16. This changed the makefile to pass -mno-mips16 to avoid the following
+compiler error:
+
+ mips-mti-elf fails with "Error: unrecognized opcode `cfc1 $3,$31'"
+
+Patch send to mailing list, see https://sourceware.org/pipermail/newlib/2021/018712.html
+--- newlib-4.1.0/newlib/libm/machine/mips/Makefile.in.orig 2021-11-12 11:49:11.691337941 +0100
++++ newlib-4.1.0/newlib/libm/machine/mips/Makefile.in 2021-11-12 11:48:21.181600000 +0100
+@@ -349,7 +349,7 @@ lib_a-feupdateenv.obj: feupdateenv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.obj `if test -f 'feupdateenv.c'; then $(CYGPATH_W) 'feupdateenv.c'; else $(CYGPATH_W) '$(srcdir)/feupdateenv.c'; fi`
+
+ lib_a-fenv.o: fenv.c
+- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv.o `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c
++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -mno-mips16 -c -o lib_a-fenv.o `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c
+
+ lib_a-fenv.obj: fenv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv.obj `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`