xref: /linux/arch/x86/entry/vdso/vdso64/Makefile (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1# SPDX-License-Identifier: GPL-2.0
2#
3# 64-bit vDSO images for x86.
4#
5
6# The vDSOs built in this directory
7vdsos-y				:= 64
8vdsos-$(CONFIG_X86_X32_ABI)	+= x32
9
10# Files to link into the vDSO:
11vobjs-y					:= note.o vclock_gettime.o vgetcpu.o
12vobjs-y					+= vgetrandom.o vgetrandom-chacha.o
13vobjs-$(CONFIG_X86_SGX)			+= vsgx.o
14vobjs-$(CONFIG_FUTEX_ROBUST_UNLOCK)	+= vfutex.o
15
16# Compilation flags
17flags-y				:= -DBUILD_VDSO64 -m64 -mcmodel=small
18
19# The location of this include matters!
20include $(src)/../common/Makefile.include
21
22#
23# X32 processes use x32 vDSO to access 64bit kernel data.
24#
25# Build x32 vDSO image:
26# 1. Compile x32 vDSO as 64bit.
27# 2. Convert object files to x32.
28# 3. Build x32 VDSO image with x32 objects, which contains 64bit codes
29# so that it can reach 64bit address space with 64bit pointers.
30#
31
32# Convert 64bit object file to x32 for x32 vDSO.
33quiet_cmd_x32 = X32     $@
34      cmd_x32 = $(OBJCOPY) -O elf32-x86-64 $< $@
35
36$(obj)/%-x32.o: $(obj)/%.o FORCE
37	$(call if_changed,x32)
38
39vobjsx32 = $(patsubst %.o,%-x32.o,$(vobjs))
40targets += $(patsubst %.o,%-x32.o,$(vobjs-y))
41
42# Linker options for the vdso
43VDSO_LDFLAGS_64  := -m elf_x86_64 -soname linux-vdso.so.1 -z max-page-size=4096
44VDSO_LDFLAGS_x32 := $(subst elf_x86_64,elf32_x86_64,$(VDSO_LDFLAGS_64))
45
46$(obj)/vdso64.so.dbg:	$(vobjs)
47$(obj)/vdsox32.so.dbg:	$(vobjsx32)
48