linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/vdso: include generic __lshrdi3 in 32-bit vDSO
@ 2019-03-15 19:54 Matthias Kaehlcke
  2019-03-15 21:31 ` Nick Desaulniers
  2019-03-20 13:55 ` Masahiro Yamada
  0 siblings, 2 replies; 12+ messages in thread
From: Matthias Kaehlcke @ 2019-03-15 19:54 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H . Peter Anvin
  Cc: x86, linux-kernel, Nick Desaulniers, Manoj Gupta, Tiancong Wang,
	Stephen Hines, clang-built-linux, Matthias Kaehlcke

Building the 32-bit vDSO with a recent clang version fails due
to undefined symbols:

arch/x86/entry/vdso/vdso32.so.dbg: undefined symbols found

The undefined symbol in this case is __lshrdi3, which is part of
the compiler runtime library, however the vDSO isn't linked against
this library.

Include the kernel version of __lshrdi3 in the 32-bit vDSO build.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 arch/x86/entry/vdso/Makefile | 7 ++++++-
 lib/lshrdi3.c                | 4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 5bfe2243a08f..7517cd87e10b 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -144,6 +144,7 @@ KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector)
 KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls)
 KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
 KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
+KBUILD_CFLAGS_32 += -DBUILD_VDSO

 ifdef CONFIG_RETPOLINE
 ifneq ($(RETPOLINE_VDSO_CFLAGS),)
@@ -153,12 +154,16 @@ endif

 $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)

+$(obj)/vdso32/lshrdi3.o: $(srctree)/lib/lshrdi3.c FORCE
+	$(call if_changed_rule,cc_o_c)
+
 $(obj)/vdso32.so.dbg: FORCE \
 		      $(obj)/vdso32/vdso32.lds \
 		      $(obj)/vdso32/vclock_gettime.o \
 		      $(obj)/vdso32/note.o \
 		      $(obj)/vdso32/system_call.o \
-		      $(obj)/vdso32/sigreturn.o
+		      $(obj)/vdso32/sigreturn.o \
+		      $(obj)/vdso32/lshrdi3.o
 	$(call if_changed,vdso)

 #
diff --git a/lib/lshrdi3.c b/lib/lshrdi3.c
index 99cfa5721f2d..8a4fc6bcf3a4 100644
--- a/lib/lshrdi3.c
+++ b/lib/lshrdi3.c
@@ -16,7 +16,7 @@
  * to the Free Software Foundation, Inc.
  */

-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/libgcc.h>

 long long notrace __lshrdi3(long long u, word_type b)
@@ -42,4 +42,6 @@ long long notrace __lshrdi3(long long u, word_type b)

 	return w.ll;
 }
+#ifndef BUILD_VDSO
 EXPORT_SYMBOL(__lshrdi3);
+#endif
-- 
2.21.0.360.g471c308f928-goog

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-03-20 15:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 19:54 [PATCH] x86/vdso: include generic __lshrdi3 in 32-bit vDSO Matthias Kaehlcke
2019-03-15 21:31 ` Nick Desaulniers
2019-03-15 22:29   ` Matthias Kaehlcke
2019-03-15 23:18     ` hpa
2019-03-18  8:59       ` Peter Zijlstra
2019-03-18 17:09     ` Nick Desaulniers
2019-03-18 17:16       ` Peter Zijlstra
2019-03-18 20:44         ` Matthias Kaehlcke
2019-03-18 23:03           ` Peter Zijlstra
2019-03-20 14:06   ` Masahiro Yamada
2019-03-20 13:55 ` Masahiro Yamada
2019-03-20 15:45   ` Matthias Kaehlcke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).