1 # This file is included by the global makefile !! 1 # SPDX-License-Identifier: GPL-2.0 2 # architecture-specific flags and dependencies << 3 # 2 # 4 # This file is subject to the terms and condit !! 3 # sparc/Makefile 5 # License. See the file "COPYING" in the main << 6 # for more details. << 7 # 4 # >> 5 # Makefile for the architecture dependent flags and dependencies on the >> 6 # Sparc and sparc64. >> 7 # >> 8 # Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu) >> 9 # Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) 8 10 9 LDFLAGS_vmlinux := -z norelro !! 11 # We are not yet configured - so test on arch 10 ifeq ($(CONFIG_RELOCATABLE),y) !! 12 ifeq ($(ARCH),sparc64) 11 LDFLAGS_vmlinux += -shared -Bsymbolic !! 13 KBUILD_DEFCONFIG := sparc64_defconfig 12 KBUILD_CFLAGS += -fPIE << 13 endif << 14 ifeq ($(CONFIG_DYNAMIC_FTRACE),y) << 15 LDFLAGS_vmlinux += --no-relax << 16 KBUILD_CPPFLAGS += -DCC_USING_PATCHABL << 17 ifeq ($(CONFIG_RISCV_ISA_C),y) << 18 CC_FLAGS_FTRACE := -fpatchable-functio << 19 else 14 else 20 CC_FLAGS_FTRACE := -fpatchable-functio !! 15 KBUILD_DEFCONFIG := sparc32_defconfig 21 endif << 22 endif 16 endif 23 17 24 ifeq ($(CONFIG_CMODEL_MEDLOW),y) !! 18 ifeq ($(CONFIG_SPARC32),y) 25 KBUILD_CFLAGS_MODULE += -mcmodel=medany !! 19 ##### 26 endif !! 20 # sparc32 27 !! 21 # 28 export BITS << 29 ifeq ($(CONFIG_ARCH_RV64I),y) << 30 BITS := 64 << 31 UTS_MACHINE := riscv64 << 32 << 33 KBUILD_CFLAGS += -mabi=lp64 << 34 KBUILD_AFLAGS += -mabi=lp64 << 35 << 36 KBUILD_LDFLAGS += -melf64lriscv << 37 << 38 KBUILD_RUSTFLAGS += -Ctarget-cpu=gener << 39 -Cno-redzone << 40 else << 41 BITS := 32 << 42 UTS_MACHINE := riscv32 << 43 << 44 KBUILD_CFLAGS += -mabi=ilp32 << 45 KBUILD_AFLAGS += -mabi=ilp32 << 46 KBUILD_LDFLAGS += -melf32lriscv << 47 endif << 48 << 49 ifndef CONFIG_RISCV_USE_LINKER_RELAXATION << 50 KBUILD_CFLAGS += -mno-relax << 51 KBUILD_AFLAGS += -mno-relax << 52 ifndef CONFIG_AS_IS_LLVM << 53 KBUILD_CFLAGS += -Wa,-mno-relax << 54 KBUILD_AFLAGS += -Wa,-mno-relax << 55 endif << 56 # LLVM has an issue with target-features and L << 57 # Ensure it is aware of linker relaxation with << 58 # be incorrect: https://github.com/llvm/llvm-p << 59 else ifeq ($(CONFIG_LTO_CLANG),y) << 60 KBUILD_LDFLAGS += -mllvm -mattr=+c -ml << 61 endif << 62 << 63 ifeq ($(CONFIG_SHADOW_CALL_STACK),y) << 64 KBUILD_LDFLAGS += --no-relax-gp << 65 endif << 66 22 67 # ISA string setting !! 23 CHECKFLAGS += -D__sparc__ 68 riscv-march-$(CONFIG_ARCH_RV32I) := rv3 !! 24 KBUILD_LDFLAGS := -m elf32_sparc 69 riscv-march-$(CONFIG_ARCH_RV64I) := rv6 !! 25 export BITS := 32 70 riscv-march-$(CONFIG_FPU) := $(r !! 26 UTS_MACHINE := sparc 71 riscv-march-$(CONFIG_RISCV_ISA_C) := $(r !! 27 72 riscv-march-$(CONFIG_RISCV_ISA_V) := $(r !! 28 # We are adding -Wa,-Av8 to KBUILD_CFLAGS to deal with a specs bug in some >> 29 # versions of gcc. Some gcc versions won't pass -Av8 to binutils when you >> 30 # give -mcpu=v8. This silently worked with older bintutils versions but >> 31 # does not any more. >> 32 KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 >> 33 KBUILD_CFLAGS += -Wa,-Av8 73 34 74 ifneq ($(CONFIG_RISCV_ISA_C),y) !! 35 KBUILD_AFLAGS += -m32 -Wa,-Av8 75 KBUILD_RUSTFLAGS += -Ctarget-feature=- << 76 endif << 77 36 78 ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC << 79 KBUILD_CFLAGS += -Wa,-misa-spec=2.2 << 80 KBUILD_AFLAGS += -Wa,-misa-spec=2.2 << 81 else 37 else 82 riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ !! 38 ##### 83 endif !! 39 # sparc64 84 !! 40 # 85 # Remove F,D,V from isa string for all. Keep e << 86 # matching non-v and non-multi-letter extensio << 87 KBUILD_CFLAGS += -march=$(shell echo $(riscv-m << 88 << 89 KBUILD_AFLAGS += -march=$(riscv-march-y) << 90 << 91 # For C code built with floating-point support << 92 CC_FLAGS_FPU := -march=$(shell echo $(riscv-m << 93 << 94 KBUILD_CFLAGS += -mno-save-restore << 95 KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG << 96 << 97 ifeq ($(CONFIG_CMODEL_MEDLOW),y) << 98 KBUILD_CFLAGS += -mcmodel=medlow << 99 endif << 100 ifeq ($(CONFIG_CMODEL_MEDANY),y) << 101 KBUILD_CFLAGS += -mcmodel=medany << 102 endif << 103 << 104 # Avoid generating .eh_frame sections. << 105 KBUILD_CFLAGS += -fno-asynchronous-unwind-tabl << 106 << 107 # The RISC-V attributes frequently cause compa << 108 # information, so just turn them off. << 109 KBUILD_CFLAGS += $(call cc-option,-mno-riscv-a << 110 KBUILD_AFLAGS += $(call cc-option,-mno-riscv-a << 111 KBUILD_CFLAGS += $(call as-option,-Wa$(comma)- << 112 KBUILD_AFLAGS += $(call as-option,-Wa$(comma)- << 113 << 114 KBUILD_CFLAGS_MODULE += $(call cc-option,-mno- << 115 KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$( << 116 << 117 # GCC versions that support the "-mstrict-alig << 118 # unaligned accesses. While unaligned accesse << 119 # RISC-V ISA, they're emulated by machine mode << 120 # architectures. It's faster to have GCC emit << 121 ifneq ($(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCES << 122 KBUILD_CFLAGS += $(call cc-option,-mstrict-ali << 123 endif << 124 << 125 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y) << 126 prepare: stack_protector_prepare << 127 stack_protector_prepare: prepare0 << 128 $(eval KBUILD_CFLAGS += -mstack-protec << 129 -mstack-protec << 130 -mstack-protec << 131 awk '{if ($$2 == "TSK_ << 132 includ << 133 endif << 134 41 135 # arch specific predefines for sparse !! 42 CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ 136 CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS) !! 43 KBUILD_LDFLAGS := -m elf64_sparc >> 44 export BITS := 64 >> 45 UTS_MACHINE := sparc64 137 46 138 # Default target when executing plain make !! 47 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow 139 boot := arch/riscv/boot !! 48 KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare 140 ifeq ($(CONFIG_XIP_KERNEL),y) !! 49 KBUILD_CFLAGS += -Wa,--undeclared-regs 141 KBUILD_IMAGE := $(boot)/xipImage !! 50 KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) 142 else !! 51 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs 143 ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAA << 144 KBUILD_IMAGE := $(boot)/loader.bin << 145 else << 146 ifeq ($(CONFIG_EFI_ZBOOT),) << 147 KBUILD_IMAGE := $(boot)/Image.gz << 148 else << 149 KBUILD_IMAGE := $(boot)/vmlinuz.efi << 150 endif << 151 endif << 152 endif << 153 52 154 boot := arc !! 53 ifeq ($(CONFIG_MCOUNT),y) 155 boot-image-y := Ima !! 54 KBUILD_CFLAGS += -pg 156 boot-image-$(CONFIG_KERNEL_BZIP2) := Ima << 157 boot-image-$(CONFIG_KERNEL_GZIP) := Ima << 158 boot-image-$(CONFIG_KERNEL_LZ4) := Ima << 159 boot-image-$(CONFIG_KERNEL_LZMA) := Ima << 160 boot-image-$(CONFIG_KERNEL_LZO) := Ima << 161 boot-image-$(CONFIG_KERNEL_ZSTD) := Ima << 162 boot-image-$(CONFIG_KERNEL_XZ) := Ima << 163 ifdef CONFIG_RISCV_M_MODE << 164 boot-image-$(CONFIG_ARCH_CANAAN) := loa << 165 endif 55 endif 166 boot-image-$(CONFIG_EFI_ZBOOT) := vml << 167 boot-image-$(CONFIG_XIP_KERNEL) := xip << 168 KBUILD_IMAGE := $(b << 169 << 170 libs-y += arch/riscv/lib/ << 171 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/ << 172 << 173 ifeq ($(KBUILD_EXTMOD),) << 174 ifeq ($(CONFIG_MMU),y) << 175 prepare: vdso_prepare << 176 vdso_prepare: prepare0 << 177 $(Q)$(MAKE) $(build)=arch/riscv/kernel << 178 $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ << 179 $(build)=arch/riscv/kernel/com << 180 56 181 endif 57 endif 182 endif << 183 58 184 vdso-install-y += arch/riscv/ !! 59 libs-y += arch/sparc/prom/ 185 vdso-install-$(CONFIG_COMPAT) += arch/riscv/ !! 60 libs-y += arch/sparc/lib/ 186 61 187 BOOT_TARGETS := Image Image.gz Image.bz2 Image !! 62 drivers-$(CONFIG_PM) += arch/sparc/power/ >> 63 drivers-$(CONFIG_VIDEO) += arch/sparc/video/ 188 64 189 all: $(notdir $(KBUILD_IMAGE)) !! 65 boot := arch/sparc/boot 190 66 191 loader.bin: loader !! 67 # Default target 192 Image.gz Image.bz2 Image.lz4 Image.lzma Image. !! 68 all: zImage 193 69 194 $(BOOT_TARGETS): vmlinux !! 70 image zImage uImage tftpboot.img vmlinux.aout: vmlinux 195 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$ 71 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 196 @$(kecho) ' Kernel: $(boot)/$@ is rea << 197 72 198 # the install target always installs KBUILD_IM !! 73 install: 199 # but keep the zinstall target for compatibili << 200 install zinstall: << 201 $(call cmd,install) 74 $(call cmd,install) 202 75 203 PHONY += rv32_randconfig !! 76 archheaders: 204 rv32_randconfig: !! 77 $(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all 205 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctre !! 78 206 -f $(srctree)/Makefile randcon !! 79 vdso-install-$(CONFIG_SPARC64) += arch/sparc/vdso/vdso64.so.dbg 207 !! 80 vdso-install-$(CONFIG_COMPAT) += arch/sparc/vdso/vdso32.so.dbg 208 PHONY += rv64_randconfig !! 81 209 rv64_randconfig: !! 82 # This is the image used for packaging 210 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctre !! 83 KBUILD_IMAGE := $(boot)/zImage 211 -f $(srctree)/Makefile randcon << 212 << 213 PHONY += rv32_defconfig << 214 rv32_defconfig: << 215 $(Q)$(MAKE) -f $(srctree)/Makefile def << 216 << 217 PHONY += rv32_nommu_virt_defconfig << 218 rv32_nommu_virt_defconfig: << 219 $(Q)$(MAKE) -f $(srctree)/Makefile nom << 220 84 >> 85 # Don't use tabs in echo arguments. 221 define archhelp 86 define archhelp 222 echo ' Image - Uncompressed !! 87 echo '* vmlinux - standard SPARC kernel' 223 echo ' Image.gz - Compressed kernel im !! 88 echo ' image - kernel image ($(boot)/image)' 224 echo ' Image.bz2 - Compressed kernel im !! 89 echo '* zImage - stripped/compressed kernel image ($(boot)/zImage)' 225 echo ' Image.lz4 - Compressed kernel im !! 90 echo ' uImage - U-Boot SPARC32 Image (only for LEON)' 226 echo ' Image.lzma - Compressed kernel im !! 91 echo ' vmlinux.aout - a.out kernel for SPARC64' 227 echo ' Image.lzo - Compressed kernel im !! 92 echo ' tftpboot.img - image prepared for tftp' 228 echo ' Image.zst - Compressed kernel im << 229 echo ' Image.xz - Compressed kernel im << 230 echo ' vmlinuz.efi - Compressed EFI kerne << 231 echo ' Default when CONFIG_ << 232 echo ' xipImage - Execute-in-place ker << 233 echo ' Default when CONFIG_ << 234 echo ' install - Install kernel using << 235 echo ' (distribution) /sbin << 236 echo ' $$(INSTALL_PATH)' << 237 endef 93 endef
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.