* [PATCH 1/2] lib/mpi: avoid assembler warning
@ 2016-02-26 12:46 Arnd Bergmann
2016-02-26 12:46 ` [PATCH 2/2] lib/mpi: use "static inline" instead of "extern inline" Arnd Bergmann
2016-02-27 19:35 ` [PATCH 1/2] lib/mpi: avoid assembler warning Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-02-26 12:46 UTC (permalink / raw)
To: Herbert Xu
Cc: linux-arm-kernel, Dmitry Kasatkin, linux-crypto, David Howells,
Arnd Bergmann, linux-kernel
A wrapper around the umull assembly instruction might reuse
the input register as an output, which is undefined on
some ARM machines, as pointed out by this assembler warning:
CC lib/mpi/generic_mpih-mul1.o
/tmp/ccxJuxIy.s: Assembler messages:
/tmp/ccxJuxIy.s:53: rdhi, rdlo and rm must all be different
CC lib/mpi/generic_mpih-mul2.o
/tmp/ccI0scAD.s: Assembler messages:
/tmp/ccI0scAD.s:53: rdhi, rdlo and rm must all be different
CC lib/mpi/generic_mpih-mul3.o
/tmp/ccMvVQcp.s: Assembler messages:
/tmp/ccMvVQcp.s:53: rdhi, rdlo and rm must all be different
This changes the constraints to force different registers to
be used as output.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
lib/mpi/longlong.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h
index b90e255c2a68..93336502af08 100644
--- a/lib/mpi/longlong.h
+++ b/lib/mpi/longlong.h
@@ -216,7 +216,7 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);
__asm__ ("%@ Inlined umul_ppmm\n" \
"umull %r1, %r0, %r2, %r3" \
: "=&r" ((USItype)(xh)), \
- "=r" ((USItype)(xl)) \
+ "=&r" ((USItype)(xl)) \
: "r" ((USItype)(a)), \
"r" ((USItype)(b)) \
: "r0", "r1")
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] lib/mpi: use "static inline" instead of "extern inline"
2016-02-26 12:46 [PATCH 1/2] lib/mpi: avoid assembler warning Arnd Bergmann
@ 2016-02-26 12:46 ` Arnd Bergmann
2016-02-27 19:35 ` [PATCH 1/2] lib/mpi: avoid assembler warning Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-02-26 12:46 UTC (permalink / raw)
To: Herbert Xu
Cc: linux-arm-kernel, Dmitry Kasatkin, linux-crypto, David Howells,
Arnd Bergmann, linux-kernel
When we use CONFIG_PROFILE_ALL_BRANCHES, every 'if()' introduces
a static variable, but that is not allowed in 'extern inline'
functions:
mpi-inline.h:116:204: warning: '______f' is static but declared in inline function 'mpihelp_sub' which is not static
mpi-inline.h:113:184: warning: '______f' is static but declared in inline function 'mpihelp_sub' which is not static
mpi-inline.h:70:184: warning: '______f' is static but declared in inline function 'mpihelp_add' which is not static
mpi-inline.h:56:204: warning: '______f' is static but declared in inline function 'mpihelp_add_1' which is not static
This changes the MPI code to use 'static inline' instead, to get
rid of hundreds of warnings.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
lib/mpi/mpi-inline.h | 2 +-
lib/mpi/mpi-internal.h | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/mpi/mpi-inline.h b/lib/mpi/mpi-inline.h
index e2b39852b30a..c245ea31f785 100644
--- a/lib/mpi/mpi-inline.h
+++ b/lib/mpi/mpi-inline.h
@@ -30,7 +30,7 @@
#define G10_MPI_INLINE_H
#ifndef G10_MPI_INLINE_DECL
-#define G10_MPI_INLINE_DECL extern inline
+#define G10_MPI_INLINE_DECL static inline
#endif
G10_MPI_INLINE_DECL mpi_limb_t
diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h
index c65dd1bff45a..7eceeddb3fb8 100644
--- a/lib/mpi/mpi-internal.h
+++ b/lib/mpi/mpi-internal.h
@@ -168,19 +168,19 @@ void mpi_rshift_limbs(MPI a, unsigned int count);
int mpi_lshift_limbs(MPI a, unsigned int count);
/*-- mpihelp-add.c --*/
-mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
+static inline mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_size_t s1_size, mpi_limb_t s2_limb);
mpi_limb_t mpihelp_add_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_ptr_t s2_ptr, mpi_size_t size);
-mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
+static inline mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
mpi_ptr_t s2_ptr, mpi_size_t s2_size);
/*-- mpihelp-sub.c --*/
-mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
+static inline mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_size_t s1_size, mpi_limb_t s2_limb);
mpi_limb_t mpihelp_sub_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_ptr_t s2_ptr, mpi_size_t size);
-mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
+static inline mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
mpi_ptr_t s2_ptr, mpi_size_t s2_size);
/*-- mpihelp-cmp.c --*/
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] lib/mpi: avoid assembler warning
2016-02-26 12:46 [PATCH 1/2] lib/mpi: avoid assembler warning Arnd Bergmann
2016-02-26 12:46 ` [PATCH 2/2] lib/mpi: use "static inline" instead of "extern inline" Arnd Bergmann
@ 2016-02-27 19:35 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2016-02-27 19:35 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, Dmitry Kasatkin, linux-crypto, David Howells,
linux-kernel
On Fri, Feb 26, 2016 at 01:46:26PM +0100, Arnd Bergmann wrote:
> A wrapper around the umull assembly instruction might reuse
> the input register as an output, which is undefined on
> some ARM machines, as pointed out by this assembler warning:
>
> CC lib/mpi/generic_mpih-mul1.o
> /tmp/ccxJuxIy.s: Assembler messages:
> /tmp/ccxJuxIy.s:53: rdhi, rdlo and rm must all be different
> CC lib/mpi/generic_mpih-mul2.o
> /tmp/ccI0scAD.s: Assembler messages:
> /tmp/ccI0scAD.s:53: rdhi, rdlo and rm must all be different
> CC lib/mpi/generic_mpih-mul3.o
> /tmp/ccMvVQcp.s: Assembler messages:
> /tmp/ccMvVQcp.s:53: rdhi, rdlo and rm must all be different
>
> This changes the constraints to force different registers to
> be used as output.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Both applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-27 19:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 12:46 [PATCH 1/2] lib/mpi: avoid assembler warning Arnd Bergmann
2016-02-26 12:46 ` [PATCH 2/2] lib/mpi: use "static inline" instead of "extern inline" Arnd Bergmann
2016-02-27 19:35 ` [PATCH 1/2] lib/mpi: avoid assembler warning Herbert Xu
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).