svn commit: r283254 - head/sys/sys
Dimitry Andric
dim at FreeBSD.org
Thu May 21 17:40:54 UTC 2015
Author: dim
Date: Thu May 21 17:40:53 2015
New Revision: 283254
URL: https://svnweb.freebsd.org/changeset/base/283254
Log:
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
Modified:
head/sys/sys/module.h
Modified: head/sys/sys/module.h
==============================================================================
--- head/sys/sys/module.h Thu May 21 17:39:42 2015 (r283253)
+++ head/sys/sys/module.h Thu May 21 17:40:53 2015 (r283254)
@@ -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, \
More information about the svn-src-all
mailing list