Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2018 08:05:34 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338608 - in head/sys: net sys
Message-ID:  <201809120805.w8C85YcP012403@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Wed Sep 12 08:05:33 2018
New Revision: 338608
URL: https://svnweb.freebsd.org/changeset/base/338608

Log:
  Don't mark module data as static on RISC-V.
  
  Similar to arm64, riscv compiler uses PC-relative loads/stores,
  and with static data compiler does not emit relocations.
  In result, kernel module linker has nothing to fix and data accessed
  from the wrong location.
  
  Approved by:	re (gjb)
  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	Wed Sep 12 05:08:49 2018	(r338607)
+++ head/sys/net/vnet.h	Wed Sep 12 08:05:33 2018	(r338608)
@@ -273,7 +273,7 @@ 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__)
+#if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv))
 /*
  * As with DPCPU_DEFINE_STATIC we are unable to mark this data as static
  * in modules on some architectures.

Modified: head/sys/sys/pcpu.h
==============================================================================
--- head/sys/sys/pcpu.h	Wed Sep 12 05:08:49 2018	(r338607)
+++ head/sys/sys/pcpu.h	Wed Sep 12 08:05:33 2018	(r338608)
@@ -84,7 +84,7 @@ extern uintptr_t dpcpu_off[];
 /* struct _hack is to stop this from being used with the static keyword. */
 #define	DPCPU_DEFINE(t, n)	\
     struct _hack; t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
-#if defined(KLD_MODULE) && defined(__aarch64__)
+#if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv))
 /*
  * On some architectures the compiler will use PC-relative load to
  * find the address of DPCPU data with the static keyword. We then



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