Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 9263/1: use .arch directives instead of assembler command line flags

Similar to commit a6c30873ee4a ("ARM: 8989/1: use .fpu assembler
directives instead of assembler arguments").

GCC and GNU binutils support setting the "sub arch" via -march=,
-Wa,-march, target function attribute, and .arch assembler directive.

Clang was missing support for -Wa,-march=, but this was implemented in
clang-13.

The behavior of both GCC and Clang is to
prefer -Wa,-march= over -march= for assembler and assembler-with-cpp
sources, but Clang will warn about the -march= being unused.

clang: warning: argument unused during compilation: '-march=armv6k'
[-Wunused-command-line-argument]

Since most assembler is non-conditionally assembled with one sub arch
(modulo arch/arm/delay-loop.S which conditionally is assembled as armv4
based on CONFIG_ARCH_RPC, and arch/arm/mach-at91/pm-suspend.S which is
conditionally assembled as armv7-a based on CONFIG_CPU_V7), prefer the
.arch assembler directive.

Add a few more instances found in compile testing as found by Arnd and
Nathan.

Link: https://github.com/llvm/llvm-project/commit/1d51c699b9e2ebc5bcfdbe85c74cc871426333d4
Link: https://bugs.llvm.org/show_bug.cgi?id=48894
Link: https://github.com/ClangBuiltLinux/linux/issues/1195
Link: https://github.com/ClangBuiltLinux/linux/issues/1315

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

authored by

Nick Desaulniers and committed by
Russell King (Oracle)
a2faac39 5aa4860e

+54 -40
-1
arch/arm/boot/compressed/Makefile
··· 164 164 $(obj)/piggy.o: $(obj)/piggy_data 165 165 166 166 CFLAGS_font.o := -Dstatic= 167 - AFLAGS_hyp-stub.o := -Wa,-march=armv7-a
-2
arch/arm/common/Makefile
··· 13 13 obj-$(CONFIG_CPU_V7) += secure_cntvoff.o 14 14 obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o 15 15 CFLAGS_REMOVE_mcpm_entry.o = -pg 16 - AFLAGS_mcpm_head.o := -march=armv7-a 17 - AFLAGS_vlock.o := -march=armv7-a 18 16 obj-$(CONFIG_BL_SWITCHER) += bL_switcher.o 19 17 obj-$(CONFIG_BL_SWITCHER_DUMMY_IF) += bL_switcher_dummy_if.o
+2
arch/arm/common/mcpm_head.S
··· 15 15 16 16 #include "vlock.h" 17 17 18 + .arch armv7-a 19 + 18 20 .if MCPM_SYNC_CLUSTER_CPUS 19 21 .error "cpus must be the first member of struct mcpm_sync_struct" 20 22 .endif
+2
arch/arm/common/vlock.S
··· 12 12 #include <linux/linkage.h> 13 13 #include "vlock.h" 14 14 15 + .arch armv7-a 16 + 15 17 /* Select different code if voting flags can fit in a single word. */ 16 18 #if VLOCK_VOTING_SIZE > 4 17 19 #define FEW(x...)
-2
arch/arm/kernel/Makefile
··· 71 71 obj-$(CONFIG_OF) += devtree.o 72 72 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 73 73 obj-$(CONFIG_SWP_EMULATE) += swp_emulate.o 74 - CFLAGS_swp_emulate.o := -Wa,-march=armv7-a 75 74 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 76 75 77 76 obj-$(CONFIG_CPU_XSCALE) += xscale-cp0.o ··· 99 100 obj-$(CONFIG_XIP_DEFLATED_DATA) += head-inflate-data.o 100 101 101 102 obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o 102 - AFLAGS_hyp-stub.o :=-Wa,-march=armv7-a 103 103 ifeq ($(CONFIG_ARM_PSCI),y) 104 104 obj-$(CONFIG_SMP) += psci_smp.o 105 105 endif
+2
arch/arm/kernel/hyp-stub.S
··· 9 9 #include <asm/assembler.h> 10 10 #include <asm/virt.h> 11 11 12 + .arch armv7-a 13 + 12 14 #ifndef ZIMAGE 13 15 /* 14 16 * For the kernel proper, we need to find out the CPU boot mode long after
+1
arch/arm/kernel/swp_emulate.c
··· 34 34 */ 35 35 #define __user_swpX_asm(data, addr, res, temp, B) \ 36 36 __asm__ __volatile__( \ 37 + ".arch armv7-a\n" \ 37 38 "0: ldrex"B" %2, [%3]\n" \ 38 39 "1: strex"B" %0, %1, [%3]\n" \ 39 40 " cmp %0, #0\n" \
-4
arch/arm/lib/Makefile
··· 36 36 lib-y += io-readsw-armv4.o io-writesw-armv4.o 37 37 endif 38 38 39 - ifeq ($(CONFIG_ARCH_RPC),y) 40 - AFLAGS_delay-loop.o += -march=armv4 41 - endif 42 - 43 39 $(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S 44 40 $(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S 45 41
+4
arch/arm/lib/delay-loop.S
··· 8 8 #include <asm/assembler.h> 9 9 #include <asm/delay.h> 10 10 11 + #ifdef CONFIG_ARCH_RPC 12 + .arch armv4 13 + #endif 14 + 11 15 .text 12 16 13 17 .LC0: .word loops_per_jiffy
-3
arch/arm/mach-at91/Makefile
··· 14 14 # Power Management 15 15 obj-$(CONFIG_ATMEL_PM) += pm.o pm_suspend.o 16 16 17 - ifeq ($(CONFIG_CPU_V7),y) 18 - AFLAGS_pm_suspend.o := -march=armv7-a 19 - endif 20 17 ifeq ($(CONFIG_PM_DEBUG),y) 21 18 CFLAGS_pm.o += -DDEBUG 22 19 endif
+4
arch/arm/mach-at91/pm_suspend.S
··· 12 12 #include "pm.h" 13 13 #include "pm_data-offsets.h" 14 14 15 + #ifdef CONFIG_CPU_V7 16 + .arch armv7-a 17 + #endif 18 + 15 19 #define SRAMC_SELF_FRESH_ACTIVE 0x01 16 20 #define SRAMC_SELF_FRESH_EXIT 0x00 17 21
-3
arch/arm/mach-imx/Makefile
··· 34 34 obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o 35 35 obj-$(CONFIG_HAVE_IMX_SRC) += src.o 36 36 ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_IMX7D_CA7)$(CONFIG_SOC_LS1021A),) 37 - AFLAGS_headsmp.o :=-Wa,-march=armv7-a 38 37 obj-$(CONFIG_SMP) += headsmp.o platsmp.o 39 38 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 40 39 endif ··· 47 48 obj-$(CONFIG_SOC_IMX7ULP) += mach-imx7ulp.o pm-imx7ulp.o 48 49 49 50 ifeq ($(CONFIG_SUSPEND),y) 50 - AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a 51 51 obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o 52 52 obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o 53 53 endif 54 54 ifeq ($(CONFIG_ARM_CPU_SUSPEND),y) 55 - AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a 56 55 obj-$(CONFIG_SOC_IMX6) += resume-imx6.o 57 56 endif 58 57 obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
+2
arch/arm/mach-imx/headsmp.S
··· 8 8 #include <linux/init.h> 9 9 #include <asm/assembler.h> 10 10 11 + .arch armv7-a 12 + 11 13 diag_reg_offset: 12 14 .word g_diag_reg - . 13 15
+2
arch/arm/mach-imx/resume-imx6.S
··· 9 9 #include <asm/hardware/cache-l2x0.h> 10 10 #include "hardware.h" 11 11 12 + .arch armv7-a 13 + 12 14 /* 13 15 * The following code must assume it is running from physical address 14 16 * where absolute virtual addresses to the data section have to be
+2
arch/arm/mach-imx/suspend-imx6.S
··· 9 9 #include <asm/hardware/cache-l2x0.h> 10 10 #include "hardware.h" 11 11 12 + .arch armv7-a 13 + 12 14 /* 13 15 * ==================== low level suspend ==================== 14 16 *
-3
arch/arm/mach-mvebu/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/plat-orion/include 3 3 4 - AFLAGS_coherency_ll.o := -Wa,-march=armv7-a 5 - CFLAGS_pmsu.o := -march=armv7-a 6 - 7 4 obj-$(CONFIG_MACH_MVEBU_ANY) += system-controller.o mvebu-soc-id.o 8 5 9 6 ifeq ($(CONFIG_MACH_MVEBU_V7),y)
+1
arch/arm/mach-mvebu/coherency_ll.S
··· 20 20 #include <asm/assembler.h> 21 21 #include <asm/cp15.h> 22 22 23 + .arch armv7-a 23 24 .text 24 25 /* 25 26 * Returns the coherency base address in r1 (r0 is untouched), or 0 if
+1
arch/arm/mach-mvebu/pmsu.c
··· 291 291 292 292 /* Test the CR_C bit and set it if it was cleared */ 293 293 asm volatile( 294 + ".arch armv7-a\n\t" 294 295 "mrc p15, 0, r0, c1, c0, 0 \n\t" 295 296 "tst r0, %0 \n\t" 296 297 "orreq r0, r0, #(1 << 2) \n\t"
-2
arch/arm/mach-npcm/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - AFLAGS_headsmp.o += -march=armv7-a 3 - 4 2 obj-$(CONFIG_ARCH_WPCM450) += wpcm450.o 5 3 obj-$(CONFIG_ARCH_NPCM7XX) += npcm7xx.o 6 4 obj-$(CONFIG_SMP) += platsmp.o headsmp.o
+2
arch/arm/mach-npcm/headsmp.S
··· 6 6 #include <linux/init.h> 7 7 #include <asm/assembler.h> 8 8 9 + .arch armv7-a 10 + 9 11 /* 10 12 * The boot ROM does not start secondary CPUs in SVC mode, so we need to do that 11 13 * here.
-2
arch/arm/mach-tegra/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - asflags-y += -march=armv7-a 3 - 4 2 obj-y += io.o 5 3 obj-y += irq.o 6 4 obj-y += pm.o
+2
arch/arm/mach-tegra/reset-handler.S
··· 19 19 20 20 #define PMC_SCRATCH41 0x140 21 21 22 + .arch armv7-a 23 + 22 24 #ifdef CONFIG_PM_SLEEP 23 25 /* 24 26 * tegra_resume
+2
arch/arm/mach-tegra/sleep-tegra20.S
··· 47 47 #define PLLM_STORE_MASK (1 << 1) 48 48 #define PLLP_STORE_MASK (1 << 2) 49 49 50 + .arch armv7-a 51 + 50 52 .macro test_pll_state, rd, test_mask 51 53 ldr \rd, tegra_pll_state 52 54 tst \rd, #\test_mask
+2
arch/arm/mach-tegra/sleep-tegra30.S
··· 78 78 #define PLLX_STORE_MASK (1 << 4) 79 79 #define PLLM_PMC_STORE_MASK (1 << 5) 80 80 81 + .arch armv7-a 82 + 81 83 .macro emc_device_mask, rd, base 82 84 ldr \rd, [\base, #EMC_ADR_CFG] 83 85 tst \rd, #0x1
+2
arch/arm/mach-tegra/sleep.S
··· 22 22 #define CLK_RESET_CCLK_BURST 0x20 23 23 #define CLK_RESET_CCLK_DIVIDER 0x24 24 24 25 + .arch armv7-a 26 + 25 27 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PM_SLEEP) 26 28 /* 27 29 * tegra_disable_clean_inv_dcache
-15
arch/arm/mm/Makefile
··· 33 33 obj-$(CONFIG_CPU_ABRT_EV6) += abort-ev6.o 34 34 obj-$(CONFIG_CPU_ABRT_EV7) += abort-ev7.o 35 35 36 - AFLAGS_abort-ev6.o :=-Wa,-march=armv6k 37 - AFLAGS_abort-ev7.o :=-Wa,-march=armv7-a 38 - 39 36 obj-$(CONFIG_CPU_PABRT_LEGACY) += pabort-legacy.o 40 37 obj-$(CONFIG_CPU_PABRT_V6) += pabort-v6.o 41 38 obj-$(CONFIG_CPU_PABRT_V7) += pabort-v7.o ··· 46 49 obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o 47 50 obj-$(CONFIG_CPU_CACHE_V7M) += cache-v7m.o 48 51 49 - AFLAGS_cache-v6.o :=-Wa,-march=armv6 50 - AFLAGS_cache-v7.o :=-Wa,-march=armv7-a 51 - AFLAGS_cache-v7m.o :=-Wa,-march=armv7-m 52 - 53 52 obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o 54 53 obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o 55 54 obj-$(CONFIG_CPU_COPY_FEROCEON) += copypage-feroceon.o ··· 55 62 obj-$(CONFIG_CPU_XSC3) += copypage-xsc3.o 56 63 obj-$(CONFIG_CPU_COPY_FA) += copypage-fa.o 57 64 58 - CFLAGS_copypage-feroceon.o := -march=armv5te 59 - 60 65 obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o 61 66 obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o 62 67 obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o ··· 62 71 obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o 63 72 obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o 64 73 obj-$(CONFIG_CPU_TLB_FA) += tlb-fa.o 65 - 66 - AFLAGS_tlb-v6.o :=-Wa,-march=armv6 67 - AFLAGS_tlb-v7.o :=-Wa,-march=armv7-a 68 74 69 75 obj-$(CONFIG_CPU_ARM7TDMI) += proc-arm7tdmi.o 70 76 obj-$(CONFIG_CPU_ARM720T) += proc-arm720.o ··· 88 100 obj-$(CONFIG_CPU_V6K) += proc-v6.o 89 101 obj-$(CONFIG_CPU_V7) += proc-v7.o proc-v7-bugs.o 90 102 obj-$(CONFIG_CPU_V7M) += proc-v7m.o 91 - 92 - AFLAGS_proc-v6.o :=-Wa,-march=armv6 93 - AFLAGS_proc-v7.o :=-Wa,-march=armv7-a 94 103 95 104 obj-$(CONFIG_OUTER_CACHE) += l2c-common.o 96 105 obj-$(CONFIG_CACHE_B15_RAC) += cache-b15-rac.o
+1
arch/arm/mm/abort-ev6.S
··· 16 16 * abort here if the I-TLB and D-TLB aren't seeing the same 17 17 * picture. Unfortunately, this does happen. We live with it. 18 18 */ 19 + .arch armv6k 19 20 .align 5 20 21 ENTRY(v6_early_abort) 21 22 mrc p15, 0, r1, c5, c0, 0 @ get FSR
+1
arch/arm/mm/abort-ev7.S
··· 12 12 * 13 13 * Purpose : obtain information about current aborted instruction. 14 14 */ 15 + .arch armv7-a 15 16 .align 5 16 17 ENTRY(v7_early_abort) 17 18 mrc p15, 0, r1, c5, c0, 0 @ get FSR
+2
arch/arm/mm/cache-v6.S
··· 19 19 #define D_CACHE_LINE_SIZE 32 20 20 #define BTB_FLUSH_SIZE 8 21 21 22 + .arch armv6 23 + 22 24 /* 23 25 * v6_flush_icache_all() 24 26 *
+2
arch/arm/mm/cache-v7.S
··· 16 16 17 17 #include "proc-macros.S" 18 18 19 + .arch armv7-a 20 + 19 21 #ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND 20 22 .globl icache_size 21 23 .data
+2
arch/arm/mm/cache-v7m.S
··· 18 18 19 19 #include "proc-macros.S" 20 20 21 + .arch armv7-m 22 + 21 23 /* Generic V7M read/write macros for memory mapped cache operations */ 22 24 .macro v7m_cache_read, rt, reg 23 25 movw \rt, #:lower16:BASEADDR_V7M_SCB + \reg
+1
arch/arm/mm/copypage-feroceon.c
··· 15 15 int tmp; 16 16 17 17 asm volatile ("\ 18 + .arch armv5te \n\ 18 19 1: ldmia %1!, {r2 - r7, ip, lr} \n\ 19 20 pld [%1, #0] \n\ 20 21 pld [%1, #32] \n\
+2
arch/arm/mm/proc-v6.S
··· 32 32 #define TTB_FLAGS_SMP TTB_RGN_WBWA|TTB_S 33 33 #define PMD_FLAGS_SMP PMD_SECT_WBWA|PMD_SECT_S 34 34 35 + .arch armv6 36 + 35 37 ENTRY(cpu_v6_proc_init) 36 38 ret lr 37 39
+2
arch/arm/mm/proc-v7-2level.S
··· 24 24 #define TTB_FLAGS_SMP TTB_IRGN_WBWA|TTB_S|TTB_NOS|TTB_RGN_OC_WBWA 25 25 #define PMD_FLAGS_SMP PMD_SECT_WBWA|PMD_SECT_S 26 26 27 + .arch armv7-a 28 + 27 29 /* 28 30 * cpu_v7_switch_mm(pgd_phys, tsk) 29 31 *
+2
arch/arm/mm/proc-v7.S
··· 24 24 #include "proc-v7-2level.S" 25 25 #endif 26 26 27 + .arch armv7-a 28 + 27 29 ENTRY(cpu_v7_proc_init) 28 30 ret lr 29 31 ENDPROC(cpu_v7_proc_init)
+2
arch/arm/mm/tlb-v6.S
··· 17 17 18 18 #define HARVARD_TLB 19 19 20 + .arch armv6 21 + 20 22 /* 21 23 * v6wbi_flush_user_tlb_range(start, end, vma) 22 24 *
+2
arch/arm/mm/tlb-v7.S
··· 16 16 #include <asm/tlbflush.h> 17 17 #include "proc-macros.S" 18 18 19 + .arch armv7-a 20 + 19 21 /* 20 22 * v7wbi_flush_user_tlb_range(start, end, vma) 21 23 *
-2
drivers/memory/Makefile
··· 32 32 33 33 ti-emif-sram-objs := ti-emif-pm.o ti-emif-sram-pm.o 34 34 35 - AFLAGS_ti-emif-sram-pm.o :=-Wa,-march=armv7-a 36 - 37 35 $(obj)/ti-emif-sram-pm.o: $(obj)/ti-emif-asm-offsets.h 38 36 39 37 $(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE
+1
drivers/memory/ti-emif-sram-pm.S
··· 28 28 29 29 .arm 30 30 .align 3 31 + .arch armv7-a 31 32 32 33 ENTRY(ti_emif_sram) 33 34
-1
drivers/soc/bcm/brcmstb/pm/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-$(CONFIG_ARM) += s2-arm.o pm-arm.o 3 - AFLAGS_s2-arm.o := -march=armv7-a 4 3 obj-$(CONFIG_BMIPS_GENERIC) += s2-mips.o s3-mips.o pm-mips.o
+1
drivers/soc/bcm/brcmstb/pm/s2-arm.S
··· 8 8 9 9 #include "pm.h" 10 10 11 + .arch armv7-a 11 12 .text 12 13 .align 3 13 14