^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # List of files in the vdso, has to be asm only for now
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # Build rules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) ifdef CROSS32_COMPILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) VDSOCC := $(CROSS32_COMPILE)gcc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) VDSOCC := $(CC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) CC32FLAGS :=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ifdef CONFIG_PPC64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) CC32FLAGS += -m32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) GCOV_PROFILE := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) KCOV_INSTRUMENT := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) UBSAN_SANITIZE := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ccflags-y := -shared -fno-common -fno-builtin -nostdlib \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) -Wl,-soname=linux-vdso32.so.1 -Wl,--hash-style=both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) asflags-y := -D__VDSO32__ -s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) obj-y += vdso32_wrapper.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) targets += vdso32.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) CPPFLAGS_vdso32.lds += -P -C -Upowerpc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) # Force dependency (incbin is bad)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) # link rule for the .so file, .lds has to be first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) $(call if_changed,vdso32ld)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) # strip rule for the .so file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) $(obj)/%.so: OBJCOPYFLAGS := -S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) $(obj)/%.so: $(obj)/%.so.dbg FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) $(call if_changed,objcopy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) # assembly rules for the .S files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) $(obj-vdso32): %.o: %.S FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) $(call if_changed_dep,vdso32as)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) # actual build commands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) quiet_cmd_vdso32ld = VDSO32L $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) quiet_cmd_vdso32as = VDSO32A $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $<
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) # install commands for the unstripped file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) quiet_cmd_vdso_install = INSTALL $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) vdso32.so: $(obj)/vdso32.so.dbg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) @mkdir -p $(MODLIB)/vdso
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) $(call cmd,vdso_install)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) vdso_install: vdso32.so