aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRuslan Bukin <br@FreeBSD.org>2018-09-12 08:05:33 +0000
committerRuslan Bukin <br@FreeBSD.org>2018-09-12 08:05:33 +0000
commit86c5937532768ce2936c70b1be159af4c11d35ef (patch)
tree26c0eecdb76facddb47f1306d0c110d6428a3a68 /sys
parentc9e562b188682eb9be39a8124893aa172b57d3ca (diff)
downloadsrc-86c5937532768ce2936c70b1be159af4c11d35ef.tar.gz
src-86c5937532768ce2936c70b1be159af4c11d35ef.zip
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
Notes
Notes: svn path=/head/; revision=338608
Diffstat (limited to 'sys')
-rw-r--r--sys/net/vnet.h2
-rw-r--r--sys/sys/pcpu.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/vnet.h b/sys/net/vnet.h
index 514519a327b1..b4168750e026 100644
--- a/sys/net/vnet.h
+++ b/sys/net/vnet.h
@@ -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.
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index d2084b77b3df..19bc4a8b9076 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -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