Merge tag 'v5.1-rc2' into next-general
[linux-2.6-microblaze.git] / arch / riscv / kernel / vdso / Makefile
1 # Copied from arch/tile/kernel/vdso/Makefile
2
3 # Symbols present in the vdso
4 vdso-syms  = rt_sigreturn
5 ifdef CONFIG_64BIT
6 vdso-syms += gettimeofday
7 vdso-syms += clock_gettime
8 vdso-syms += clock_getres
9 endif
10 vdso-syms += getcpu
11 vdso-syms += flush_icache
12
13 # Files to link into the vdso
14 obj-vdso = $(patsubst %, %.o, $(vdso-syms))
15
16 # Build rules
17 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
18 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
19
20 obj-y += vdso.o vdso-syms.o
21 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
22
23 # Disable gcov profiling for VDSO code
24 GCOV_PROFILE := n
25
26 # Force dependency
27 $(obj)/vdso.o: $(obj)/vdso.so
28
29 # link rule for the .so file, .lds has to be first
30 SYSCFLAGS_vdso.so.dbg = $(c_flags)
31 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
32         $(call if_changed,vdsold)
33
34 # We also create a special relocatable object that should mirror the symbol
35 # table and layout of the linked DSO.  With ld -R we can then refer to
36 # these symbols in the kernel code rather than hand-coded addresses.
37
38 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
39                             $(call cc-ldoption, -Wl$(comma)--hash-style=both)
40 $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
41         $(call if_changed,vdsold)
42
43 LDFLAGS_vdso-syms.o := -r -R
44 $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
45         $(call if_changed,ld)
46
47 # strip rule for the .so file
48 $(obj)/%.so: OBJCOPYFLAGS := -S
49 $(obj)/%.so: $(obj)/%.so.dbg FORCE
50         $(call if_changed,objcopy)
51
52 # actual build commands
53 # The DSO images are built using a special linker script
54 # Add -lgcc so rv32 gets static muldi3 and lshrdi3 definitions.
55 # Make sure only to export the intended __vdso_xxx symbol offsets.
56 quiet_cmd_vdsold = VDSOLD  $@
57       cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \
58                            -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \
59                    $(CROSS_COMPILE)objcopy \
60                            $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@
61
62 # install commands for the unstripped file
63 quiet_cmd_vdso_install = INSTALL $@
64       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
65
66 vdso.so: $(obj)/vdso.so.dbg
67         @mkdir -p $(MODLIB)/vdso
68         $(call cmd,vdso_install)
69
70 vdso_install: vdso.so