linux-yocto/arch/csky/kernel/vdso/Makefile
Masahiro Yamada 7f7f6f7ad6 Makefile: remove redundant tool coverage variables
Now Kbuild provides reasonable defaults for objtool, sanitizers, and
profilers.

Remove redundant variables.

Note:

This commit changes the coverage for some objects:

  - include arch/mips/vdso/vdso-image.o into UBSAN, GCOV, KCOV
  - include arch/sparc/vdso/vdso-image-*.o into UBSAN
  - include arch/sparc/vdso/vma.o into UBSAN
  - include arch/x86/entry/vdso/extable.o into KASAN, KCSAN, UBSAN, GCOV, KCOV
  - include arch/x86/entry/vdso/vdso-image-*.o into KASAN, KCSAN, UBSAN, GCOV, KCOV
  - include arch/x86/entry/vdso/vdso32-setup.o into KASAN, KCSAN, UBSAN, GCOV, KCOV
  - include arch/x86/entry/vdso/vma.o into GCOV, KCOV
  - include arch/x86/um/vdso/vma.o into KASAN, GCOV, KCOV

I believe these are positive effects because all of them are kernel
space objects.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Roberto Sassu <roberto.sassu@huawei.com>
2024-05-14 23:35:48 +09:00

1.8 KiB

SPDX-License-Identifier: GPL-2.0-only

Include the generic Makefile to check the built vdso.

include $(srctree)/lib/vdso/Makefile

Symbols present in the vdso

vdso-syms += rt_sigreturn vdso-syms += vgettimeofday

Files to link into the vdso

obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o

ifneq ($(c-gettimeofday-y),) CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y) endif

ccflags-y := -fno-stack-protector -DBUILD_VDSO32

Build rules

targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o obj-vdso := $(addprefix $(obj)/, $(obj-vdso))

obj-y += vdso.o vdso-syms.o CPPFLAGS_vdso.lds += -P -C -U$(ARCH)

Force dependency

$(obj)/vdso.o: $(obj)/vdso.so

SYSCFLAGS_vdso.so.dbg = $(c_flags) $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE $(call if_changed,vdsold) SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1
-Wl,--build-id=sha1 -Wl,--hash-style=both

$(obj)/vdso-syms.S: $(obj)/vdso.so FORCE $(call if_changed,so2s)

strip rule for the .so file

$(obj)/%.so: OBJCOPYFLAGS := -S $(obj)/%.so: $(obj)/%.so.dbg FORCE $(call if_changed,objcopy)

actual build commands

The DSO images are built using a special linker script

Make sure only to export the intended __vdso_xxx symbol offsets.

quiet_cmd_vdsold = VDSOLD $@ cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F))
-Wl,-T,$(filter-out FORCE,$^) -o $@.tmp &&
$(CROSS_COMPILE)objcopy
$(patsubst %, -G _vdso%, $(vdso-syms)) $@.tmp $@ &&
rm $@.tmp

Extracts symbol offsets from the VDSO, converting them into an assembly file

that contains the same symbols at the same offsets.

quiet_cmd_so2s = SO2S $@ cmd_so2s = $(NM) -D $< | $(src)/so2s.sh > $@