xref: /linux/arch/x86/entry/vdso/vdso64/Makefile (revision 6f7e6393d1ce636bb7ec77a7fe7b77458fddf701)
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
14
15# Compilation flags
16flags-y				:= -DBUILD_VDSO64 -m64 -mcmodel=small
17
18# The location of this include matters!
19include $(src)/../common/Makefile.include
20
21#
22# X32 processes use x32 vDSO to access 64bit kernel data.
23#
24# Build x32 vDSO image:
25# 1. Compile x32 vDSO as 64bit.
26# 2. Convert object files to x32.
27# 3. Build x32 VDSO image with x32 objects, which contains 64bit codes
28# so that it can reach 64bit address space with 64bit pointers.
29#
30
31# Convert 64bit object file to x32 for x32 vDSO.
32quiet_cmd_x32 = X32     $@
33      cmd_x32 = $(OBJCOPY) -O elf32-x86-64 $< $@
34
35$(obj)/%-x32.o: $(obj)/%.o FORCE
36	$(call if_changed,x32)
37
38vobjsx32 = $(patsubst %.o,%-x32.o,$(vobjs))
39targets += $(patsubst %.o,%-x32.o,$(vobjs-y))
40
41# Linker options for the vdso
42VDSO_LDFLAGS_64  := -m elf_x86_64 -soname linux-vdso.so.1 -z max-page-size=4096
43VDSO_LDFLAGS_x32 := $(subst elf_x86_64,elf32_x86_64,$(VDSO_LDFLAGS_64))
44
45$(obj)/vdso64.so.dbg:	$(vobjs)
46$(obj)/vdsox32.so.dbg:	$(vobjsx32)
47