56769ba4b2
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 19514fc665
("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>
94 lines
2.5 KiB
Makefile
94 lines
2.5 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# sparc/Makefile
|
|
#
|
|
# Makefile for the architecture dependent flags and dependencies on the
|
|
# Sparc and sparc64.
|
|
#
|
|
# Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu)
|
|
# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
|
|
|
|
# We are not yet configured - so test on arch
|
|
ifeq ($(ARCH),sparc64)
|
|
KBUILD_DEFCONFIG := sparc64_defconfig
|
|
else
|
|
KBUILD_DEFCONFIG := sparc32_defconfig
|
|
endif
|
|
|
|
ifeq ($(CONFIG_SPARC32),y)
|
|
#####
|
|
# sparc32
|
|
#
|
|
|
|
CHECKFLAGS += -D__sparc__
|
|
KBUILD_LDFLAGS := -m elf32_sparc
|
|
export BITS := 32
|
|
UTS_MACHINE := sparc
|
|
|
|
# We are adding -Wa,-Av8 to KBUILD_CFLAGS to deal with a specs bug in some
|
|
# versions of gcc. Some gcc versions won't pass -Av8 to binutils when you
|
|
# give -mcpu=v8. This silently worked with older bintutils versions but
|
|
# does not any more.
|
|
KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
|
|
KBUILD_CFLAGS += -Wa,-Av8
|
|
|
|
KBUILD_AFLAGS += -m32 -Wa,-Av8
|
|
|
|
else
|
|
#####
|
|
# sparc64
|
|
#
|
|
|
|
CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__
|
|
KBUILD_LDFLAGS := -m elf64_sparc
|
|
export BITS := 64
|
|
UTS_MACHINE := sparc64
|
|
|
|
KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow
|
|
KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
|
|
KBUILD_CFLAGS += -Wa,--undeclared-regs
|
|
KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
|
|
KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
|
|
|
|
ifeq ($(CONFIG_MCOUNT),y)
|
|
KBUILD_CFLAGS += -pg
|
|
endif
|
|
|
|
endif
|
|
|
|
libs-y += arch/sparc/prom/
|
|
libs-y += arch/sparc/lib/
|
|
|
|
drivers-$(CONFIG_PM) += arch/sparc/power/
|
|
drivers-$(CONFIG_FB) += arch/sparc/video/
|
|
|
|
boot := arch/sparc/boot
|
|
|
|
# Default target
|
|
all: zImage
|
|
|
|
image zImage uImage tftpboot.img vmlinux.aout: vmlinux
|
|
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
|
|
|
install:
|
|
$(call cmd,install)
|
|
|
|
archheaders:
|
|
$(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all
|
|
|
|
vdso-install-$(CONFIG_SPARC64) += arch/sparc/vdso/vdso64.so.dbg
|
|
vdso-install-$(CONFIG_COMPAT) += arch/sparc/vdso/vdso32.so.dbg
|
|
|
|
# This is the image used for packaging
|
|
KBUILD_IMAGE := $(boot)/zImage
|
|
|
|
# Don't use tabs in echo arguments.
|
|
define archhelp
|
|
echo '* vmlinux - standard SPARC kernel'
|
|
echo ' image - kernel image ($(boot)/image)'
|
|
echo '* zImage - stripped/compressed kernel image ($(boot)/zImage)'
|
|
echo ' uImage - U-Boot SPARC32 Image (only for LEON)'
|
|
echo ' vmlinux.aout - a.out kernel for SPARC64'
|
|
echo ' tftpboot.img - image prepared for tftp'
|
|
endef
|