From: Daniel Sanders <daniel.sanders@imgtec.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Daniel Sanders <daniel.sanders@imgtec.com>,
Toma Tabacu <toma.tabacu@imgtec.com>,
Ralf Baechle <ralf@linux-mips.org>,
Markos Chandras <markos.chandras@imgtec.com>,
Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>,
<linux-mips@linux-mips.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v4 3/4] MIPS: LLVMLinux: Fix an 'inline asm input/output type mismatch' error.
Date: Tue, 24 Feb 2015 15:25:10 +0000 [thread overview]
Message-ID: <1424791511-11407-4-git-send-email-daniel.sanders@imgtec.com> (raw)
In-Reply-To: <1424791511-11407-1-git-send-email-daniel.sanders@imgtec.com>
Replace incorrect matching constraint that caused the error with an alternative
that still has the required constraints on the inline assembly.
This is the error message reported by clang:
arch/mips/include/asm/checksum.h:285:27: error: unsupported inline asm: input with type '__be32' (aka 'unsigned int') matching output with type 'unsigned short'
"0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
^~~~~~~~~~~~
The changed code can be compiled successfully by both gcc and clang.
Signed-off-by: Daniel Sanders <daniel.sanders@imgtec.com>
Signed-off-by: Toma Tabacu <toma.tabacu@imgtec.com>
Suggested-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
---
v2 replaced the patch following Maciej's suggestion where he observed that
the assembly was somewhat strange and suggested correcting the
constraints and using a local of matching type.
v3 fixed a small whitespace issue.
v4 refreshes the patch.
arch/mips/include/asm/checksum.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
index 5c585c5..3ceacde 100644
--- a/arch/mips/include/asm/checksum.h
+++ b/arch/mips/include/asm/checksum.h
@@ -218,6 +218,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
__u32 len, unsigned short proto,
__wsum sum)
{
+ __wsum tmp;
+
__asm__(
" .set push # csum_ipv6_magic\n"
" .set noreorder \n"
@@ -270,9 +272,9 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
" addu %0, $1 # Add final carry\n"
" .set pop"
- : "=r" (sum), "=r" (proto)
+ : "=&r" (sum), "=&r" (tmp)
: "r" (saddr), "r" (daddr),
- "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
+ "0" (htonl(len)), "r" (htonl(proto)), "r" (sum));
return csum_fold(sum);
}
--
2.1.4
next prev parent reply other threads:[~2015-02-24 15:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 15:25 [PATCH v2 0/4] MIPS: LLVMLinux: Patches to enable compilation of a working kernel for MIPS using Clang/LLVM Daniel Sanders
2015-02-24 15:25 ` [PATCH v4 1/4] slab: Correct size_index table before replacing the bootstrap kmem_cache_node Daniel Sanders
2015-04-20 15:05 ` [PATCH v5] " Daniel Sanders
2015-04-20 15:42 ` Christoph Lameter
2015-04-20 16:16 ` Daniel Sanders
2015-02-24 15:25 ` [PATCH v2 2/4] MIPS: LLVMLinux: Fix a 'cast to type not present in union' error Daniel Sanders
2015-02-24 15:25 ` Daniel Sanders [this message]
2015-02-24 15:25 ` [PATCH v2 4/4] MIPS: LLVMLinux: Silence variable self-assignment warnings Daniel Sanders
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=1424791511-11407-4-git-send-email-daniel.sanders@imgtec.com \
--to=daniel.sanders@imgtec.com \
--cc=Leonid.Yegoshin@imgtec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=markos.chandras@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=toma.tabacu@imgtec.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®