aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/vdso-ilp32/Makefile
blob: c8f54727fbb20d723350fa1b616b56479e406fa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# Building a vDSO image for AArch64.
#
# Author: Will Deacon <will.deacon@arm.com>
# Heavily based on the vDSO Makefiles for other archs.
#

obj-ilp32-vdso := gettimeofday-ilp32.o note-ilp32.o sigreturn-ilp32.o

# Build rules
targets := $(obj-ilp32-vdso) vdso-ilp32.so vdso-ilp32.so.dbg
obj-ilp32-vdso := $(addprefix $(obj)/, $(obj-ilp32-vdso))

ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl,-soname=linux-ilp32-vdso.so.1 \
		$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)

obj-y += vdso-ilp32.o
extra-y += vdso-ilp32.lds vdso-ilp32-offsets.h
CPPFLAGS_vdso-ilp32.lds += -P -C -U$(ARCH) -mabi=ilp32

# Force dependency (incbin is bad)
$(obj)/vdso-ilp32.o : $(obj)/vdso-ilp32.so

# Link rule for the .so file, .lds has to be first
$(obj)/vdso-ilp32.so.dbg: $(src)/vdso-ilp32.lds $(obj-ilp32-vdso)
	$(call if_changed,vdso-ilp32ld)

# Strip rule for the .so file
$(obj)/%.so: OBJCOPYFLAGS := -S
$(obj)/%.so: $(obj)/%.so.dbg FORCE
	$(call if_changed,objcopy)

# Generate VDSO offsets using helper script
gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh
quiet_cmd_vdsosym = VDSOSYM $@
define cmd_vdsosym
	$(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \
	cp $@ include/generated/
endef

$(obj)/vdso-ilp32-offsets.h: $(obj)/vdso-ilp32.so.dbg FORCE
	$(call if_changed,vdsosym)

# Assembly rules for the .S files
#$(obj-ilp32-vdso): %.o: $(src)/../vdso/$(subst -ilp32,,%.S)
#	$(call if_changed_dep,vdso-ilp32as)

$(obj)/gettimeofday-ilp32.o: $(src)/../vdso/gettimeofday.S
	$(call if_changed_dep,vdso-ilp32as)

$(obj)/note-ilp32.o: $(src)/../vdso/note.S
	$(call if_changed_dep,vdso-ilp32as)

$(obj)/sigreturn-ilp32.o: $(src)/../vdso/sigreturn.S
	$(call if_changed_dep,vdso-ilp32as)

# Actual build commands
quiet_cmd_vdso-ilp32ld = VDSOILP32L $@
      cmd_vdso-ilp32ld = $(CC) $(c_flags) -mabi=ilp32  -Wl,-n -Wl,-T $^ -o $@
quiet_cmd_vdso-ilp32as = VDSOILP32A $@
      cmd_vdso-ilp32as = $(CC) $(a_flags) -mabi=ilp32 -c -o $@ $<

# Install commands for the unstripped file
quiet_cmd_vdso_install = INSTALL $@
      cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@

vdso-ilp32.so: $(obj)/vdso-ilp32.so.dbg
	@mkdir -p $(MODLIB)/vdso
	$(call cmd,vdso_install)

vdso_install: vdso-ilp32.so