For discussion of Alpine Linux development and developer support

[alpine-devel] GCC stuff and porting Alpine to MIPS

A. Wilcox
Message ID
Sender timestamp
DKIM signature
Download raw message
Hi there Alpinists,

One of Adélie's goal architectures (and one that musl libc supports
well, from experience) is MIPS.  Both the 32-bit and 64-bit varieties of
MIPS would ideally be supported.

I've made some patches to abuild and the musl/gcc/binutils APKBUILD
files that allow MIPS support to be somewhat created.  However, there
are a few issues that I am seeing.  I am not sure the best way to
proceed with fixing them.

1) binutils does not support MIPS architecture.

This necessitated a special case of $subpackages in the binutils
APKBUILD and moving --enable-gold=[yes/no] to _arch_configure.  An
example patch is attached, but I am not convinced this is the best way.
 In particular, the subpackages conditional feels ugly to me.

2) MIPS ABI does not support GNU-style hash in ld.

Since having default --hash-style=gnu in binutils build broke its test
suite, we no longer ship that patch in Adélie binutils APK.  However,
gcc still has --with-linker-hash-style=gnu.  This caused the musl
bootstrap package to fail with:

.gnu.hash is incompatible with the MIPS ABI

An example patch for the GCC APKBUILD to conditionalise the specified
hash style is therefore also attached.  This one seems much less ugly to
me and might be acceptable.

3) libgcc in final cross build stage requires linux-headers.

The libunwind shipped in libgcc, on mips*-*-linux targets, has

#include <asm/unistd.h>

It seems to specifically need the kernel header version and not the
version musl ships with, but as I was unable to find exactly where the
file was generated (it 'appears' in
build-final-cross/mips-foxkit-linux-musl/libgcc/) I cannot be sure.  The
linux-headers package wouldn't cooperate in generating an early
arch-specific package for gcc to depend on (the package itself built,
but adding 'linux-headers' to EXTRADEPENDS_TARGET in
errored with missing dependency).

I'm not sure where to even start to make a worthwhile patch for this.

Any comments on the patches, and a solution to #3, would be greatly
appreciated.  Thanks so much.

Best to you and yours,
A. Wilcox (awilfox)
Project Lead, Adélie Linux