2

[alpine-aports] [PATCH 1/3] testing/binutils-arm-none-eabi: New aport

Marian Buschsieweke
Details
Message ID
<20170826140729.2822-1-marian.buschsieweke@ovgu.de>
Sender timestamp
1503756447
DKIM signature
missing
Download raw message
Patch: +128 -0
Tools necessary to build programs for embedded ARM targets
http://www.gnu.org/software/binutils
---
 testing/binutils-arm-none-eabi/APKBUILD            | 51 ++++++++++++++++++++++
 .../binutils-ld-fix-static-linking.patch           | 46 +++++++++++++++++++
 .../binutils-arm-none-eabi/hash-style-gnu.patch    | 31 +++++++++++++
 3 files changed, 128 insertions(+)
 create mode 100644 testing/binutils-arm-none-eabi/APKBUILD
 create mode 100644 testing/binutils-arm-none-eabi/binutils-ld-fix-static-linking.patch
 create mode 100644 testing/binutils-arm-none-eabi/hash-style-gnu.patch

diff --git a/testing/binutils-arm-none-eabi/APKBUILD b/testing/binutils-arm-none-eabi/APKBUILD
new file mode 100644
index 0000000000..952671d33e
--- /dev/null
+++ b/testing/binutils-arm-none-eabi/APKBUILD
@@ -0,0 +1,51 @@
+# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Based on binutils-avr
+_pkgbase=binutils
+_target=arm-none-eabi
+pkgname=${_pkgbase}-${_target}
+pkgver=2.28
+pkgrel=0
+pkgdesc="Tools necessary to build programs for embedded ARM targets"
+url="http://www.gnu.org/software/${_pkgbase}/"
+makedepends="gettext libtool autoconf automake bison"
+arch="all"
+license="GPL2 GPL3+ LGPL2 BSD"
+subpackages="$pkgname-doc"
+source="http://ftp.gnu.org/gnu/${_pkgbase}/${_pkgbase}-${pkgver}.tar.bz2
+	binutils-ld-fix-static-linking.patch
+	hash-style-gnu.patch"
+
+builddir="$srcdir/${_pkgbase}-$pkgver"
+_workingdir="$srcdir/${_pkgbase}-build"
+
+build() {
+	mkdir "$_workingdir" || return 1
+	cd "$_workingdir"
+	"$builddir"/configure \
+		--build="$CBUILD" \
+		--target=${_target} \
+		--with-lib-path=/usr/lib \
+		--prefix=/usr \
+		--enable-ld=default \
+		--enable-gold=yes \
+		--enable-plugins \
+		--disable-multilib \
+		--disable-werror \
+		--disable-nls \
+		|| return 1
+	make -j1 tooldir=/usr
+}
+
+package() {
+	cd "$_workingdir"
+	make tooldir=/usr install DESTDIR="$pkgdir" || return 1
+	rm -rf "$pkgdir"/usr/share/info
+	for bin in ar as nm objcopy objdump ranlib strip readelf; do
+		rm -f "$pkgdir"/usr/bin/"$bin"
+	done
+}
+
+sha512sums="ede2e4e59a800260eea8c14eafbaee94e30abadafd5c419a3370f9f62213cf027d6400a1d4970b6958bd4d220e675dcd483a708107016e7abd5c99d7392ba8fd  binutils-2.28.tar.bz2
+ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49  binutils-ld-fix-static-linking.patch
+24e853bf4b58621a77921087e599da2ace47ba3079e2d50fb5d08ae399be5f060c5fdd7f65257bcc0526aebc66e68b98aafd45d714c035da8ea2bdc3d8d4e375  hash-style-gnu.patch"
diff --git a/testing/binutils-arm-none-eabi/binutils-ld-fix-static-linking.patch b/testing/binutils-arm-none-eabi/binutils-ld-fix-static-linking.patch
new file mode 100644
index 0000000000..bc5d762656
--- /dev/null
+++ b/testing/binutils-arm-none-eabi/binutils-ld-fix-static-linking.patch
@@ -0,0 +1,46 @@
+This fixes static linking for our hardened toolchain
+diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
+index e8126cb..9532bfb 100644
+--- a/ld/scripttempl/elf.sc
+@@ -235,8 +235,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
+ if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
+   SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
+   SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
+-  CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
+-  DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
++  CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors"
++  DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors"
+ else
+   SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
+   SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
+@@ -270,15 +270,14 @@ CTOR=".ctors        ${CONSTRUCTING-0} :
+        doesn't matter which directory crtbegin.o
+        is in.  */
+ 
+-    KEEP (*crtbegin.o(.ctors))
+-    KEEP (*crtbegin?.o(.ctors))
++    KEEP (*crtbegin*.o(.ctors))
+ 
+     /* We don't want to include the .ctor section from
+        the crtend.o file until after the sorted ctors.
+        The .ctor section from the crtend file contains the
+        end of ctors marker and it must be last */
+ 
+-    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
++    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
+     KEEP (*(SORT(.ctors.*)))
+     KEEP (*(.ctors))
+     ${CONSTRUCTING+${CTOR_END}}
+@@ -286,9 +285,8 @@ CTOR=".ctors        ${CONSTRUCTING-0} :
+ DTOR=".dtors        ${CONSTRUCTING-0} :
+   {
+     ${CONSTRUCTING+${DTOR_START}}
+-    KEEP (*crtbegin.o(.dtors))
+-    KEEP (*crtbegin?.o(.dtors))
+-    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
++    KEEP (*crtbegin*.o(.dtors))
++    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
+     KEEP (*(SORT(.dtors.*)))
+     KEEP (*(.dtors))
+     ${CONSTRUCTING+${DTOR_END}}
diff --git a/testing/binutils-arm-none-eabi/hash-style-gnu.patch b/testing/binutils-arm-none-eabi/hash-style-gnu.patch
new file mode 100644
index 0000000000..2e6c01972e
--- /dev/null
+++ b/testing/binutils-arm-none-eabi/hash-style-gnu.patch
@@ -0,0 +1,31 @@
+# DP: Default to --hash-style=gnu in ld.bfd and ld.gold.
+
+--- a/ld/ldmain.c
+@@ -287,6 +288,15 @@
+   emulation = get_emulation (argc, argv);
+   ldemul_choose_mode (emulation);
+   default_target = ldemul_choose_target (argc, argv);
++
++  /* Default to --hash-style=gnu */
++  if (strcmp (default_target, "elf32-tradbigmips") != 0
++      && strcmp (default_target, "elf32-tradlittlemips") != 0)
++    {
++      link_info.emit_gnu_hash = TRUE;
++      link_info.emit_hash = FALSE;
++    }
++
+   config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
+   config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
+   lang_init ();
+--- a/gold/options.h
+@@ -794,7 +794,7 @@
+ 		N_("Min fraction of empty buckets in dynamic hash"),
+ 		N_("FRACTION"));
+ 
+-  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv",
++  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "gnu",
+ 	      N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
+ 	      {"sysv", "gnu", "both"});
+ 
-- 
2.14.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 2/3] testing/gcc-arm-none-eabi: New aport

Marian Buschsieweke
Details
Message ID
<20170826140729.2822-2-marian.buschsieweke@ovgu.de>
In-Reply-To
<20170826140729.2822-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1503756448
DKIM signature
missing
Download raw message
Patch: +68 -0
The GNU Compiler Collection for embedded ARM targets (e.g. Cortex M0/M3/M4/...)
http://gcc.gnu.org
---
 testing/gcc-arm-none-eabi/APKBUILD | 68 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 testing/gcc-arm-none-eabi/APKBUILD

diff --git a/testing/gcc-arm-none-eabi/APKBUILD b/testing/gcc-arm-none-eabi/APKBUILD
new file mode 100644
index 0000000000..9d68c25fa0
--- /dev/null
+++ b/testing/gcc-arm-none-eabi/APKBUILD
@@ -0,0 +1,68 @@
+# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Based on gcc-avr
+_pkgbase=gcc
+_target=arm-none-eabi
+pkgname="${_pkgbase}-${_target}"
+pkgver=6.4.0
+pkgrel=0
+pkgdesc="The GNU Compiler Collection for embedded ARM targets (e.g. Cortex M0/M3/M4/...)"
+url="http://gcc.gnu.org"
+depends="binutils-${_target}"
+makedepends="bash linux-headers gmp-dev mpfr-dev mpc1-dev zlib-dev"
+arch="all"
+license="GPL LGPL"
+subpackages="$pkgname-doc"
+_islver=0.18
+source="ftp://gcc.gnu.org/pub/${_pkgbase}/releases/${_pkgbase}-$pkgver/${_pkgbase}-$pkgver.tar.xz
+	http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2"
+
+builddir="$srcdir/${_pkgbase}-$pkgver"
+_workingdir="$builddir/build"
+
+build() {
+	mkdir "$_workingdir" || return 1
+	cd "$_workingdir"
+
+	# link isl for in-tree build
+	ln -s "$srcdir"/isl-"$_islver" "$builddir"/isl
+
+	export CFLAGS_FOR_TARGET='-pipe'
+	export CXXFLAGS_FOR_TARGET='-pipe'
+
+	"$builddir"/configure \
+		--build="$CBUILD" \
+		--target=${_target} \
+		--prefix=/usr \
+		--enable-languages=c \
+		--enable-ld=default \
+		--enable-__cxa_atexit \
+		--disable-install-libiberty \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-libunwind-exceptions \
+		--disable-linker-build-id \
+		--disable-nls \
+		--disable-werror \
+		--libdir=/usr/lib \
+		--libexecdir=/usr/lib \
+		--with-as="/usr/bin/${_target}-as" \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-ld="/usr/bin/${_target}-ld" \
+		--with-system-zlib \
+		--with-isl || return 1
+	make
+}
+
+package() {
+	cd "$_workingdir"
+	make install DESTDIR="$pkgdir" || return 1
+	rm -rf "$pkgdir"/usr/share/man/man7
+	rm -f "$pkgdir"/usr/lib/libcc1.*
+	rm -rf "$pkgdir"/usr/share/info
+	find "$pkgdir"/usr/lib -type f -name "*.a" -exec "/usr/bin/${_target}-strip" --strip-debug '{}' \;
+}
+
+sha512sums="02c60e54527c7adf584798d5251f8a0b80c93d5deafce82501b2c28e6692e0bd783927bbfc4bc527a863c0cccc025150a34740a9e29badb02d4b48e56a8aba90  gcc-6.4.0.tar.xz
+85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94  isl-0.18.tar.bz2"
-- 
2.14.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 3/3] testing/newlib-arm-none-eabi: New aport

Marian Buschsieweke
Details
Message ID
<20170826140729.2822-3-marian.buschsieweke@ovgu.de>
In-Reply-To
<20170826140729.2822-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1503756449
DKIM signature
missing
Download raw message
Patch: +83 -0
A C standard library implementation intended for use on embedded systems
http://www.sourceware.org/newlib/
---
 testing/newlib-arm-none-eabi/APKBUILD | 83 +++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 testing/newlib-arm-none-eabi/APKBUILD

diff --git a/testing/newlib-arm-none-eabi/APKBUILD b/testing/newlib-arm-none-eabi/APKBUILD
new file mode 100644
index 0000000000..581bcc1ebe
--- /dev/null
+++ b/testing/newlib-arm-none-eabi/APKBUILD
@@ -0,0 +1,83 @@
+# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+
+_pkgbase=newlib
+_target=arm-none-eabi
+pkgname="${_pkgbase}-${_target}"
+pkgver=2.5.0.20170818
+pkgrel=0
+pkgdesc="A C standard library implementation intended for use on embedded systems"
+url="http://www.sourceware.org/newlib/"
+depends="binutils-${_target} gcc-${_target}"
+makedepends="texinfo"
+arch="all"
+license="BSD"
+subpackages="$pkgname-doc"
+source="ftp://sourceware.org/pub/$_pkgbase/$_pkgbase-$pkgver.tar.gz"
+options="!check"
+
+builddir="$srcdir/$_pkgbase-$pkgver"
+
+# This package installes two version of the newlib library to remain compatible
+# with projects expecting the GNU ARM Embedded Toolchain [1]. The nano version
+# appends the postix "_nano" to the libaries. The is not an arbitrary choice,
+# it matches the specs in "/usr/arm-none-eabi/lib/nano.specs", which is
+# part of the default newlib installation.
+# [1]: https://launchpad.net/gcc-arm-embedded/
+
+build() {
+	mkdir "${builddir}/build" "${builddir}/build-nano"
+	
+	# nano version
+	cd "${builddir}/build-nano"
+	CFLAGS_NANO="-Os -ffunction-sections -fdata-sections -D=__OPTIMIZE_SIZE__ -DPREFER_SIZE_OVER_SPEED"
+	env CFLAGS_FOR_TARGET="$CFLAGS_NANO" "$builddir"/configure \
+		--prefix=/usr/ \
+		--target=$_target \
+		--disable-newlib-supplied-syscalls \
+		--enable-newlib-reent-small \
+		--disable-newlib-fvwrite-in-streamio \
+		--disable-newlib-fseek-optimization \
+		--disable-newlib-wide-orient \
+		--enable-newlib-nano-malloc \
+		--disable-newlib-unbuf-stream-opt \
+		--enable-lite-exit \
+		--enable-newlib-global-atexit \
+		--enable-newlib-nano-formatted-io \
+		--disable-nls \
+		--disable-newlib-io-float \
+		--disable-libssp
+	make
+	
+	# regular version
+	cd "${builddir}/build"
+	"$builddir"/configure \
+		--prefix=/usr/ \
+		--target=$_target \
+		--enable-newlib-io-long-long \
+		--enable-newlib-register-fini \
+		--disable-newlib-supplied-syscalls \
+		--disable-nls
+	make
+}
+
+package() {
+	for dir in include lib/thumb lib/fpu lib/cpu-init; do
+		mkdir -p "${pkgdir}/usr/${_target}/${dir}"
+	done
+	
+	# install nano version
+	cd "${builddir}/build-nano"
+	make DESTDIR="$pkgdir" install
+	# rename nano version libs
+	cd "${pkgdir}/usr/${_target}/lib"
+	for file in $(find . -regex ".*\(c\|g\|rdimon\)\.a"); do
+		mv "$file" "${file%.a}_nano.a"
+	done
+	
+	# install regular version
+	cd "${builddir}/build"
+	make DESTDIR="$pkgdir" install
+}
+
+sha512sums="41382f722232593a9a2bf7de09dc51a26ad51bf8ad06259b0fd38a13cfcd577688e836446d7e88b7741eeec316cfa137ff9b4e16cca846b11bb70948ff1b8c16  newlib-2.5.0.20170818.tar.gz"
-- 
2.14.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---