1# List of files in the vdso, has to be asm only for now
2
3obj-vdso32 = note.o sigtramp.o restart_syscall.o
4
5# Build rules
6
7targets := $(obj-vdso32) vdso32.so
8obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
9
10ccflags-y := -shared -fno-common -fbuiltin -mno-fast-indirect-calls -O2 -mno-long-calls
11#  -march=1.1 -mschedule=7100LC
12ccflags-y += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
13		$(call ld-option, -Wl$(comma)--hash-style=sysv)
14asflags-y := -D__VDSO32__ -s
15
16KBUILD_AFLAGS += -DBUILD_VDSO
17KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
18
19VDSO_LIBGCC := $(shell $(CROSS32CC) -print-libgcc-file-name)
20
21obj-y += vdso32_wrapper.o
22extra-y += vdso32.lds
23CPPFLAGS_vdso32.lds += -P -C  #  -U$(ARCH)
24
25$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so FORCE
26
27# Force dependency (incbin is bad)
28# link rule for the .so file, .lds has to be first
29$(obj)/vdso32.so: $(src)/vdso32.lds $(obj-vdso32) $(obj-cvdso32) $(VDSO_LIBGCC) FORCE
30	$(call if_changed,vdso32ld)
31
32# assembly rules for the .S files
33$(obj-vdso32): %.o: %.S FORCE
34	$(call if_changed_dep,vdso32as)
35
36$(obj-cvdso32): %.o: %.c FORCE
37	$(call if_changed_dep,vdso32cc)
38
39# actual build commands
40quiet_cmd_vdso32ld = VDSO32L $@
41      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $(filter-out FORCE, $^) -o $@
42quiet_cmd_vdso32as = VDSO32A $@
43      cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
44quiet_cmd_vdso32cc = VDSO32C $@
45      cmd_vdso32cc = $(CROSS32CC) $(c_flags) -c -fPIC -mno-fast-indirect-calls -o $@ $<
46
47# Generate VDSO offsets using helper script
48gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
49quiet_cmd_vdsosym = VDSOSYM $@
50	cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
51
52include/generated/vdso32-offsets.h: $(obj)/vdso32.so FORCE
53	$(call if_changed,vdsosym)
54