2005-04-16 22:20:36 +00:00
|
|
|
#
|
|
|
|
# parisc/Makefile
|
|
|
|
#
|
|
|
|
# This file is included by the global makefile so that you can add your own
|
2021-10-13 06:36:22 +00:00
|
|
|
# architecture-specific flags and dependencies.
|
2005-04-16 22:20:36 +00: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
|
|
|
|
# Portions Copyright (C) 1999 The Puffin Group
|
|
|
|
#
|
2023-04-17 12:56:44 +00:00
|
|
|
# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
|
2005-04-16 22:20:36 +00:00
|
|
|
# Mike Shaver, Helge Deller and Martin K. Petersen
|
|
|
|
#
|
2008-02-26 19:55:17 +00:00
|
|
|
|
2021-11-26 21:35:45 +00:00
|
|
|
boot := arch/parisc/boot
|
|
|
|
KBUILD_IMAGE := $(boot)/bzImage
|
2013-06-29 11:31:24 +00:00
|
|
|
|
2018-05-28 18:27:35 +00:00
|
|
|
CHECKFLAGS += -D__hppa__=1
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
ifdef CONFIG_64BIT
|
|
|
|
UTS_MACHINE := parisc64
|
2018-05-30 20:48:38 +00:00
|
|
|
CHECKFLAGS += -D__LP64__=1
|
2017-08-20 08:52:22 +00:00
|
|
|
LD_BFD := elf64-hppa-linux
|
2007-10-18 20:54:51 +00:00
|
|
|
else # 32-bit
|
2017-08-20 08:52:22 +00:00
|
|
|
LD_BFD := elf32-hppa-linux
|
2005-04-16 22:20:36 +00:00
|
|
|
endif
|
|
|
|
|
2020-03-26 22:31:43 +00:00
|
|
|
# select defconfig based on actual architecture
|
2021-06-10 02:03:31 +00:00
|
|
|
ifeq ($(ARCH),parisc64)
|
2020-03-26 22:31:43 +00:00
|
|
|
KBUILD_DEFCONFIG := generic-64bit_defconfig
|
2021-06-10 02:03:31 +00:00
|
|
|
CC_ARCHES := hppa64
|
2020-03-26 22:31:43 +00:00
|
|
|
else
|
|
|
|
KBUILD_DEFCONFIG := generic-32bit_defconfig
|
2021-06-10 02:03:31 +00:00
|
|
|
CC_ARCHES := hppa hppa2.0 hppa1.1
|
2020-03-26 22:31:43 +00:00
|
|
|
endif
|
|
|
|
|
2017-08-20 08:52:22 +00:00
|
|
|
export LD_BFD
|
|
|
|
|
2021-12-08 10:06:52 +00:00
|
|
|
# Set default 32 bits cross compilers for vdso
|
|
|
|
CC_ARCHES_32 = hppa hppa2.0 hppa1.1
|
2022-03-21 21:02:01 +00:00
|
|
|
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
|
2021-12-08 10:06:52 +00:00
|
|
|
CROSS32_COMPILE := $(call cc-cross-prefix, \
|
|
|
|
$(foreach a,$(CC_ARCHES_32), \
|
|
|
|
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
|
|
|
|
CROSS32CC := $(CROSS32_COMPILE)gcc
|
|
|
|
export CROSS32CC
|
|
|
|
|
|
|
|
# Set default cross compiler for kernel build
|
2021-05-01 17:24:36 +00:00
|
|
|
ifdef cross_compiling
|
2024-02-02 01:31:42 +00:00
|
|
|
ifeq ($(CROSS_COMPILE),)
|
2022-03-21 21:02:01 +00:00
|
|
|
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
|
2013-05-11 19:04:09 +00:00
|
|
|
CROSS_COMPILE := $(call cc-cross-prefix, \
|
|
|
|
$(foreach a,$(CC_ARCHES), \
|
|
|
|
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
|
2024-02-02 01:31:42 +00:00
|
|
|
endif
|
2007-10-18 20:54:51 +00:00
|
|
|
endif
|
2005-04-16 22:20:36 +00:00
|
|
|
|
parisc: add dynamic ftrace
This patch implements dynamic ftrace for PA-RISC. The required mcount
call sequences can get pretty long, so instead of patching the
whole call sequence out of the functions, we are using
-fpatchable-function-entry from gcc. This puts a configurable amount of
NOPS before/at the start of the function. Taking do_sys_open() as example,
which would look like this when the call is patched out:
1036b248: 08 00 02 40 nop
1036b24c: 08 00 02 40 nop
1036b250: 08 00 02 40 nop
1036b254: 08 00 02 40 nop
1036b258 <do_sys_open>:
1036b258: 08 00 02 40 nop
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
When ftrace gets enabled for this function the kernel will patch these
NOPs to:
1036b248: 10 19 57 20 <address of ftrace>
1036b24c: 6f c1 00 80 stw,ma r1,40(sp)
1036b250: 48 21 3f d1 ldw -18(r1),r1
1036b254: e8 20 c0 02 bv,n r0(r1)
1036b258 <do_sys_open>:
1036b258: e8 3f 1f df b,l,n .-c,r1
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
So the first NOP in do_sys_open() will be patched to jump backwards into
some minimal trampoline code which pushes a stackframe, saves r1 which
holds the return address, loads the address of the real ftrace function,
and branches to that location. For 64 Bit things are getting a bit more
complicated (and longer) because we must make sure that the address of
ftrace location is 8 byte aligned, and the offset passed to ldd for
fetching the address is 8 byte aligned as well.
Note that gcc has a bug which misplaces the function label, and needs a
patch to make dynamic ftrace work. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-06-05 20:32:22 +00:00
|
|
|
ifdef CONFIG_DYNAMIC_FTRACE
|
|
|
|
ifdef CONFIG_64BIT
|
|
|
|
NOP_COUNT := 8
|
|
|
|
else
|
|
|
|
NOP_COUNT := 5
|
|
|
|
endif
|
|
|
|
|
|
|
|
export CC_USING_RECORD_MCOUNT:=1
|
|
|
|
export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
|
|
|
|
|
|
|
|
KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
|
|
|
|
KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
|
|
|
|
-DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
|
|
|
|
|
|
|
|
CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
|
|
|
|
endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
|
|
|
|
|
|
|
|
cflags-y := -pipe
|
|
|
|
|
|
|
|
# These flags should be implied by an hppa-linux configuration, but they
|
|
|
|
# are not in gcc 3.2.
|
2014-09-23 00:54:50 +00:00
|
|
|
cflags-y += -mno-space-regs
|
|
|
|
|
|
|
|
# -mfast-indirect-calls is only relevant for 32-bit kernels.
|
|
|
|
ifndef CONFIG_64BIT
|
|
|
|
cflags-y += -mfast-indirect-calls
|
|
|
|
endif
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
# Currently we save and restore fpregs on all kernel entry/interruption paths.
|
|
|
|
# If that gets optimized, we might need to disable the use of fpregs in the
|
|
|
|
# kernel.
|
2005-10-22 02:48:34 +00:00
|
|
|
cflags-y += -mdisable-fpregs
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-01-31 21:44:28 +00:00
|
|
|
# Use long jumps instead of long branches (needed if your linker fails to
|
2013-04-23 19:29:03 +00:00
|
|
|
# link a too big vmlinux executable). Not enabled for building modules.
|
|
|
|
ifdef CONFIG_MLONGCALLS
|
|
|
|
KBUILD_CFLAGS_KERNEL += -mlong-calls
|
|
|
|
endif
|
2013-01-31 21:44:28 +00:00
|
|
|
|
2018-11-29 16:05:47 +00:00
|
|
|
# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
|
|
|
|
# for branches to reach stubs. And multiple .text sections trigger a warning
|
|
|
|
# when creating the sysfs module information section.
|
|
|
|
ifndef CONFIG_64BIT
|
|
|
|
KBUILD_CFLAGS_MODULE += -ffunction-sections
|
|
|
|
endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
# select which processor to optimise for
|
2013-05-29 09:56:58 +00:00
|
|
|
cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100
|
2005-04-16 22:20:36 +00:00
|
|
|
cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200
|
|
|
|
cflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC
|
|
|
|
cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300
|
|
|
|
cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000
|
|
|
|
|
2007-10-14 20:21:35 +00:00
|
|
|
KBUILD_CFLAGS += $(cflags-y)
|
2020-05-10 20:43:33 +00:00
|
|
|
LIBGCC := $(shell $(CC) -print-libgcc-file-name)
|
|
|
|
export LIBGCC
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2012-06-05 04:54:09 +00:00
|
|
|
libs-y += arch/parisc/lib/ $(LIBGCC)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2023-04-17 12:56:45 +00:00
|
|
|
drivers-y += arch/parisc/video/
|
|
|
|
|
2017-08-20 08:52:22 +00:00
|
|
|
boot := arch/parisc/boot
|
|
|
|
|
2008-12-08 09:43:08 +00:00
|
|
|
PALO := $(shell if (which palo 2>&1); then : ; \
|
2007-10-18 22:09:59 +00:00
|
|
|
elif [ -x /sbin/palo ]; then echo /sbin/palo; \
|
|
|
|
fi)
|
|
|
|
|
2019-07-06 03:07:11 +00:00
|
|
|
PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
|
|
|
|
else echo $(objtree)/palo.conf; \
|
2007-10-20 16:31:33 +00:00
|
|
|
fi)
|
|
|
|
|
2013-10-18 19:18:46 +00:00
|
|
|
palo lifimage: vmlinuz
|
2007-10-20 16:31:33 +00:00
|
|
|
@if test ! -x "$(PALO)"; then \
|
2007-10-18 22:09:59 +00:00
|
|
|
echo 'ERROR: Please install palo first (apt-get install palo)';\
|
|
|
|
echo 'or build it from source and install it somewhere in your $$PATH';\
|
|
|
|
false; \
|
|
|
|
fi
|
2007-10-20 16:31:33 +00:00
|
|
|
@if test ! -f "$(PALOCONF)"; then \
|
2019-07-06 03:07:11 +00:00
|
|
|
cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
|
|
|
|
echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
|
2007-10-18 22:09:59 +00:00
|
|
|
echo 'You should check it and re-run "make palo".'; \
|
|
|
|
echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
|
|
|
|
false; \
|
|
|
|
fi
|
2007-10-20 16:31:33 +00:00
|
|
|
$(PALO) -f $(PALOCONF)
|
2007-10-18 22:09:59 +00:00
|
|
|
|
2013-10-18 19:18:46 +00:00
|
|
|
BOOT_TARGETS = zImage Image palo lifimage
|
|
|
|
INSTALL_TARGETS = zinstall install
|
|
|
|
|
|
|
|
PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
|
|
|
|
|
2018-04-18 05:49:19 +00:00
|
|
|
# Default kernel to build
|
|
|
|
all: bzImage
|
|
|
|
|
2017-08-20 08:52:22 +00:00
|
|
|
zImage: vmlinuz
|
2013-06-29 11:31:24 +00:00
|
|
|
Image: vmlinux
|
|
|
|
|
2017-08-20 08:52:22 +00:00
|
|
|
bzImage: vmlinux
|
|
|
|
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
|
|
|
|
|
|
|
vmlinuz: bzImage
|
|
|
|
$(OBJCOPY) $(boot)/bzImage $@
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2021-12-08 10:06:52 +00:00
|
|
|
ifeq ($(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: prepare0
|
|
|
|
$(if $(CONFIG_64BIT),$(Q)$(MAKE) \
|
|
|
|
$(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h)
|
|
|
|
$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h
|
|
|
|
endif
|
|
|
|
|
kbuild: unify vdso_install rules
Currently, there is no standard implementation for vdso_install,
leading to various issues:
1. Code duplication
Many architectures duplicate similar code just for copying files
to the install destination.
Some architectures (arm, sparc, x86) create build-id symlinks,
introducing more code duplication.
2. Unintended updates of in-tree build artifacts
The vdso_install rule depends on the vdso files to install.
It may update in-tree build artifacts. This can be problematic,
as explained in commit 19514fc665ff ("arm, kbuild: make
"make install" not depend on vmlinux").
3. Broken code in some architectures
Makefile code is often copied from one architecture to another
without proper adaptation.
'make vdso_install' for parisc does not work.
'make vdso_install' for s390 installs vdso64, but not vdso32.
To address these problems, this commit introduces a generic vdso_install
rule.
Architectures that support vdso_install need to define vdso-install-y
in arch/*/Makefile. vdso-install-y lists the files to install.
For example, arch/x86/Makefile looks like this:
vdso-install-$(CONFIG_X86_64) += arch/x86/entry/vdso/vdso64.so.dbg
vdso-install-$(CONFIG_X86_X32_ABI) += arch/x86/entry/vdso/vdsox32.so.dbg
vdso-install-$(CONFIG_X86_32) += arch/x86/entry/vdso/vdso32.so.dbg
vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg
These files will be installed to $(MODLIB)/vdso/ with the .dbg suffix,
if exists, stripped away.
vdso-install-y can optionally take the second field after the colon
separator. This is needed because some architectures install a vdso
file as a different base name.
The following is a snippet from arch/arm64/Makefile.
vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so
This will rename vdso.so.dbg to vdso32.so during installation. If such
architectures change their implementation so that the base names match,
this workaround will go away.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Sven Schnelle <svens@linux.ibm.com> # s390
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Reviewed-by: Guo Ren <guoren@kernel.org>
Acked-by: Helge Deller <deller@gmx.de> # parisc
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2023-10-14 10:54:35 +00:00
|
|
|
vdso-install-y += arch/parisc/kernel/vdso32/vdso32.so
|
|
|
|
vdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so
|
2022-05-03 02:47:16 +00:00
|
|
|
|
|
|
|
install: KBUILD_IMAGE := vmlinux
|
|
|
|
zinstall: KBUILD_IMAGE := vmlinuz
|
|
|
|
install zinstall:
|
|
|
|
$(call cmd,install)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-09 18:57:26 +00:00
|
|
|
CLEAN_FILES += lifimage
|
2005-04-16 22:20:36 +00:00
|
|
|
MRPROPER_FILES += palo.conf
|
|
|
|
|
|
|
|
define archhelp
|
|
|
|
@echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
|
2013-06-29 11:31:24 +00:00
|
|
|
@echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
|
2007-10-18 22:09:59 +00:00
|
|
|
@echo ' palo - Bootable image (./lifimage)'
|
2013-10-18 19:18:46 +00:00
|
|
|
@echo ' install - Install uncompressed vmlinux kernel using'
|
2009-07-20 19:37:11 +00:00
|
|
|
@echo ' (your) ~/bin/$(INSTALLKERNEL) or'
|
|
|
|
@echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
|
2005-04-16 22:20:36 +00:00
|
|
|
@echo ' copy to $$(INSTALL_PATH)'
|
2013-10-18 19:18:46 +00:00
|
|
|
@echo ' zinstall - Install compressed vmlinuz kernel'
|
2005-04-16 22:20:36 +00:00
|
|
|
endef
|
2018-11-19 06:34:36 +00:00
|
|
|
|
|
|
|
archheaders:
|
|
|
|
$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
|