| 1 |
# SPDX-License-Identifier: GPL-2.0 |
| 2 |
# |
| 3 |
# 64-bit vDSO images for x86. |
| 4 |
# |
| 5 |
|
| 6 |
# The vDSOs built in this directory |
| 7 |
vdsos-y := 64 |
| 8 |
vdsos-$(CONFIG_X86_X32_ABI) += x32 |
| 9 |
|
| 10 |
# Files to link into the vDSO: |
| 11 |
vobjs-y := note.o vclock_gettime.o vgetcpu.o |
| 12 |
vobjs-y += vgetrandom.o vgetrandom-chacha.o |
| 13 |
vobjs-$(CONFIG_X86_SGX) += vsgx.o |
| 14 |
|
| 15 |
# Compilation flags |
| 16 |
flags-y := -DBUILD_VDSO64 -m64 -mcmodel=small |
| 17 |
|
| 18 |
# The location of this include matters! |
| 19 |
include $(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. |
| 32 |
quiet_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 |
|
| 38 |
vobjsx32 = $(patsubst %.o,%-x32.o,$(vobjs)) |
| 39 |
targets += $(patsubst %.o,%-x32.o,$(vobjs-y)) |
| 40 |
|
| 41 |
# Linker options for the vdso |
| 42 |
VDSO_LDFLAGS_64 := -m elf_x86_64 -soname linux-vdso.so.1 -z max-page-size=4096 |
| 43 |
VDSO_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) |