Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2018 15:05:07 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336909 - in head/sys: net sys
Message-ID:  <201807301505.w6UF57Pa099658@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Jul 30 15:05:07 2018
New Revision: 336909
URL: https://svnweb.freebsd.org/changeset/base/336909

Log:
  As with DPCPU_DEFINE_STATIC make VNET_DEFINE_STATIC non-static on arm64 in
  modules. It also fails in the same way, we are unable to relocate static
  variables as the compiler uses PC-relative loads with nothing for the
  kernel linker to relocate.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/net/vnet.h
  head/sys/sys/pcpu.h

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Mon Jul 30 14:42:59 2018	(r336908)
+++ head/sys/net/vnet.h	Mon Jul 30 15:05:07 2018	(r336909)
@@ -273,8 +273,17 @@ extern struct sx vnet_sxlock;
 /* struct _hack is to stop this from being used with static data */
 #define	VNET_DEFINE(t, n)	\
     struct _hack; t VNET_NAME(n) __section(VNET_SETNAME) __used
+#if defined(KLD_MODULE) && defined(__aarch64__)
+/*
+ * As with DPCPU_DEFINE_STATIC we are unable to mark this data as static
+ * in modules on some architectures.
+ */
 #define	VNET_DEFINE_STATIC(t, n) \
+    t VNET_NAME(n) __section(VNET_SETNAME) __used
+#else
+#define	VNET_DEFINE_STATIC(t, n) \
     static t VNET_NAME(n) __section(VNET_SETNAME) __used
+#endif
 #define	_VNET_PTR(b, n)		(__typeof(VNET_NAME(n))*)		\
 				    ((b) + (uintptr_t)&VNET_NAME(n))
 

Modified: head/sys/sys/pcpu.h
==============================================================================
--- head/sys/sys/pcpu.h	Mon Jul 30 14:42:59 2018	(r336908)
+++ head/sys/sys/pcpu.h	Mon Jul 30 15:05:07 2018	(r336909)
@@ -97,7 +97,9 @@ extern uintptr_t dpcpu_off[];
  * wrong location.
  *
  * This is a workaround until a better solution can be found.
-*/
+ *
+ * VNET_DEFINE_STATIC also has the same workaround.
+ */
 #define	DPCPU_DEFINE_STATIC(t, n)	\
     t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
 #else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807301505.w6UF57Pa099658>