aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/module.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-05-21 17:40:53 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-05-21 17:40:53 +0000
commit4deaeac3c56624cbe15e4c7b626967e77ef4f72e (patch)
tree95a677569e2d76f5f4046cf6d8e67adcb770f32c /sys/sys/module.h
parent6a11fa4e312edfbf6635225199e346c5336ab482 (diff)
downloadsrc-4deaeac3c56624cbe15e4c7b626967e77ef4f72e.tar.gz
src-4deaeac3c56624cbe15e4c7b626967e77ef4f72e.zip
Ensure that the static structs emitted by the MODULE_DEPEND() and
MODULE_VERSION() macros don't end up as .comm symbols, when all the version fields are zero. Normally, such symbols will end up in .bss, but for kernel module version objects, this can lead to "garbage" version numbers. Fix this by instructing the compiler to always put these structs in the .data segment instead. Reported by: delphij, ae MFC after: 1 week
Notes
Notes: svn path=/head/; revision=283254
Diffstat (limited to 'sys/sys/module.h')
-rw-r--r--sys/sys/module.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/sys/module.h b/sys/sys/module.h
index 69b74ffab61e..4582bf927cb1 100644
--- a/sys/sys/module.h
+++ b/sys/sys/module.h
@@ -107,7 +107,8 @@ struct mod_metadata {
DATA_SET(modmetadata_set, _mod_metadata##uniquifier)
#define MODULE_DEPEND(module, mdepend, vmin, vpref, vmax) \
- static struct mod_depend _##module##_depend_on_##mdepend = { \
+ static struct mod_depend _##module##_depend_on_##mdepend \
+ __section(".data") = { \
vmin, \
vpref, \
vmax \
@@ -147,7 +148,8 @@ struct mod_metadata {
DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, __FreeBSD_version)
#define MODULE_VERSION(module, version) \
- static struct mod_version _##module##_version = { \
+ static struct mod_version _##module##_version \
+ __section(".data") = { \
version \
}; \
MODULE_METADATA(_##module##_version, MDT_VERSION, \