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