2005-09-26 10:04:21 +04:00
# This file is included by the global makefile so that you can add your own
2021-10-13 09:36:22 +03:00
# architecture-specific flags and dependencies.
2005-09-26 10:04:21 +04:00
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
# Changes for PPC by Gary Thomas
# Rewritten by Cort Dougan and Paul Mackerras
#
2023-12-06 14:55:48 +03:00
i f d e f c r o s s _ c o m p i l i n g
ifeq ( $( CROSS_COMPILE) ,)
# Auto detect cross compiler prefix.
# Look for: (powerpc(64(le)?)?)(-unknown)?-linux(-gnu)?-
CC_ARCHES := powerpc powerpc64 powerpc64le
CC_SUFFIXES := linux linux-gnu unknown-linux-gnu
CROSS_COMPILE := $( call cc-cross-prefix, $( foreach a,$( CC_ARCHES) , \
$( foreach s,$( CC_SUFFIXES) ,$( a) -$( s) -) ) )
endif
e n d i f
2005-09-26 10:04:21 +04:00
HAS_BIARCH := $( call cc-option-yn, -m32)
# Set default 32 bits cross compilers for vdso and boot wrapper
CROSS32_COMPILE ?=
2019-02-07 08:16:52 +03:00
# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
2023-12-06 14:55:47 +03:00
# ppc64le_defconfig because we have nothing better to go on.
2019-02-07 08:16:52 +03:00
uname := $( shell uname -m)
2023-12-06 14:55:47 +03:00
KBUILD_DEFCONFIG := $( if $( filter ppc%,$( uname) ) ,$( uname) ,ppc64le) _defconfig
2005-11-18 08:39:08 +03:00
2005-09-26 10:04:21 +04:00
new_nm := $( shell if $( NM) --help 2>& 1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi )
i f e q ( $( new_nm ) , y )
NM := $( NM) --synthetic
e n d i f
2016-08-11 09:03:14 +03:00
# BITS is used as extension for files which are available in a 32 bit
# and a 64 bit version to simplify shared Makefiles.
# e.g.: obj-y += foo_$(BITS).o
export BITS
i f d e f C O N F I G _ P P C 6 4
BITS := 64
e l s e
BITS := 32
2005-09-26 10:04:21 +04:00
e n d i f
2016-08-11 09:03:15 +03:00
machine-y = ppc
machine-$(CONFIG_PPC64) += 64
machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
UTS_MACHINE := $( subst $( space) ,,$( machine-y) )
2005-10-13 10:14:15 +04:00
2023-01-19 11:22:50 +03:00
i f e q ( $( CONFIG_PPC 64) $( CONFIG_LD_IS_BFD ) , y y )
2017-07-26 08:00:42 +03:00
# Have the linker provide sfpr if possible.
# There is a corresponding test in arch/powerpc/lib/Makefile
KBUILD_LDFLAGS_MODULE += --save-restore-funcs
e l s e
KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
e n d i f
2018-08-06 19:42:03 +03:00
i f d e f C O N F I G _ C P U _ L I T T L E _ E N D I A N
2018-05-30 15:19:21 +03:00
KBUILD_CFLAGS += -mlittle-endian
2018-08-24 02:20:39 +03:00
KBUILD_LDFLAGS += -EL
2013-09-23 06:05:11 +04:00
LDEMULATION := lppc
GNUTARGET := powerpcle
MULTIPLEWORD := -mno-multiple
2014-03-12 08:12:01 +04:00
KBUILD_CFLAGS_MODULE += $( call cc-option,-mno-save-toc-indirect)
2013-09-23 06:05:11 +04:00
e l s e
2018-05-30 15:19:21 +03:00
KBUILD_CFLAGS += $( call cc-option,-mbig-endian)
2018-08-24 02:20:39 +03:00
KBUILD_LDFLAGS += -EB
2013-09-23 06:05:11 +04:00
LDEMULATION := ppc
GNUTARGET := powerpc
MULTIPLEWORD := -mmultiple
e n d i f
2016-11-27 05:46:20 +03:00
i f d e f C O N F I G _ P P C 6 4
2019-11-19 07:57:10 +03:00
i f n d e f C O N F I G _ C C _ I S _ C L A N G
2022-05-09 08:36:06 +03:00
cflags-$(CONFIG_PPC64_ELF_ABI_V1) += $( call cc-option,-mabi= elfv1)
cflags-$(CONFIG_PPC64_ELF_ABI_V1) += $( call cc-option,-mcall-aixdesc)
aflags-$(CONFIG_PPC64_ELF_ABI_V1) += $( call cc-option,-mabi= elfv1)
aflags-$(CONFIG_PPC64_ELF_ABI_V2) += -mabi= elfv2
2016-11-27 05:46:20 +03:00
e n d i f
2019-11-19 07:57:10 +03:00
e n d i f
2016-11-27 05:46:20 +03:00
2018-10-30 16:26:33 +03:00
i f n d e f C O N F I G _ C C _ I S _ C L A N G
2016-08-09 15:43:46 +03:00
cflags-$( CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
e n d i f
2018-05-30 15:19:21 +03:00
cflags-$(CONFIG_CPU_BIG_ENDIAN) += $( call cc-option,-mbig-endian)
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
2016-08-09 15:43:46 +03:00
aflags-$(CONFIG_CPU_BIG_ENDIAN) += $( call cc-option,-mbig-endian)
aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
2005-09-26 10:04:21 +04:00
i f e q ( $( HAS_BIARCH ) , y )
2018-05-30 15:19:21 +03:00
KBUILD_CFLAGS += -m$( BITS)
2023-01-12 06:05:02 +03:00
KBUILD_AFLAGS += -m$( BITS)
2018-08-24 02:20:39 +03:00
KBUILD_LDFLAGS += -m elf$( BITS) $( LDEMULATION)
2005-09-26 10:04:21 +04:00
e n d i f
2018-09-27 10:05:53 +03:00
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard= tls
2018-09-27 10:05:55 +03:00
i f d e f C O N F I G _ P P C 6 4
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg= r13
e l s e
2018-09-27 10:05:53 +03:00
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg= r2
2018-09-27 10:05:55 +03:00
e n d i f
2018-09-27 10:05:53 +03:00
2011-12-15 02:58:12 +04:00
LDFLAGS_vmlinux-y := -Bstatic
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
2021-08-13 23:05:11 +03:00
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext
2011-12-15 02:58:12 +04:00
LDFLAGS_vmlinux := $( LDFLAGS_vmlinux-y)
2005-09-26 10:04:21 +04:00
2018-08-06 19:42:03 +03:00
i f d e f C O N F I G _ P P C 6 4
2023-04-08 05:17:52 +03:00
i f n d e f C O N F I G _ P P C _ K E R N E L _ P C R E L
2012-11-26 21:41:08 +04:00
# -mcmodel=medium breaks modules because it uses 32bit offsets from
# the TOC pointer to create pointers where possible. Pointers into the
# percpu data area are created by this method.
#
# The kernel module loader relocates the percpu data section from the
# original location (starting with 0xd...) to somewhere in the base
# kernel percpu data space (starting with 0xc...). We need a full
# 64bit relocation for this to work, hence -mcmodel=large.
KBUILD_CFLAGS_MODULE += -mcmodel= large
e n d i f
2023-04-08 05:17:52 +03:00
e n d i f
2012-11-26 21:41:08 +04:00
2015-05-26 01:53:27 +03:00
CFLAGS-$(CONFIG_PPC64) := $( call cc-option,-mtraceback= no)
2022-05-09 08:36:06 +03:00
i f d e f C O N F I G _ P P C 6 4 _ E L F _ A B I _ V 2
2015-05-26 01:53:29 +03:00
CFLAGS-$(CONFIG_PPC64) += $( call cc-option,-mabi= elfv2,$( call cc-option,-mcall-aixdesc) )
2014-03-10 14:06:12 +04:00
e l s e
2023-02-15 21:41:16 +03:00
i f n d e f C O N F I G _ C C _ I S _ C L A N G
2016-11-27 05:46:20 +03:00
CFLAGS-$(CONFIG_PPC64) += $( call cc-option,-mabi= elfv1)
2015-05-26 01:53:29 +03:00
CFLAGS-$(CONFIG_PPC64) += $( call cc-option,-mcall-aixdesc)
2014-03-10 14:06:12 +04:00
e n d i f
2019-11-19 07:57:10 +03:00
e n d i f
2024-01-10 17:12:37 +03:00
CFLAGS-$(CONFIG_PPC64) += -mcmodel= medium
2012-12-12 18:43:12 +04:00
CFLAGS-$(CONFIG_PPC64) += $( call cc-option,-mno-pointers-to-nested-functions)
powerpc/64: Always build with 128-bit long double
The amdgpu driver builds some of its code with hard-float enabled,
whereas the rest of the kernel is built with soft-float.
When building with 64-bit long double, if soft-float and hard-float
objects are linked together, the build fails due to incompatible ABI
tags.
In the past there have been build errors in the amdgpu driver caused by
this, some of those were due to bad intermingling of soft & hard-float
code, but those issues have now all been fixed since commit 58ddbecb14c7
("drm/amd/display: move remaining FPU code to dml folder").
However it's still possible for soft & hard-float objects to end up
linked together, if the amdgpu driver is built-in to the kernel along
with the test_emulate_step.c code, which uses soft-float. That happens
in an allyesconfig build.
Currently those build errors are avoided because the amdgpu driver is
gated on 128-bit long double being enabled. But that's not a detail the
amdgpu driver should need to be aware of, and if another driver starts
using hard-float the same problem would occur.
All versions of the 64-bit ABI specify that long-double is 128-bits.
However some compilers, notably the kernel.org ones, are built to use
64-bit long double by default.
Apart from this issue of soft vs hard-float, the kernel doesn't care
what size long double is. In particular the kernel using 128-bit long
double doesn't impact userspace's ability to use 64-bit long double, as
musl does.
So always build the 64-bit kernel with 128-bit long double. That should
avoid any build errors due to the incompatible ABI tags. Excluding the
code that uses soft/hard-float, the vmlinux is identical with/without
the flag.
It does mean any code which is incorrectly intermingling soft &
hard-float code will build without error, so those bugs will need to be
caught by testing rather than at build time.
For more background see:
- commit d11219ad53dc ("amdgpu: disable powerpc support for the newer display engine")
- commit c653c591789b ("drm/amdgpu: Re-enable DCN for 64-bit powerpc")
- https://lore.kernel.org/r/dab9cbd8-2626-4b99-8098-31fe76397d2d@app.fastmail.com
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Link: https://msgid.link/20230404102847.3303623-1-mpe@ellerman.id.au
2023-04-04 13:28:47 +03:00
CFLAGS-$(CONFIG_PPC64) += $( call cc-option,-mlong-double-128)
2018-03-01 04:02:49 +03:00
2018-11-12 08:28:06 +03:00
# Clang unconditionally reserves r2 on ppc32 and does not support the flag
2024-01-10 01:16:31 +03:00
# https://llvm.org/pr39555
2018-11-12 08:28:06 +03:00
CFLAGS-$(CONFIG_PPC32) := $( call cc-option, -ffixed-r2)
# Clang doesn't support -mmultiple / -mno-multiple
2024-01-10 01:16:31 +03:00
# https://llvm.org/pr39556
2018-11-12 08:28:06 +03:00
CFLAGS-$(CONFIG_PPC32) += $( call cc-option, $( MULTIPLEWORD) )
2018-03-01 04:02:49 +03:00
CFLAGS-$(CONFIG_PPC32) += $( call cc-option,-mno-readonly-in-sdata)
2012-04-17 22:45:28 +04:00
2024-03-29 10:18:23 +03:00
CC_FLAGS_FPU := $( call cc-option,-mhard-float)
CC_FLAGS_NO_FPU := $( call cc-option,-msoft-float)
2018-09-14 08:08:53 +03:00
i f d e f C O N F I G _ F U N C T I O N _ T R A C E R
2023-06-19 12:47:34 +03:00
i f d e f C O N F I G _ A R C H _ U S I N G _ P A T C H A B L E _ F U N C T I O N _ E N T R Y
KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
CC_FLAGS_FTRACE := -fpatchable-function-entry= 2
e l s e
2018-09-14 08:08:53 +03:00
CC_FLAGS_FTRACE := -pg
2016-03-03 07:27:00 +03:00
i f d e f C O N F I G _ M P R O F I L E _ K E R N E L
2018-09-14 08:08:53 +03:00
CC_FLAGS_FTRACE += -mprofile-kernel
e n d i f
2016-03-03 07:27:00 +03:00
e n d i f
2023-06-19 12:47:34 +03:00
e n d i f
2016-03-03 07:27:00 +03:00
powerpc/64: Set default CPU in Kconfig
Since commit 0069f3d14e7a ("powerpc/64e: Tie PPC_BOOK3E_64 to
PPC_E500MC"), the only possible BOOK3E/64 are E500, so no need of a
default CPU over the E5500.
When the user selects book3e, they must have an e500 compatible
compiler, and it won't work anymore with the default -mcpu=power64, see
commit d6b551b8f90c ("powerpc/64e: Fix build failure with GCC
12 (unrecognized opcode: `wrteei')").
For book3s/64, replace GENERIC_CPU by POWERPC64_CPU to match the PPC32
POWERPC_CPU, and set a default mpcu value in Kconfig directly.
When a user selects a particular CPU, they must ensure the compiler has
the requested capability. Therefore, remove hidden fallback, instead
offer user the possibility to say they want to use the toolchain
default.
Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')")
Reported-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/76c11197b058193dcb8e8b26adffba09cfbdab11.1674632329.git.christophe.leroy@csgroup.eu
2023-01-25 10:38:59 +03:00
CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu= $( CONFIG_TARGET_CPU)
AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu= $( CONFIG_TARGET_CPU)
2012-04-17 22:45:28 +04:00
2023-03-30 02:43:08 +03:00
CFLAGS-y += $( CONFIG_TUNE_CPU)
2013-08-21 04:55:36 +04:00
2014-05-15 20:33:42 +04:00
asinstr := $( call as-instr,lis 9$( comma) foo@high,-DHAVE_AS_ATHIGH= 1)
2023-12-06 14:55:45 +03:00
KBUILD_CPPFLAGS += -I $( srctree) /arch/powerpc $( asinstr)
2019-01-11 06:22:32 +03:00
KBUILD_AFLAGS += $( AFLAGS-y)
2024-03-29 10:18:23 +03:00
KBUILD_CFLAGS += $( CC_FLAGS_NO_FPU)
2023-06-06 09:48:30 +03:00
KBUILD_CFLAGS += $( CFLAGS-y)
2007-10-15 00:21:35 +04:00
CPP = $( CC) -E $( KBUILD_CFLAGS)
2005-09-26 10:04:21 +04:00
2016-08-11 09:03:14 +03:00
CHECKFLAGS += -m$( BITS) -D__powerpc__ -D__powerpc$( BITS) __
2016-07-12 03:54:51 +03:00
i f d e f C O N F I G _ C P U _ B I G _ E N D I A N
CHECKFLAGS += -D__BIG_ENDIAN__
e l s e
2022-05-09 08:36:08 +03:00
CHECKFLAGS += -D__LITTLE_ENDIAN__
2016-07-12 03:54:51 +03:00
e n d i f
2005-09-26 10:04:21 +04:00
2018-08-06 19:42:03 +03:00
i f d e f C O N F I G _ 4 7 6 F P E _ E R R 4 6
2014-02-24 11:00:56 +04:00
KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
-T $( srctree) /arch/powerpc/platforms/44x/ppc476_modules.lds
e n d i f
2022-09-23 06:30:04 +03:00
# No prefix or pcrel
2023-04-08 05:17:49 +03:00
i f d e f C O N F I G _ P P C _ K E R N E L _ P R E F I X E D
KBUILD_CFLAGS += $( call cc-option,-mprefixed)
e l s e
2022-09-23 06:30:04 +03:00
KBUILD_CFLAGS += $( call cc-option,-mno-prefixed)
2023-04-08 05:17:49 +03:00
e n d i f
2023-04-08 05:17:51 +03:00
i f d e f C O N F I G _ P P C _ K E R N E L _ P C R E L
KBUILD_CFLAGS += $( call cc-option,-mpcrel)
e l s e
2022-09-23 06:30:04 +03:00
KBUILD_CFLAGS += $( call cc-option,-mno-pcrel)
2023-04-08 05:17:51 +03:00
e n d i f
2022-09-23 06:30:04 +03:00
# No AltiVec or VSX or MMA instructions when building kernel
2007-10-15 00:21:35 +04:00
KBUILD_CFLAGS += $( call cc-option,-mno-altivec)
2012-04-17 22:45:28 +04:00
KBUILD_CFLAGS += $( call cc-option,-mno-vsx)
2022-09-23 06:30:04 +03:00
KBUILD_CFLAGS += $( call cc-option,-mno-mma)
2005-10-29 09:31:17 +04:00
2007-10-19 01:53:19 +04:00
# No SPE instruction when building kernel
2008-09-01 18:23:02 +04:00
# (We use all available options to help semi-broken compilers)
2007-10-19 01:53:19 +04:00
KBUILD_CFLAGS += $( call cc-option,-mno-spe)
2008-09-01 18:23:02 +04:00
KBUILD_CFLAGS += $( call cc-option,-mspe= no)
2007-10-19 01:53:19 +04:00
2020-03-05 17:35:30 +03:00
# Don't emit .eh_frame since we have no use for it
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
2007-03-22 09:23:44 +03:00
# Never use string load/store instructions as they are
# often slow when they are implemented at all
2015-05-26 01:53:27 +03:00
KBUILD_CFLAGS += $( call cc-option,-mno-string)
2005-09-26 10:04:21 +04:00
2016-08-09 15:43:46 +03:00
KBUILD_AFLAGS += $( aflags-y)
KBUILD_CFLAGS += $( cflags-y)
2006-01-13 02:55:58 +03:00
# Default to zImage, override when needed
2008-02-06 21:18:34 +03:00
all : zImage
2005-09-26 10:04:21 +04:00
2010-08-03 00:47:48 +04:00
# With make 3.82 we cannot mix normal and wildcard targets
2010-08-16 02:26:56 +04:00
BOOT_TARGETS1 := zImage zImage.initrd uImage
2011-12-01 23:35:08 +04:00
BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
2005-09-30 10:16:52 +04:00
2010-08-03 00:47:48 +04:00
PHONY += $( BOOT_TARGETS1) $( BOOT_TARGETS2)
2005-09-30 10:16:52 +04:00
2023-12-06 14:55:45 +03:00
boot := arch/powerpc/boot
2005-09-26 10:04:21 +04:00
2010-08-03 00:47:48 +04:00
$(BOOT_TARGETS1) : vmlinux
powerpc: Stop passing ARCH=ppc64 to boot Makefile
Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.
Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.
In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.
Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.
Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.
Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.
Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-21 13:14:33 +03:00
$( Q) $( MAKE) $( build) = $( boot) $( patsubst %,$( boot) /%,$@ )
2010-08-03 00:47:48 +04:00
$(BOOT_TARGETS2) : vmlinux
powerpc: Stop passing ARCH=ppc64 to boot Makefile
Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.
Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.
In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.
Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.
Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.
Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.
Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-21 13:14:33 +03:00
$( Q) $( MAKE) $( build) = $( boot) $( patsubst %,$( boot) /%,$@ )
2010-08-03 00:47:48 +04:00
2020-02-19 03:04:34 +03:00
PHONY += bootwrapper_install
2010-08-03 00:47:48 +04:00
bootwrapper_install :
powerpc: Stop passing ARCH=ppc64 to boot Makefile
Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.
Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.
In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.
Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.
Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.
Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.
Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-21 13:14:33 +03:00
$( Q) $( MAKE) $( build) = $( boot) $( patsubst %,$( boot) /%,$@ )
2007-12-03 05:56:58 +03:00
2023-01-24 14:02:12 +03:00
i n c l u d e $( srctree ) / s c r i p t s / M a k e f i l e . d e f c o n f
2023-03-29 10:23:34 +03:00
generated_configs += ppc64le_defconfig
2015-09-23 08:40:35 +03:00
ppc64le_defconfig :
$( call merge_into_defconfig,ppc64_defconfig,le)
2023-03-29 10:23:34 +03:00
generated_configs += ppc64le_guest_defconfig
2018-11-15 09:49:50 +03:00
ppc64le_guest_defconfig :
2023-04-14 16:24:13 +03:00
$( call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest)
2018-11-15 09:49:50 +03:00
2023-03-29 10:23:34 +03:00
generated_configs += ppc64_guest_defconfig
2018-11-15 09:49:50 +03:00
ppc64_guest_defconfig :
2023-04-14 16:24:13 +03:00
$( call merge_into_defconfig,ppc64_defconfig,be guest kvm_guest)
2018-11-15 09:49:50 +03:00
2023-04-14 16:24:14 +03:00
generated_configs += pseries_le_defconfig
pseries_le_defconfig : ppc 64le_guest_defconfig
2023-04-14 16:24:15 +03:00
generated_configs += pseries_defconfig
pseries_defconfig : ppc 64le_guest_defconfig
2023-03-29 10:23:34 +03:00
generated_configs += powernv_be_defconfig
2017-07-24 15:50:45 +03:00
powernv_be_defconfig :
$( call merge_into_defconfig,powernv_defconfig,be)
2023-03-29 10:23:34 +03:00
generated_configs += mpc85xx_defconfig
2015-07-30 02:14:04 +03:00
mpc85xx_defconfig :
2019-05-28 11:16:14 +03:00
$( call merge_into_defconfig,mpc85xx_base.config,\
2015-07-30 02:14:04 +03:00
85xx-32bit 85xx-hw fsl-emb-nonhw)
2023-03-29 10:23:34 +03:00
generated_configs += mpc85xx_smp_defconfig
2015-07-30 02:14:04 +03:00
mpc85xx_smp_defconfig :
2019-05-28 11:16:14 +03:00
$( call merge_into_defconfig,mpc85xx_base.config,\
2015-07-30 02:14:04 +03:00
85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
2023-03-29 10:23:34 +03:00
generated_configs += corenet32_smp_defconfig
2015-07-30 02:14:04 +03:00
corenet32_smp_defconfig :
2019-05-28 11:16:14 +03:00
$( call merge_into_defconfig,corenet_base.config,\
2016-09-22 18:04:12 +03:00
85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
2015-07-30 02:14:04 +03:00
2023-03-29 10:23:34 +03:00
generated_configs += corenet64_smp_defconfig
2015-07-30 02:14:04 +03:00
corenet64_smp_defconfig :
2019-05-28 11:16:14 +03:00
$( call merge_into_defconfig,corenet_base.config,\
2016-09-22 18:04:12 +03:00
85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
2015-07-30 02:14:04 +03:00
2023-03-29 10:23:34 +03:00
generated_configs += mpc86xx_defconfig
2016-02-22 12:26:14 +03:00
mpc86xx_defconfig :
2019-05-28 11:16:14 +03:00
$( call merge_into_defconfig,mpc86xx_base.config,\
2016-02-22 12:26:14 +03:00
86xx-hw fsl-emb-nonhw)
2023-03-29 10:23:34 +03:00
generated_configs += mpc86xx_smp_defconfig
2016-02-22 12:26:14 +03:00
mpc86xx_smp_defconfig :
2019-05-28 11:16:14 +03:00
$( call merge_into_defconfig,mpc86xx_base.config,\
2016-02-22 12:26:14 +03:00
86xx-smp 86xx-hw fsl-emb-nonhw)
2023-03-29 10:23:34 +03:00
generated_configs += ppc32_allmodconfig
2018-07-09 17:24:25 +03:00
ppc32_allmodconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/book3s_32.config \
-f $( srctree) /Makefile allmodconfig
2024-02-29 14:41:08 +03:00
generated_configs += ppc44x_allmodconfig
ppc44x_allmodconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/44x.config \
-f $( srctree) /Makefile allmodconfig
generated_configs += ppc8xx_allmodconfig
ppc8xx_allmodconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/8xx.config \
-f $( srctree) /Makefile allmodconfig
generated_configs += ppc85xx_allmodconfig
ppc85xx_allmodconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/85xx-32bit.config \
-f $( srctree) /Makefile allmodconfig
2018-07-09 17:24:25 +03:00
2023-03-29 10:23:34 +03:00
generated_configs += ppc_defconfig
2019-02-07 08:16:51 +03:00
ppc_defconfig :
$( call merge_into_defconfig,book3s_32.config,)
2023-03-29 10:23:34 +03:00
generated_configs += ppc64le_allmodconfig
2018-07-09 17:24:26 +03:00
ppc64le_allmodconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/le.config \
-f $( srctree) /Makefile allmodconfig
2023-03-29 10:23:34 +03:00
generated_configs += ppc64le_allnoconfig
2020-11-25 06:15:51 +03:00
ppc64le_allnoconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/ppc64le.config \
-f $( srctree) /Makefile allnoconfig
2023-03-29 10:23:34 +03:00
generated_configs += ppc64_book3e_allmodconfig
2018-07-09 17:24:26 +03:00
ppc64_book3e_allmodconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/85xx-64bit.config \
-f $( srctree) /Makefile allmodconfig
2023-03-29 10:23:34 +03:00
generated_configs += ppc32_randconfig
2021-04-28 16:27:00 +03:00
ppc32_randconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/32-bit.config \
-f $( srctree) /Makefile randconfig
2023-03-29 10:23:34 +03:00
generated_configs += ppc64_randconfig
2021-04-28 16:27:00 +03:00
ppc64_randconfig :
$( Q) $( MAKE) KCONFIG_ALLCONFIG = $( srctree) /arch/powerpc/configs/64-bit.config \
-f $( srctree) /Makefile randconfig
2023-03-29 10:23:34 +03:00
PHONY += $( generated_configs)
2005-09-26 10:04:21 +04:00
d e f i n e a r c h h e l p
2023-03-29 10:23:33 +03:00
echo '* zImage - Build default images selected by kernel config'
2023-12-06 14:55:45 +03:00
echo ' zImage.* - Compressed kernel image (arch/powerpc/boot/zImage.*)'
2023-03-29 10:23:33 +03:00
echo ' uImage - U-Boot native image format'
echo ' cuImage.<dt> - Backwards compatible U-Boot image for older'
echo ' versions which do not support device trees'
echo ' dtbImage.<dt> - zImage with an embedded device tree blob'
echo ' simpleImage.<dt> - Firmware independent image.'
echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)'
echo ' install - Install kernel using'
echo ' (your) ~/bin/$(INSTALLKERNEL) or'
echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
echo ' install to $$(INSTALL_PATH) and run lilo'
2023-12-06 14:55:45 +03:00
echo ' *_defconfig - Select default config from arch/powerpc/configs'
2023-03-29 10:23:33 +03:00
echo ''
echo ' Targets with <dt> embed a device tree blob inside the image'
echo ' These targets support board with firmware that does not'
echo ' support passing a device tree directly. Replace <dt> with the'
2023-12-06 14:55:45 +03:00
echo ' name of a dts file from the arch/powerpc/boot/dts/ directory'
2023-03-29 10:23:33 +03:00
echo ' (minus the .dts extension).'
2023-03-29 10:23:34 +03:00
echo
$( foreach cfg,$( generated_configs) ,
printf " %-27s - Build for %s\\n" $( cfg) $( subst _defconfig,,$( cfg) ) ; )
2005-09-26 10:04:21 +04:00
e n d e f
2020-02-19 03:04:34 +03:00
PHONY += install
2008-02-16 14:36:10 +03:00
install :
2022-05-03 05:47:16 +03:00
$( call cmd,install)
2007-04-10 15:05:31 +04:00
2020-09-27 12:16:33 +03:00
i f e q ( $( KBUILD_EXTMOD ) , )
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
# In order to do that, we should use the archprepare target, but we can't since
# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
# Therefore we need to generate the header after prepare0 has been made, hence
# this hack.
prepare : vdso_prepare
vdso_prepare : prepare 0
$( if $( CONFIG_VDSO32) ,$( Q) $( MAKE) \
2022-01-21 19:30:27 +03:00
$( build) = arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h)
2020-09-27 12:16:33 +03:00
$( if $( CONFIG_PPC64) ,$( Q) $( MAKE) \
2022-01-21 19:30:27 +03:00
$( build) = arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h)
2020-09-27 12:16:33 +03:00
e n d i f
2005-09-26 10:04:21 +04:00
archprepare : checkbin
2018-12-17 13:40:36 +03:00
archheaders :
$( Q) $( MAKE) $( build) = arch/powerpc/kernel/syscalls all
2018-09-27 10:05:53 +03:00
i f d e f C O N F I G _ S T A C K P R O T E C T O R
prepare : stack_protector_prepare
2005-09-26 10:04:21 +04:00
2020-02-19 03:04:34 +03:00
PHONY += stack_protector_prepare
2018-09-27 10:05:53 +03:00
stack_protector_prepare : prepare 0
2018-09-27 10:05:55 +03:00
i f d e f C O N F I G _ P P C 6 4
$( eval KBUILD_CFLAGS += -mstack-protector-guard-offset= $( shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h) )
e l s e
2018-09-27 10:05:53 +03:00
$( eval KBUILD_CFLAGS += -mstack-protector-guard-offset= $( shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h) )
e n d i f
2018-09-27 10:05:55 +03:00
e n d i f
2018-09-27 10:05:53 +03:00
2020-02-19 03:04:34 +03:00
PHONY += checkbin
2005-09-26 10:04:21 +04:00
checkbin :
2023-05-30 09:14:36 +03:00
@if test " x ${ CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT } " = "xy" -a \
" x ${ CONFIG_LD_IS_BFD } " = "xy" -a \
" ${ CONFIG_LD_VERSION } " = "23700" ; then \
echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \
echo 'is unable to handle.' ; \
echo '*** Please use a different binutils version.' ; \
false ; \
fi