Re: [PATCH v3] riscv: explicitly use symbol offsets for VDSO

From: Andreas Schwab
Date: Wed Oct 27 2021 - 10:51:16 EST


On Aug 04 2021, Saleem Abdulrasool wrote:

> 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 <abdulras@xxxxxxxxxx>

I think this broke out-of-tree module builds.

https://build.opensuse.org/package/live_build_log/openSUSE:Factory:RISCV/rtl8812au/standard/riscv64

+ make -j4
make ARCH=riscv CROSS_COMPILE= -C /usr/src/linux-obj/riscv64/default M=/home/abuild/rpmbuild/BUILD/rtl8812au-5.9.3.2+git20210427.6ef5d8f/obj/default modules
make[1]: Entering directory '/usr/src/linux-5.14.14-1-obj/riscv64/default'
mkdir: cannot create directory 'arch/riscv/kernel': Permission denied
LDS arch/riscv/kernel/vdso/vdso.lds
AS arch/riscv/kernel/vdso/rt_sigreturn.o
CC arch/riscv/kernel/vdso/vgettimeofday.o
AS arch/riscv/kernel/vdso/getcpu.o
mkdir: cannot create directory 'arch/riscv/kernel': Permission denied
LDS arch/riscv/kernel/vdso/vdso.lds
AS arch/riscv/kernel/vdso/rt_sigreturn.o
CC arch/riscv/kernel/vdso/vgettimeofday.o
AS arch/riscv/kernel/vdso/getcpu.o
cc1: fatal error: opening output file arch/riscv/kernel/vdso/vdso.lds: No such file or directory
compilation terminated.
make[3]: *** [/usr/src/linux-5.14.14-1/scripts/Makefile.build:366: arch/riscv/kernel/vdso/vdso.lds] Error 1

Andreas.

--
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."