This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/13] Add musl support to GCC


This patch set adds musl libc[0] support to GCC.

The patches were originally developed by Gregor Richards[1][2],
who I believe have already done the FSF copyright assignment and agrees
with the changes I made (please verify).  I only did minor cleanups
to make the patches better suited for upstream.

Issues I don't have patches for:

* On powerpc it seems the only configure option to choose the default
long-double abi is --with-long-double-128, but that's the default with
sufficiently new glibc. (musl gets 64bit long-double because the glibc
version check fails, this is ok, because there is no ibm128 support in
musl, but it would be better if --with-long-double-64 could be set
explicitly or even ieee128 abi if gcc supports that).

* libcilkrts uses pthread_yield on linux instead of sched_yield by
default, but musl does not have the non-standard pthread_yield symbol.

Tests:

I only tested the C and C++ languages.  GCJ needs further patching,
I haven't tested gfortran nor Ada.  libsanitizer has to be disabled
for musl.  I built cross compilers for various targets musl supports
and ran x86_64-linux-musl cross compiler (musl target glibc host)
and native musl make check.  There were several errors, some of the
causes:

* libcilkrts.so has undefined ref to pthread_yield
* ifunc is not supported by musl
* ifunc is used in x86 libatomic.so for __atomic_store_16
* gcc stdatomic.h has some incompatible typedefs with musl stdint.h
* musl does not support unwind across libc calls or signal handlers
* splitstacks does not work (undef refs to __morestack* in libgcc)
* musl does not yet have __memcpy_chk etc.
* -fshort-wchar is not supported
* i've seen x86 specific avx failures
* atexit during exit fails with musl (some c++ destructor tests)

This fixes BZ 58446 and 55807 which requested musl support.

[0] http://www.musl-libc.org/
[1] https://github.com/GregorR/musl-gcc-patches
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58446

--
Changes:
 fixincludes/mkfixinc.sh                     |    3 +-
 gcc/config.gcc                              |    9 ++-
 gcc/config/aarch64/aarch64-linux.h          |    8 ++
 gcc/config/arm/linux-eabi.h                 |   17 +++++
 gcc/config/i386/linux.h                     |    1 +
 gcc/config/i386/linux64.h                   |    4 +
 gcc/config/i386/pmm_malloc.h                |    9 ++-
 gcc/config/linux.h                          |  105 +++++++++++++++++++++++----
 gcc/config/linux.opt                        |    4 +
 gcc/config/microblaze/linux.h               |   16 +++-
 gcc/config/mips/linux.h                     |    7 ++
 gcc/config/rs6000/linux64.h                 |   12 ++-
 gcc/config/rs6000/secureplt.h               |    1 +
 gcc/config/rs6000/sysv4.h                   |   16 +++-
 gcc/config/sh/linux.h                       |    7 ++
 gcc/configure                               |    7 ++
 gcc/configure.ac                            |    7 ++
 libgcc/unwind-dw2-fde-dip.c                 |    6 ++
 libgfortran/acinclude.m4                    |    2 +-
 libgfortran/configure                       |    2 +-
 libitm/config/arm/hwcap.cc                  |    2 +-
 libitm/config/linux/x86/tls.h               |    8 +-
 libstdc++-v3/config/os/generic/os_defines.h |    5 ++
 libstdc++-v3/configure.host                 |    3 +
 24 files changed, 227 insertions(+), 34 deletions(-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]