From fde9c59aebafb91caeed816cc510b56f14aa63ae Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 4 Aug 2021 17:32:14 +0000 Subject: riscv: explicitly use symbol offsets for VDSO The current implementation of the `__rt_sigaction` reference computed an absolute offset relative to the mapped base of the VDSO. While this can be handled in the medlow model, the medany model cannot handle this as it is meant to be position independent. The current implementation relied on the BFD linker relaxing the PC-relative relocation into an absolute relocation as it was a near-zero address allowing it to be referenced relative to `zero`. We now extract the offsets and create a generated header allowing the build with LLVM and lld to succeed as we no longer depend on the linker rewriting address references near zero. This change was largely modelled after the ARM64 target which does something similar. Signed-off-by: Saleem Abdulrasool Tested-by: Nathan Chancellor Signed-off-by: Palmer Dabbelt --- arch/riscv/Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/riscv/Makefile') diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index bc74afdbf31e..e026b2d0a5a4 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -108,6 +108,10 @@ PHONY += vdso_install vdso_install: $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ +prepare: vdso_prepare +vdso_prepare: prepare0 + $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso include/generated/vdso-offsets.h + ifneq ($(CONFIG_XIP_KERNEL),y) ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN),yy) KBUILD_IMAGE := $(boot)/loader.bin -- cgit v1.2.1 From a290f510a178830a01bfc06e66a54bbe4ece5d2a Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 25 Aug 2021 22:52:45 -0700 Subject: RISC-V: Fix VDSO build for !MMU We don't have a VDSO for the !MMU configurations, so don't try to build one. Fixes: fde9c59aebaf ("riscv: explicitly use symbol offsets for VDSO") Signed-off-by: Palmer Dabbelt --- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/riscv/Makefile') diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index e026b2d0a5a4..83ee0e71204c 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -108,9 +108,11 @@ PHONY += vdso_install vdso_install: $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ +ifeq ($(CONFIG_MMU),y) prepare: vdso_prepare vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso include/generated/vdso-offsets.h +endif ifneq ($(CONFIG_XIP_KERNEL),y) ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN),yy) -- cgit v1.2.1