aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2018-07-05 17:13:37 +0000
committerAndrew Turner <andrew@FreeBSD.org>2018-07-05 17:13:37 +0000
commit2bf9501287cd79dfb3c0b558692ef2a9057a06a3 (patch)
treeed2eee92ee1eaadeb86a1db1877db3b64027e668 /sys/sys/pcpu.h
parent31ed2b3b0664ee4a9947c91ee7072e1281d5d3a4 (diff)
downloadsrc-2bf9501287cd79dfb3c0b558692ef2a9057a06a3.tar.gz
src-2bf9501287cd79dfb3c0b558692ef2a9057a06a3.zip
Create a new macro for static DPCPU data.
On arm64 (and possible other architectures) we are unable to use static DPCPU data in kernel modules. This is because the compiler will generate PC-relative accesses, however the runtime-linker expects to be able to relocate these. In preparation to fix this create two macros depending on if the data is global or static. Reviewed by: bz, emaste, markj Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D16140
Notes
Notes: svn path=/head/; revision=336007
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index a116b62d253e..127c10d6e110 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -81,7 +81,11 @@ extern uintptr_t dpcpu_off[];
*/
#define DPCPU_NAME(n) pcpu_entry_##n
#define DPCPU_DECLARE(t, n) extern t DPCPU_NAME(n)
-#define DPCPU_DEFINE(t, n) t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
+/* 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
+#define DPCPU_DEFINE_STATIC(t, n) \
+ static t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
/*
* Accessors with a given base.