File Index
Files and directories
Sign in
FILE

Makefile

File preview with syntax highlighting.

linux-6.19.14/arch/powerpc/kernel/vdso/Makefile MAKEFILE
  1# SPDX-License-Identifier: GPL-2.0
  2
  3# List of files in the vdso, has to be asm only for now
  4
  5# Include the generic Makefile to check the built vdso.
  6include $(srctree)/lib/vdso/Makefile.include
  7
  8obj-vdso32 = sigtramp32-32.o gettimeofday-32.o datapage-32.o cacheflush-32.o note-32.o getcpu-32.o
  9obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o note-64.o getcpu-64.o
 10
 11obj-vdso32 += getrandom-32.o vgetrandom-chacha-32.o
 12obj-vdso64 += getrandom-64.o vgetrandom-chacha-64.o
 13
 14ifneq ($(c-gettimeofday-y),)
 15  CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y)
 16# Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true
 17# by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is
 18# compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code
 19# generation is minimal, it will just use r29 instead.
 20  CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) $(call cc-option, -ffixed-r30)
 21endif
 22
 23ifneq ($(c-getrandom-y),)
 24  CFLAGS_vgetrandom-32.o += -include $(c-getrandom-y)
 25  CFLAGS_vgetrandom-64.o += -include $(c-getrandom-y)
 26endif
 27
 28# Build rules
 29
 30ifdef CROSS32_COMPILE
 31    VDSOCC := $(CROSS32_COMPILE)gcc
 32else
 33    VDSOCC := $(CC)
 34endif
 35
 36targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o vgetrandom-32.o
 37targets += crtsavres-32.o
 38obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
 39targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o vgetrandom-64.o
 40obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
 41
 42ccflags-y := -fno-common -fno-builtin -DBUILD_VDSO
 43ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN)
 44ccflags-y += $(call cc-option, -fno-stack-protector)
 45ccflags-y += -DDISABLE_BRANCH_PROFILING
 46ccflags-y += -ffreestanding -fasynchronous-unwind-tables
 47ccflags-remove-y := $(CC_FLAGS_FTRACE)
 48ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS)
 49ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
 50ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
 51
 52# Filter flags that clang will warn are unused for linking
 53ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
 54
 55CC32FLAGS := -m32
 56CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc -mpcrel
 57ifdef CONFIG_CC_IS_CLANG
 58# This flag is supported by clang for 64-bit but not 32-bit so it will cause
 59# an unused command line flag warning for this file.
 60CC32FLAGSREMOVE += -fno-stack-clash-protection
 61# -mstack-protector-guard values from the 64-bit build are not valid for the
 62# 32-bit one. clang validates the values passed to these arguments during
 63# parsing, even when -fno-stack-protector is passed afterwards.
 64CC32FLAGSREMOVE += -mstack-protector-guard%
 65endif
 66LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
 67AS32FLAGS := -D__VDSO32__
 68
 69LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
 70AS64FLAGS := -D__VDSO64__
 71
 72targets += vdso32.lds
 73CPPFLAGS_vdso32.lds += -P -C -Upowerpc
 74targets += vdso64.lds
 75CPPFLAGS_vdso64.lds += -P -C
 76
 77# link rule for the .so file, .lds has to be first
 78$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE
 79	$(call if_changed,vdso32ld_and_check)
 80$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o FORCE
 81	$(call if_changed,vdso64ld_and_check)
 82
 83# assembly rules for the .S files
 84$(obj-vdso32): %-32.o: %.S FORCE
 85	$(call if_changed_dep,vdso32as)
 86$(obj)/crtsavres-32.o: %-32.o: $(srctree)/arch/powerpc/lib/crtsavres.S FORCE
 87	$(call if_changed_dep,vdso32as)
 88$(obj)/vgettimeofday-32.o: %-32.o: %.c FORCE
 89	$(call if_changed_dep,vdso32cc)
 90$(obj)/vgetrandom-32.o: %-32.o: %.c FORCE
 91	$(call if_changed_dep,vdso32cc)
 92$(obj-vdso64): %-64.o: %.S FORCE
 93	$(call if_changed_dep,vdso64as)
 94$(obj)/vgettimeofday-64.o: %-64.o: %.c FORCE
 95	$(call if_changed_dep,cc_o_c)
 96$(obj)/vgetrandom-64.o: %-64.o: %.c FORCE
 97	$(call if_changed_dep,cc_o_c)
 98
 99# Generate VDSO offsets using helper script
100gen-vdso32sym := $(src)/gen_vdso32_offsets.sh
101quiet_cmd_vdso32sym = VDSO32SYM $@
102      cmd_vdso32sym = $(NM) $< | $(gen-vdso32sym) | LC_ALL=C sort > $@
103gen-vdso64sym := $(src)/gen_vdso64_offsets.sh
104quiet_cmd_vdso64sym = VDSO64SYM $@
105      cmd_vdso64sym = $(NM) $< | $(gen-vdso64sym) | LC_ALL=C sort > $@
106
107include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE
108	$(call if_changed,vdso32sym)
109include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
110	$(call if_changed,vdso64sym)
111
112# actual build commands
113quiet_cmd_vdso32ld_and_check = VDSO32L $@
114      cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
115quiet_cmd_vdso32as = VDSO32A $@
116      cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
117quiet_cmd_vdso32cc = VDSO32C $@
118      cmd_vdso32cc = $(VDSOCC) $(filter-out $(CC32FLAGSREMOVE), $(c_flags)) $(CC32FLAGS) -c -o $@ $<
119
120quiet_cmd_vdso64ld_and_check = VDSO64L $@
121      cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
122quiet_cmd_vdso64as = VDSO64A $@
123      cmd_vdso64as = $(VDSOCC) $(a_flags) $(AS64FLAGS) -c -o $@ $<
~/ Read-only file preview.