mailing list of musl libc
 help / color / mirror / code / Atom feed
From: John Arnold <iohannes.eduardus.arnold@gmail.com>
To: Rich Felker <dalias@aerifal.cx>
Cc: Anders Magnusson <ragge@ludd.ltu.se>,
	musl@lists.openwall.com, pcc@lists.ludd.ltu.se
Subject: Re: [musl] Re: [Pcc] [musl] PCC unable to build musl 1.2.0 (and likely earlier)
Date: Wed, 13 May 2020 12:53:55 -0500	[thread overview]
Message-ID: <CACq8dh0YvtV+kuyt4efpM_VjYufhDLbJLqVYvub2CQTZi8kytw@mail.gmail.com> (raw)
In-Reply-To: <20200513172718.GW21576@brightrain.aerifal.cx>

On Wed, May 13, 2020 at 12:27 PM Rich Felker <dalias@aerifal.cx> wrote:
>
> On Wed, May 13, 2020 at 12:00:24PM -0500, John Arnold wrote:
> > > Can you please sen med the offending line?
> >
> > include/limits.h:10:
> > #if '\xff' > 0
> >
> > > Same here, can you send me the line that causes the bug?
> > > And true, __builtin_complex is not recognized in pcc.
> >
> > catan.c:105 is:
> > w = CMPLX(w, 0.25 * log(a));
> >
> > which pcc -E expands to:
> > w = ((union { _Complex double __z; double __xy[2]; }){.__xy =
> > {(w),(0.25 * log(a))}}.__z);
>
> Where are you getting this from? There has not been any union compound
> literal like that since 2014 because it was found not to be valid in
> constant expressions and CMPLX is required to produce a constant
> expression. Commit 5ff2a118c64224789b7286830912425e58831b2b is
> informative, and the message notes that CMPLX is a C11 feature, so
> since the musl source is supposed to build with just C99 (+ minimal
> extensions) perhaps we should drop internal use of CMPLX anyway...

The full command I ran was:
pcc -D_XOPEN_SOURCE=700 -I./arch/i386 -I./arch/generic
-Iobj/src/internal -I./src/include -I./src/internal -Iobj/include
-I./include -DBROKEN_EBX_ASM -E src/complex/catan.c

And that's what pcc spit out (with a similar expansion of cimag() in
line 92). I don't understand pcc's inner workings enough to say why.

> > Rich is right, changing line 105 to:
> > w = w+0.25*log(a)*I
> >
> > solves the problem, but then we get the bad register name `%%ax' error
> > when trying to assemble catan.o.
>
> Are you sure? There's no asm in catan.c. If %%ax appears in what gets
> passed to the assembled for this file, it's emitted by PCC itself.
>
> > Running make -j also reveals that this assembly error pops up in more
> > places, at least also catanl.o, catanf.o, and csqrt.o.
>
> In that case it sounds like it very well might be a bug in PCC's
> codegen rather than anything in our inline asm (elsewhere) which I
> originally suspected it was.

I'm beginning to think the assembly problems might have to do with my
particular setup rather than be a bug in the source. This morning I
forgot to put an i386 GNU toolchain in my path before running make,
and was getting assembler errors about push and pop, which went away
once I added the i386 GNU toolchain to PATH.

  reply	other threads:[~2020-05-13 17:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 20:59 John Arnold
2020-05-12 21:21 ` Rich Felker
2020-05-13  7:10   ` [musl] Re: [Pcc] " Anders Magnusson
2020-05-13 14:30     ` Rich Felker
2020-05-13 19:09       ` Anders Magnusson
2020-05-13 19:33         ` Rich Felker
2020-05-13 20:31           ` Anders Magnusson
2020-05-13 21:49             ` Rich Felker
2020-05-13 17:00     ` John Arnold
2020-05-13 17:27       ` Rich Felker
2020-05-13 17:53         ` John Arnold [this message]
2020-05-13 18:04           ` Rich Felker
2020-05-13 18:49             ` John Arnold
2020-05-13 18:50               ` Rich Felker
2020-05-15  0:24             ` John Arnold
2020-05-13 19:36       ` Anders Magnusson

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=CACq8dh0YvtV+kuyt4efpM_VjYufhDLbJLqVYvub2CQTZi8kytw@mail.gmail.com \
    --to=iohannes.eduardus.arnold@gmail.com \
    --cc=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    --cc=pcc@lists.ludd.ltu.se \
    --cc=ragge@ludd.ltu.se \
    /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).