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
This commit is contained in:
Ruslan Bukin 2018-09-12 08:05:33 +00:00
parent c9e562b188
commit 86c5937532
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338608
2 changed files with 2 additions and 2 deletions

View File

@ -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.

View File

@ -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