Files
linux/arch/loongarch/vdso/Makefile
Linus Torvalds 5d0d362330 Merge tag 'kbuild-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux
Pull Kbuild/Kconfig updates from Nicolas Schier:
 "Kbuild:
   - reject unexpected values for LLVM=
   - uapi: remove usage of toolchain headers
   - switch from '-fms-extensions' to '-fms-anonymous-structs' when
     available (currently: clang >= 23.0.0)
   - reduce the number of compiler-generated suffixes for clang thin-lto
     build
   - reduce output spam ("GEN Makefile") when building out of tree
   - improve portability for testing headers
   - also test UAPI headers against C++ compilers
   - drop build ID architecture allow-list in vdso_install
   - only run checksyscalls when necessary
   - update the debug information notes in reproducible-builds.rst
   - expand inlining hints with -fdiagnostics-show-inlining-chain

  Kconfig:
   - forbid multiple entries with the same symbol in a choice
   - error out on duplicated kconfig inclusion"

* tag 'kbuild-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (35 commits)
  kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain
  kconfig: forbid multiple entries with the same symbol in a choice
  Documentation: kbuild: Update the debug information notes in reproducible-builds.rst
  checksyscalls: move instance functionality into generic code
  checksyscalls: only run when necessary
  checksyscalls: fail on all intermediate errors
  checksyscalls: move path to reference table to a variable
  kbuild: vdso_install: drop build ID architecture allow-list
  kbuild: vdso_install: gracefully handle images without build ID
  kbuild: vdso_install: hide readelf warnings
  kbuild: vdso_install: split out the readelf invocation
  kbuild: uapi: also test UAPI headers against C++ compilers
  kbuild: uapi: provide a C++ compatible dummy definition of NULL
  kbuild: uapi: handle UML in architecture-specific exclusion lists
  kbuild: uapi: move all include path flags together
  kbuild: uapi: move some compiler arguments out of the command definition
  check-uapi: use dummy libc includes
  check-uapi: honor ${CROSS_COMPILE} setting
  check-uapi: link into shared objects
  kbuild: reduce output spam when building out of tree
  ...
2026-04-14 09:18:40 -07:00

90 lines
2.5 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# Objects to go into the VDSO.
# Include the generic Makefile to check the built vdso.
include $(srctree)/lib/vdso/Makefile.include
obj-vdso-y := elf.o vgetcpu.o vgetrandom.o \
vgetrandom-chacha.o sigreturn.o
obj-vdso-$(CONFIG_GENERIC_GETTIMEOFDAY) += vgettimeofday.o
# Common compiler flags between ABIs.
ccflags-vdso := \
$(filter -I%,$(KBUILD_CFLAGS)) \
$(filter -E%,$(KBUILD_CFLAGS)) \
$(filter -march=%,$(KBUILD_CFLAGS)) \
$(filter -m%-float,$(KBUILD_CFLAGS)) \
$(CLANG_FLAGS) \
-D__VDSO__
ifdef CONFIG_32BIT
ccflags-vdso += -DBUILD_VDSO32
endif
cflags-vdso := $(ccflags-vdso) \
-isystem $(shell $(CC) -print-file-name=include) \
$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
$(CC_FLAGS_DIALECT) -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
$(call cc-option, -fasynchronous-unwind-tables) \
$(call cc-option, -fno-stack-protector)
aflags-vdso := $(ccflags-vdso) \
-D__ASSEMBLY__ -Wa,-gdwarf-2
ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
endif
ifneq ($(c-getrandom-y),)
CFLAGS_vgetrandom.o += -include $(c-getrandom-y)
endif
# VDSO linker flags.
ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
$(filter -E%,$(KBUILD_CFLAGS)) -shared --build-id --eh-frame-hdr -T
#
# Shared build commands.
#
quiet_cmd_vdsold_and_vdso_check = LD $@
cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
quiet_cmd_vdsoas_o_S = AS $@
cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
# Generate VDSO offsets using helper script
gen-vdsosym := $(src)/gen_vdso_offsets.sh
quiet_cmd_vdsosym = VDSOSYM $@
cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
$(call if_changed,vdsosym)
#
# Build native VDSO.
#
native-abi := $(filter -mabi=%,$(KBUILD_CFLAGS))
targets += $(obj-vdso-y)
targets += vdso.lds vdso.so.dbg vdso.so
obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o)
$(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi)
$(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso.so: OBJCOPYFLAGS := -S
$(obj)/vdso.so: $(obj)/vdso.so.dbg FORCE
$(call if_changed,objcopy)
obj-y += vdso.o
$(obj)/vdso.o : $(obj)/vdso.so