From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: export tishift functions to modules
Date: Tue, 24 Apr 2018 14:34:49 +0100 [thread overview]
Message-ID: <20180424133449.GA24599@arm.com> (raw)
In-Reply-To: <20180415160416.28161-1-Jason@zx2c4.com>
Hi Jason,
On Sun, Apr 15, 2018 at 06:04:16PM +0200, Jason A. Donenfeld wrote:
> Otherwise modules that use these arithmetic operations will fail to
> link. We accomplish this with EXPORT_SYMBOL in the .S file, but because
> of symbol versioning, we actually need to have a declaration of these
> too in C. So, we introduce asm-prototypes.h, which is the same file name
> and technique used for similar reasons in the m68k arch tree.
>
> While we're at it, we also fix this up to use SPDX, and I personally
> choose to relicense this as GPL2||BSD so that these symbols don't need
> to be export_symbol_gpl, so all modules can use the routines, since
> these are important general purpose compiler-generated function calls.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> Reported-by: PaX Team <pageexec@freemail.hu>
> Cc: stable at vger.kernel.org
> ---
> arch/arm64/include/asm/asm-prototypes.h | 11 +++++++++++
> arch/arm64/lib/tishift.S | 19 ++++++-------------
> 2 files changed, 17 insertions(+), 13 deletions(-)
> create mode 100644 arch/arm64/include/asm/asm-prototypes.h
I've not run into any build issues here -- is this specifically with some
out-of-tree module?
> diff --git a/arch/arm64/include/asm/asm-prototypes.h b/arch/arm64/include/asm/asm-prototypes.h
> new file mode 100644
> index 000000000000..8f1919e44f51
> --- /dev/null
> +++ b/arch/arm64/include/asm/asm-prototypes.h
It would be better not to introduce a new header file just for this, I
think. How about compiler.h instead?
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
> + *
> + * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> + */
> +
> +/* These functions are defined in lib/tishift.S, but need to be declared
> + * here so that symbol versioning picks them up.
> + */
> +extern long long __ashlti3(long long a, int b);
> +extern long long __ashrti3(long long a, int b);
> +extern long long __lshrti3(long long a, int b);
> diff --git a/arch/arm64/lib/tishift.S b/arch/arm64/lib/tishift.S
> index d3db9b2cd479..3bca433973cb 100644
> --- a/arch/arm64/lib/tishift.S
> +++ b/arch/arm64/lib/tishift.S
> @@ -1,20 +1,10 @@
> -/*
> - * Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
> *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> */
>
> #include <linux/linkage.h>
> +#include <asm-generic/export.h>
>
> ENTRY(__ashlti3)
> cbz x2, 1f
> @@ -36,6 +26,7 @@ ENTRY(__ashlti3)
> mov x0, x2
> ret
> ENDPROC(__ashlti3)
> +EXPORT_SYMBOL(__ashlti3)
We normally export asm symbols via arm64ksyms.c. In fact, would doing that
remove the need for the explicit declarations completely?
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-arm-kernel@lists.infradead.org,
LKML <linux-kernel@vger.kernel.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
PaX Team <pageexec@freemail.hu>,
stable@vger.kernel.org
Subject: Re: [PATCH] arm64: export tishift functions to modules
Date: Tue, 24 Apr 2018 14:34:49 +0100 [thread overview]
Message-ID: <20180424133449.GA24599@arm.com> (raw)
In-Reply-To: <20180415160416.28161-1-Jason@zx2c4.com>
Hi Jason,
On Sun, Apr 15, 2018 at 06:04:16PM +0200, Jason A. Donenfeld wrote:
> Otherwise modules that use these arithmetic operations will fail to
> link. We accomplish this with EXPORT_SYMBOL in the .S file, but because
> of symbol versioning, we actually need to have a declaration of these
> too in C. So, we introduce asm-prototypes.h, which is the same file name
> and technique used for similar reasons in the m68k arch tree.
>
> While we're at it, we also fix this up to use SPDX, and I personally
> choose to relicense this as GPL2||BSD so that these symbols don't need
> to be export_symbol_gpl, so all modules can use the routines, since
> these are important general purpose compiler-generated function calls.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> Reported-by: PaX Team <pageexec@freemail.hu>
> Cc: stable@vger.kernel.org
> ---
> arch/arm64/include/asm/asm-prototypes.h | 11 +++++++++++
> arch/arm64/lib/tishift.S | 19 ++++++-------------
> 2 files changed, 17 insertions(+), 13 deletions(-)
> create mode 100644 arch/arm64/include/asm/asm-prototypes.h
I've not run into any build issues here -- is this specifically with some
out-of-tree module?
> diff --git a/arch/arm64/include/asm/asm-prototypes.h b/arch/arm64/include/asm/asm-prototypes.h
> new file mode 100644
> index 000000000000..8f1919e44f51
> --- /dev/null
> +++ b/arch/arm64/include/asm/asm-prototypes.h
It would be better not to introduce a new header file just for this, I
think. How about compiler.h instead?
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
> + *
> + * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> + */
> +
> +/* These functions are defined in lib/tishift.S, but need to be declared
> + * here so that symbol versioning picks them up.
> + */
> +extern long long __ashlti3(long long a, int b);
> +extern long long __ashrti3(long long a, int b);
> +extern long long __lshrti3(long long a, int b);
> diff --git a/arch/arm64/lib/tishift.S b/arch/arm64/lib/tishift.S
> index d3db9b2cd479..3bca433973cb 100644
> --- a/arch/arm64/lib/tishift.S
> +++ b/arch/arm64/lib/tishift.S
> @@ -1,20 +1,10 @@
> -/*
> - * Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
> *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> */
>
> #include <linux/linkage.h>
> +#include <asm-generic/export.h>
>
> ENTRY(__ashlti3)
> cbz x2, 1f
> @@ -36,6 +26,7 @@ ENTRY(__ashlti3)
> mov x0, x2
> ret
> ENDPROC(__ashlti3)
> +EXPORT_SYMBOL(__ashlti3)
We normally export asm symbols via arm64ksyms.c. In fact, would doing that
remove the need for the explicit declarations completely?
Will
next prev parent reply other threads:[~2018-04-24 13:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-15 16:04 [PATCH] arm64: export tishift functions to modules Jason A. Donenfeld
2018-04-15 16:04 ` Jason A. Donenfeld
2018-04-24 13:34 ` Will Deacon [this message]
2018-04-24 13:34 ` Will Deacon
-- strict thread matches above, loose matches on Subject: below --
2018-04-24 13:43 Jason A. Donenfeld
2018-04-24 15:40 ` Will Deacon
2018-04-24 15:40 ` Will Deacon
2018-04-24 15:56 ` Jason A. Donenfeld
2018-04-24 15:56 ` Jason A. Donenfeld
2018-04-26 8:31 ` Will Deacon
2018-04-26 8:31 ` Will Deacon
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=20180424133449.GA24599@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.