Created attachment 30829 [details] gcc/ arch-generic configuration and fixes for musl The attached patches add support for targeting the musl C library for Linux, http://musl-libc.org/ The patches are: gcc-config-musl.diff: Addition of -mmusl (akin to -mglibc, -muclibc, -mbionic) for musl libc support, as well as support for using the musl ld.so, patch to stddef.h for musl size_t support, etc. Most controversially, redefines the include dir ordering iff musl is the default target. gomp-posix.diff: Not directly related to musl, a fix to libgomp to make it properly specify required POSIX version. gcc-config-dliterate.diff: gcc_cv_target_dl_iterate_phdr=yes for musl libssp.diff: Support for libcs which provide libssp functions in libc (of which musl is the only example at present) x86.diff, arm.diff, mips.diff, powerpc.diff, aarch64.diff: ld.so specification for each target and related fixes.
Created attachment 30830 [details] Fix for gomp to specify _POSIX_SOURCE requirements
Created attachment 30831 [details] gcc_cv_target_dl_iterate_phdr=yes on musl (note that due to a bug in making these .diffs, the configure.ac change is in libssp.diff ...)
Created attachment 30832 [details] libssp support for musl
Created attachment 30833 [details] x86/x86_64 support for musl
Created attachment 30834 [details] arm support for musl
Created attachment 30835 [details] mips support for musl
Created attachment 30836 [details] powerpc support for musl
Created attachment 30837 [details] aarch64 support for musl
I don't know what the maintenance policy is for non-latest releases, but it would be wonderful if we could get these into the 4.7 series before it's closed, too. Bootstrapping new toolchains/systems with a different libc than the host system's libc, it's much easier to start with a GCC that doesn't need C++, and it would be a big help if our users could just start with GCC 4.7.x and have it work out of the box, rather than needing to apply third-party patches. (Speaking from the standpoint of musl maintainer.)
On Tue, 17 Sep 2013, gcc-bug-espfv4bhi9 at gregor dot im wrote: > libssp.diff: Support for libcs which provide libssp functions in libc (of which > musl is the only example at present) glibc provides libssp functions since version 2.4. Apparently some people have a use for building libssp anyway (see bug 58312), but I'd think the build / installation of libssp should be disabled by default for glibc targets. (Though given this is a per-multilib matter, disabling may mean just avoiding building / installing anything rather than completely disabling the directory at toplevel.) Likewise, according to gcc/configure.ac, Bionic, and uClibc configured with __UCLIBC_HAS_SSP__.
Aha. I didn't realize such a setting already existed; I'll test and update my patch later today to use the existing mechanism. Thanks for the info.
Created attachment 30864 [details] Changes to gcc/configure.ac for musl Making libssp use the same system as everything else. (I'll leave the whether-to-build-libssp debate to future generations :) )
Created attachment 30865 [details] arm support for musl This change to arm.diff adds support for musl's -eb and -hf linkers (/lib/ld-musl-arm[eb][hf].so.1)
Created attachment 30866 [details] mips support for musl And the equivalent change for MIPS (/lib/ld-musl-mips[el].so.1)
in which state is musl patches integration? btw. here is also old bug #55807
*** Bug 55807 has been marked as a duplicate of this bug. ***
gcc-trunk has most of the musl support patches (not backported yet to any release branch), the current state: libitm fix: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222325 fixincludes support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222327 unwind support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222328 gthread support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222329 config changes: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222904 stdint changes: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222905 aarch64 support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=223766 arm support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=223749 mips support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222915 x86 support: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=223218 microblaze support: not yet committed https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00437.html powerpc support: not yet committed https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01640.html sh support: not yet committed https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01636.html
Fixed.