From: Alistair Strachan <astrachan@google.com> Date: Wed, 23 May 2018 00:38:34 +0000 (-0700) Subject: x86: vdso: Fix leaky vdso linker with CC=clang. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=35b779802c2ee9f352dad1043db0e441cc69bb63;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git x86: vdso: Fix leaky vdso linker with CC=clang. The vdso{32,64}.so can fail to build when CC=clang when clang tries to find a suitable GCC toolchain to link these libraries with. /usr/bin/ld: arch/x86/entry/vdso/vclock_gettime.o: access beyond end of merged section (782) This happens because the host environment leaked into the CROSS_COMPILE environment due to the way clang searches for suitable GCC toolchains. Most of the time this goes unnoticed because the host linker is new enough to work anyway, but on this particular machine it was not. Extract the needed --target and --gcc-toolchain flags added in the top level Makefile from KBUILD_CFLAGS. Bug: 63889157 Change-Id: If7d4097d1d2eaf95f18d0295483bde8792a06844 Signed-off-by: Alistair Strachan <astrachan@google.com> --- diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index c366c0adeb40..f5c1007e2c40 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -172,7 +172,8 @@ quiet_cmd_vdso = VDSO $@ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \ - $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS) + $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS) \ + $(filter --target=% --gcc-toolchain=%,$(KBUILD_CFLAGS)) GCOV_PROFILE := n #