mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Thorsten Glaser <tg@mirbsd.de>
Cc: 1050429@bugs.debian.org, Bastian Blank <waldi@debian.org>,
	musl@lists.openwall.com
Subject: Re: [musl] musl: unusable on mipsel, mips64el: mipsel-linux-gnu-gcc: unrecognised command-line option '-EL'
Date: Sat, 3 Feb 2024 14:32:18 -0500	[thread overview]
Message-ID: <20240203193217.GW4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <Pine.BSM.4.64L.2402030813200.29782@herc.mirbsd.org>

On Sat, Feb 03, 2024 at 08:20:28AM +0000, Thorsten Glaser wrote:
> Hi musl maintainers,
> 
> waldi indeed provided a fix for this bug forgot to Cc me, so I missed
> it until now. I tested this:
> 
> 
> 
> (sid_mips64el-dchroot)tg@eberlin:~$ sh -x $(which musl-gcc) hello.c
> + exec mips64el-linux-gnuabi64-gcc hello.c -specs /usr/lib/mips64el-linux-musl/musl-gcc.specs
> mips64el-linux-gnuabi64-gcc: error: unrecognized command-line option '-EL'
> (sid_mips64el-dchroot)tg@eberlin:~$ mips64el-linux-gnuabi64-gcc hello.c -specs ~/musl-gcc.specs
> (sid_mips64el-dchroot)tg@eberlin:~$ ./a.out
> hi
> (sid_mips64el-dchroot)tg@eberlin:~$ diff -u /usr/lib/mips64el-linux-musl/musl-gcc.specs musl-gcc.specs
> --- /usr/lib/mips64el-linux-musl/musl-gcc.specs 2023-11-10 19:30:40.000000000 +0000
> +++ musl-gcc.specs      2024-02-03 08:07:01.309465472 +0000
> @@ -1,10 +1,11 @@
>  %rename cpp_options old_cpp_options
> +%rename cc1 old_cc1
> 
>  *cpp_options:
>  -nostdinc -isystem /usr/include/mips64el-linux-musl -isystem include%s %(old_cpp_options)
> 
>  *cc1:
> -%(cc1_cpu) -nostdinc -isystem /usr/include/mips64el-linux-musl -isystem include%s
> +%(cc1_cpu) -nostdinc -isystem /usr/include/mips64el-linux-musl -isystem include%s %(old_cc1)
> 
>  *link_libgcc:
>  -L/usr/lib/mips64el-linux-musl -L .%s
> 
> 
> 
> This change (to tools/musl-gcc.specs.sh in the source tree) probably
> makes sense on all architectures, so perhaps do that even. Upstream
> should also consider including this and check which of the original
> specs need not be removed and can be kept like this.
> 
> bye,
> //mirabilos

OK, it's not musl that's unusable, but the gcc wrapper. This is not
the recommended way to use musl except as minimal evaluation setup or
for compiling very simple programs, and as you've found, it seems it's
almost entirely untested except on a couple mainstream archs.

This is something we should fix, but there are two issues:

1. On some archs, which I think includes mips, it can work in
   principle, but has gratuitous bugs keeping it from working. These
   should be easy to fix.

2. On some archs such as powerpc, the ABI is almost surely mismatched
   with the existing toolchain on a non-musl system. This should be
   caught at configure time, since the existing gcc is not able to
   build musl anyway, but it's possible that with sufficient additions
   to CFLAGS/CC, it might be possible to get musl to build, but then
   have a broken wrapper still (or to compile, but fail at link time
   or produce a broken libc.so due to mismatched libgcc.a). This
   probably needs attention too.

I'll try to take a look at this soon and see if the proposed wrapper
fix seems right for the mips situation, but the wrapper is generally
low-priority, and there's other stuff I'm trying to get to/finish
first.

Rich

  parent reply	other threads:[~2024-02-03 19:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-03  8:20 Thorsten Glaser
2024-02-03  8:37 ` Thorsten Glaser
2024-02-03 19:32 ` Rich Felker [this message]
2024-02-04  2:14   ` [musl] musl-gcc: " Thorsten Glaser
2024-02-04 20:04     ` Markus Wichmann
2024-02-05 10:16       ` Thorsten Glaser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240203193217.GW4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=1050429@bugs.debian.org \
    --cc=musl@lists.openwall.com \
    --cc=tg@mirbsd.de \
    --cc=waldi@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).