Linux Audio

Check our new training course

Loading...
v6.8
 1# SPDX-License-Identifier: GPL-2.0-only
 2
 3# Include the generic Makefile to check the built vdso.
 
 
 4include $(srctree)/lib/vdso/Makefile
 5
 6# Symbols present in the vdso
 7vdso-syms  += rt_sigreturn
 8vdso-syms  += vgettimeofday
 9
10# Files to link into the vdso
11obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
12
13ifneq ($(c-gettimeofday-y),)
14	CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
15endif
16
17ccflags-y := -fno-stack-protector -DBUILD_VDSO32
18
19# Build rules
20targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
21obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
22
23obj-y += vdso.o vdso-syms.o
24CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
25
26# Disable gcov profiling for VDSO code
27GCOV_PROFILE := n
28KCOV_INSTRUMENT := n
29
30# Force dependency
31$(obj)/vdso.o: $(obj)/vdso.so
32
33SYSCFLAGS_vdso.so.dbg = $(c_flags)
34$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
35	$(call if_changed,vdsold)
36SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
37	-Wl,--build-id=sha1 -Wl,--hash-style=both
38
39$(obj)/vdso-syms.S: $(obj)/vdso.so FORCE
40	$(call if_changed,so2s)
41
42# strip rule for the .so file
43$(obj)/%.so: OBJCOPYFLAGS := -S
44$(obj)/%.so: $(obj)/%.so.dbg FORCE
45	$(call if_changed,objcopy)
46
47# actual build commands
48# The DSO images are built using a special linker script
49# Make sure only to export the intended __vdso_xxx symbol offsets.
50quiet_cmd_vdsold = VDSOLD  $@
51      cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \
52                           -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \
53                   $(CROSS_COMPILE)objcopy \
54                           $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
55                   rm $@.tmp
56
57# Extracts symbol offsets from the VDSO, converting them into an assembly file
58# that contains the same symbols at the same offsets.
59quiet_cmd_so2s = SO2S    $@
60      cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@
v6.2
 1# SPDX-License-Identifier: GPL-2.0-only
 2
 3# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
 4# the inclusion of generic Makefile.
 5ARCH_REL_TYPE_ABS := R_CKCORE_ADDR32|R_CKCORE_JUMP_SLOT
 6include $(srctree)/lib/vdso/Makefile
 7
 8# Symbols present in the vdso
 9vdso-syms  += rt_sigreturn
10vdso-syms  += vgettimeofday
11
12# Files to link into the vdso
13obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
14
15ifneq ($(c-gettimeofday-y),)
16	CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
17endif
18
19ccflags-y := -fno-stack-protector -DBUILD_VDSO32
20
21# Build rules
22targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
23obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
24
25obj-y += vdso.o vdso-syms.o
26CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
27
28# Disable gcov profiling for VDSO code
29GCOV_PROFILE := n
30KCOV_INSTRUMENT := n
31
32# Force dependency
33$(obj)/vdso.o: $(obj)/vdso.so
34
35SYSCFLAGS_vdso.so.dbg = $(c_flags)
36$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
37	$(call if_changed,vdsold)
38SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
39	-Wl,--build-id=sha1 -Wl,--hash-style=both
40
41$(obj)/vdso-syms.S: $(obj)/vdso.so FORCE
42	$(call if_changed,so2s)
43
44# strip rule for the .so file
45$(obj)/%.so: OBJCOPYFLAGS := -S
46$(obj)/%.so: $(obj)/%.so.dbg FORCE
47	$(call if_changed,objcopy)
48
49# actual build commands
50# The DSO images are built using a special linker script
51# Make sure only to export the intended __vdso_xxx symbol offsets.
52quiet_cmd_vdsold = VDSOLD  $@
53      cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \
54                           -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \
55                   $(CROSS_COMPILE)objcopy \
56                           $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
57                   rm $@.tmp
58
59# Extracts symbol offsets from the VDSO, converting them into an assembly file
60# that contains the same symbols at the same offsets.
61quiet_cmd_so2s = SO2S    $@
62      cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@
63
64# install commands for the unstripped file
65quiet_cmd_vdso_install = INSTALL $@
66      cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
67
68vdso.so: $(obj)/vdso.so.dbg
69	@mkdir -p $(MODLIB)/vdso
70	$(call cmd,vdso_install)
71
72vdso_install: vdso.so