riscv: Add -fPIC option to CFLAGS_vgettimeofday.o
authorVincent Chen <vincent.chen@sifive.com>
Tue, 23 Jun 2020 01:13:22 +0000 (09:13 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 25 Jun 2020 21:58:59 +0000 (14:58 -0700)
The time related vDSO functions use a variable, vdso_data, to access the
vDSO data page to get the system time information. Because the vdso_data
for CFLAGS_vgettimeofday.o is an external variable defined in vdso.o,
the CFLAGS_vgettimeofday.o should be compiled with -fPIC to ensure
that vdso_data is addressable.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/vdso/Makefile

index 38ba55b..29cf052 100644 (file)
@@ -17,7 +17,7 @@ vdso-syms += flush_icache
 obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
 
 ifneq ($(c-gettimeofday-y),)
-  CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
+  CFLAGS_vgettimeofday.o += -fPIC -include $(c-gettimeofday-y)
 endif
 
 # Build rules