Date: Thu, 21 May 2015 17:40:54 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283254 - head/sys/sys Message-ID: <201505211740.t4LHesSg030310@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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, \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505211740.t4LHesSg030310>