Date: Thu, 28 May 2015 06:45:15 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283642 - in stable: 10/sys/sys 7/sys/sys 8/sys/sys 9/sys/sys Message-ID: <201505280645.t4S6jF62024196@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Thu May 28 06:45:13 2015 New Revision: 283642 URL: https://svnweb.freebsd.org/changeset/base/283642 Log: MFC r283254: 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 Modified: stable/10/sys/sys/module.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/sys/sys/module.h stable/8/sys/sys/module.h stable/9/sys/sys/module.h Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/10/sys/sys/module.h ============================================================================== --- stable/10/sys/sys/module.h Thu May 28 05:38:07 2015 (r283641) +++ stable/10/sys/sys/module.h Thu May 28 06:45:13 2015 (r283642) @@ -106,7 +106,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 \ @@ -146,7 +147,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?201505280645.t4S6jF62024196>