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:
br 2018-09-12 08:05:33 +00:00
parent 8f59931436
commit 4b45af7432
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