From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
YunQiang Su <syq@debian.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Huacai Chen <chenhuacai@kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
"open list:MIPS" <linux-mips@vger.kernel.org>
Subject: Re: [PATCH] MIPS: Support binutils configured with --enable-mips-fix-loongson3-llsc=yes
Date: Sat, 9 Jan 2021 19:53:19 +0000 (GMT) [thread overview]
Message-ID: <alpine.LFD.2.21.2101091944330.1637534@eddie.linux-mips.org> (raw)
In-Reply-To: <20210109193048.478339-1-aurelien@aurel32.net>
On Sat, 9 Jan 2021, Aurelien Jarno wrote:
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index cd4343edeb11..5ffdd67093bc 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -136,6 +136,25 @@ cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
> #
> cflags-y += -fno-stack-check
>
> +# binutils from v2.35 when built with --enable-mips-fix-loongson3-llsc=yes,
> +# supports an -mfix-loongson3-llsc flag which emits a sync prior to each ll
> +# instruction to work around a CPU bug (see __SYNC_loongson3_war in asm/sync.h
> +# for a description).
> +#
> +# We disable this in order to prevent the assembler meddling with the
> +# instruction that labels refer to, ie. if we label an ll instruction:
> +#
> +# 1: ll v0, 0(a0)
> +#
> +# ...then with the assembler fix applied the label may actually point at a sync
> +# instruction inserted by the assembler, and if we were using the label in an
> +# exception table the table would no longer contain the address of the ll
> +# instruction.
Interesting. Given that a MIPS assembler is generally free to shuffle
instructions as it sees fit in its default reorder mode as long as that
does not change the semantics of the code executed, shouldn't we instead
place all label/instruction pairs used for exception handling in noreorder
blocks so as to make sure the label refers to the instruction an exception
handler expects it to?
E.g. for the case quoted above:
.set push
.set noreorder
1: ll v0, 0(a0)
.set pop
Maciej
next prev parent reply other threads:[~2021-01-09 20:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-09 19:30 [PATCH] MIPS: Support binutils configured with --enable-mips-fix-loongson3-llsc=yes Aurelien Jarno
2021-01-09 19:53 ` Maciej W. Rozycki [this message]
2021-01-15 14:42 ` Thomas Bogendoerfer
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.21.2101091944330.1637534@eddie.linux-mips.org \
--to=macro@linux-mips.org \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syq@debian.org \
--cc=tsbogend@alpha.franken.de \
/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