Stefan Agner <[email protected]> writes:

> The LLVM Target parser currently does not allow to specify the security
> extension as part of -march (see also LLVM Bug 40186 [0]). When trying
> to use Clang with LLVM's integrated assembler, this leads to build
> errors such as this:
>   clang-8: error: the clang compiler does not support '-Wa,-march=armv7-a+sec'
>
> Use ".arch_extension sec" to enable the security extension in a more
> portable fasion. Also make sure to use ".arch armv7-a" in case a v6/v7
> multi-platform kernel is being built.
>
> Note that this is technically not exactly the same as the old code
> checked for availabilty of the security extension by calling as-instr.
> However, there are already other sites which use ".arch_extension sec"
> unconditionally, hence de-facto we need an assembler capable of
> ".arch_extension sec" already today (arch/arm/mm/proc-v7.S). The
> arch extension "sec" is available since binutils 2.21 according to
> its documentation [1].
>
> [0] https://bugs.llvm.org/show_bug.cgi?id=40186
> [1] https://sourceware.org/binutils/docs-2.21/as/ARM-Options.html
>
> Signed-off-by: Stefan Agner <[email protected]>
> Acked-by: Mans Rullgard <[email protected]>
> Acked-by: Arnd Bergmann <[email protected]>
> Acked-by: Krzysztof Kozlowski <[email protected]>
> ---
> Changes since v1:
> - Explicitly specify assembler architecture as armv7-a to avoid
>   build issues when bulding v6/v7 multi arch kernel.
>
>  arch/arm/mach-bcm/Makefile         | 3 ---
>  arch/arm/mach-bcm/bcm_kona_smc.c   | 2 --
>  arch/arm/mach-exynos/Makefile      | 4 ----
>  arch/arm/mach-exynos/exynos-smc.S  | 3 ++-
>  arch/arm/mach-exynos/sleep.S       | 3 ++-
>  arch/arm/mach-highbank/Makefile    | 3 ---
>  arch/arm/mach-highbank/smc.S       | 3 ++-
>  arch/arm/mach-keystone/Makefile    | 3 ---
>  arch/arm/mach-keystone/smc.S       | 1 +
>  arch/arm/mach-omap2/Makefile       | 8 --------
>  arch/arm/mach-omap2/omap-headsmp.S | 2 ++
>  arch/arm/mach-omap2/omap-smc.S     | 3 ++-
>  arch/arm/mach-omap2/sleep33xx.S    | 1 +
>  arch/arm/mach-omap2/sleep34xx.S    | 2 ++
>  arch/arm/mach-omap2/sleep43xx.S    | 2 ++
>  arch/arm/mach-omap2/sleep44xx.S    | 2 ++
>  arch/arm/mach-tango/Makefile       | 3 ---
>  arch/arm/mach-tango/smc.S          | 1 +
>  18 files changed, 19 insertions(+), 30 deletions(-)

[...]

> diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c 
> b/arch/arm/mach-bcm/bcm_kona_smc.c
> index a55a7ecf146a..541e850a736c 100644
> --- a/arch/arm/mach-bcm/bcm_kona_smc.c
> +++ b/arch/arm/mach-bcm/bcm_kona_smc.c
> @@ -125,9 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 
> buffer_phys)
>               __asmeq("%2", "r4")
>               __asmeq("%3", "r5")
>               __asmeq("%4", "r6")
> -#ifdef REQUIRES_SEC
>               ".arch_extension sec\n"
> -#endif
>               "       smc    #0\n"
>               : "=r" (ip), "=r" (r0)
>               : "r" (r4), "r" (r5), "r" (r6)

[...]

> diff --git a/arch/arm/mach-keystone/smc.S b/arch/arm/mach-keystone/smc.S
> index d15de8179fab..ec03dc499270 100644
> --- a/arch/arm/mach-keystone/smc.S
> +++ b/arch/arm/mach-keystone/smc.S
> @@ -21,6 +21,7 @@
>   *
>   * Return: Non zero value on failure
>   */
> +     .arch_extension sec
>  ENTRY(keystone_cpu_smc)
>       stmfd   sp!, {r4-r11, lr}
>       smc     #0

[...]

> diff --git a/arch/arm/mach-tango/smc.S b/arch/arm/mach-tango/smc.S
> index 361a8dc89804..cf2d21e5226c 100644
> --- a/arch/arm/mach-tango/smc.S
> +++ b/arch/arm/mach-tango/smc.S
> @@ -1,6 +1,7 @@
>  /* SPDX-License-Identifier: GPL-2.0 */
>  #include <linux/linkage.h>
>
> +     .arch_extension sec
>  ENTRY(tango_smc)
>       push    {lr}
>       mov     ip, r1

Is there some reason these three don't need the .arch directive?

-- 
Måns Rullgård

Reply via email to