提交 1d8af559 编写于 作者: S Sam Ravnborg

kbuild: consolidate section checks

Move more checks from whitelist to the section check functions.
Remove the redundent pci_fixup check.
Renumber the patterns.
No functional changes.
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
上级 1087247b
......@@ -612,14 +612,10 @@ static int strrcmp(const char *s, const char *sub)
* atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console
*
* Pattern 3:
* Whitelist all references from .pci_fixup* section to .init.text
* This is part of the PCI init when built-in
*
* Pattern 4:
* Whitelist all refereces from .text.head to .init.data
* Whitelist all refereces from .text.head to .init.text
*
* Pattern 5:
* Pattern 4:
* Some symbols belong to init section but still it is ok to reference
* these from non-init sections as these symbols don't have any memory
* allocated for them and symbol address and value are same. So even
......@@ -628,7 +624,7 @@ static int strrcmp(const char *s, const char *sub)
* This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext
*
* Pattern 7:
* Pattern 5:
* Logos used in drivers/video/logo reside in __initdata but the
* funtion that references them are EXPORT_SYMBOL() so cannot be
* marker __init. So we whitelist them here.
......@@ -636,12 +632,6 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.data
* fromsec = .text*
* refsymname = logo_
*
* Pattern 10:
* ia64 has machvec table for each platform and
* powerpc has a machine desc table for each platform.
* It is mixture of function pointers of .init.text and .text.
* fromsec = .machvec | .machine.desc
**/
static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
......@@ -699,32 +689,22 @@ static int secref_whitelist(const char *modname, const char *tosec,
return 1;
/* Check for pattern 3 */
if ((strncmp(fromsec, ".pci_fixup", strlen(".pci_fixup")) == 0) &&
(strcmp(tosec, ".init.text") == 0))
return 1;
/* Check for pattern 4 */
if ((strcmp(fromsec, ".text.head") == 0) &&
((strcmp(tosec, ".init.data") == 0) ||
(strcmp(tosec, ".init.text") == 0)))
return 1;
/* Check for pattern 5 */
/* Check for pattern 4 */
for (s = pat3refsym; *s; s++)
if (strcmp(refsymname, *s) == 0)
return 1;
/* Check for pattern 7 */
/* Check for pattern 5 */
if ((strcmp(tosec, ".init.data") == 0) &&
(strncmp(fromsec, ".text", strlen(".text")) == 0) &&
(strncmp(refsymname, "logo_", strlen("logo_")) == 0))
return 1;
/* Check for pattern 10 */
if ((strcmp(fromsec, ".machvec") == 0) ||
(strcmp(fromsec, ".machine.desc") == 0))
return 1;
return 0;
}
......@@ -1088,7 +1068,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
* section, not the ia64 .opd section.
* ia64 .opd should not point to discarded sections.
* [.rodata] like for .init.text we ignore .rodata references -same reason
**/
*/
static int initexit_section_ref_ok(const char *name)
{
const char **s;
......@@ -1099,6 +1079,8 @@ static int initexit_section_ref_ok(const char *name)
".altinstructions",
".cranges", /* used by sh64 */
".fixup",
".machvec", /* ia64 + powerpc uses these */
".machine.desc",
".opd", /* See comment [OPD] */
".parainstructions",
".pdr",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册