From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Yousong Zhou <yszhou4tech@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>, Chen Jie <chenj@lemote.com>,
linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
Florian Fainelli <florian@openwrt.org>
Subject: Re: [PATCH] MIPS: UAPI: Fix unrecognized opcode WSBH/DSBH/DSHD when using MIPS16.
Date: Mon, 7 Sep 2015 00:23:12 +0100 (BST) [thread overview]
Message-ID: <alpine.LFD.2.20.1509062335060.10227@eddie.linux-mips.org> (raw)
In-Reply-To: <CAECwjAiyaWMeh32SOWPi8k=Zb4bQW3mNkbC6drnyy3Wtn924Ng@mail.gmail.com>
On Sun, 6 Sep 2015, Yousong Zhou wrote:
> Hi, Maciej, first of all, thank you for your time on this,
> appreciate it.
You're welcome!
> > The bug certainly was there, it's just your analysis and consequently the
> > fix that are wrong in the general case for some reason, maybe a buggy
> > compiler.
> >
>
> This is the compiler "--version",
>
> mips-openwrt-linux-gcc (OpenWrt/Linaro GCC 4.8-2014.04 r46763) 4.8.3
A-ha! I've checked GCC's history and the symptom you're seeing was PR
target/55777:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55777
and the bug has only been fixed pretty recently (r199328), already after
GCC 4.8 has branched. From your troubles I infer the fix has not been
backported to 4.8 and therefore is only available from GCC 4.9 up; of
course either you or OpenWrt can still backport it and apply locally.
Fortunately as I noted you need not dive into that hole as the
reasonable choice here is to avoid the asm for MIPS16 code altogether,
regardless of the GCC bug.
> > Now if you stick `.set nomips16' just above WSBH, then this code will
> > happily assemble, because this single instruction only (`.set pop' reverts
> > any previous `.set' directives; I'm assuming you wrote above by hand and
> > `.pop' is a typo) will assemble in the regular MIPS instruction mode. But
> > if this code is ever reached, then the processor will still execute the
> > machine code produced by the assembler from the WSBH instruction in the
> > MIPS16 mode.
>
> Yes, I hand-copied it from the output of "gcc -S" just to
> show the form/pattern (the original output is too long for
> this conversation). No, that `.pop' is not a typo (I just
> did a double-check).
Well, please check again then as there's no such pseudo-op:
$ cat pop.s
.pop
$ mips-mti-linux-gnu-as -o pop.o pop.s
pop.s: Assembler messages:
pop.s:1: Error: unknown pseudo-op: `.pop'
$
> > No, it's your bug after all. I think the last paragraph I wrote quoted
> > above combined with the source code in question make it clear what to do.
>
> Okay, I will try. Most of the time when textbooks read
> clearly/obviously/apparently, things go astray ;)
Well, if you really find yourself stuck with it, then come back for
more hints, however please do try figuring it out yourself first as
it'll be a good exercise.
Maciej
prev parent reply other threads:[~2015-09-06 23:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 9:47 Yousong Zhou
2015-09-04 18:52 ` Maciej W. Rozycki
2015-09-05 3:29 ` Yousong Zhou
2015-09-05 3:34 ` Yousong Zhou
2015-09-05 14:25 ` Maciej W. Rozycki
2015-09-06 2:42 ` Yousong Zhou
2015-09-06 23:23 ` Maciej W. Rozycki [this message]
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=alpine.LFD.2.20.1509062335060.10227@eddie.linux-mips.org \
--to=macro@linux-mips.org \
--cc=chenj@lemote.com \
--cc=florian@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=yszhou4tech@gmail.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®