Commit 1d8af559 authored by Sam Ravnborg's avatar 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: default avatarSam Ravnborg <sam@ravnborg.org>
parent 1087247b
...@@ -612,14 +612,10 @@ static int strrcmp(const char *s, const char *sub) ...@@ -612,14 +612,10 @@ static int strrcmp(const char *s, const char *sub)
* atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console
* *
* Pattern 3: * 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.data
* Whitelist all refereces from .text.head to .init.text * 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 * 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 * 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 * 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) ...@@ -628,7 +624,7 @@ static int strrcmp(const char *s, const char *sub)
* This pattern is identified by * This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext * refsymname = __init_begin, _sinittext, _einittext
* *
* Pattern 7: * Pattern 5:
* Logos used in drivers/video/logo reside in __initdata but the * Logos used in drivers/video/logo reside in __initdata but the
* funtion that references them are EXPORT_SYMBOL() so cannot be * funtion that references them are EXPORT_SYMBOL() so cannot be
* marker __init. So we whitelist them here. * marker __init. So we whitelist them here.
...@@ -636,12 +632,6 @@ static int strrcmp(const char *s, const char *sub) ...@@ -636,12 +632,6 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.data * tosec = .init.data
* fromsec = .text* * fromsec = .text*
* refsymname = logo_ * 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, static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym, const char *fromsec, const char *atsym,
...@@ -699,32 +689,22 @@ static int secref_whitelist(const char *modname, const char *tosec, ...@@ -699,32 +689,22 @@ static int secref_whitelist(const char *modname, const char *tosec,
return 1; return 1;
/* Check for pattern 3 */ /* 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) && if ((strcmp(fromsec, ".text.head") == 0) &&
((strcmp(tosec, ".init.data") == 0) || ((strcmp(tosec, ".init.data") == 0) ||
(strcmp(tosec, ".init.text") == 0))) (strcmp(tosec, ".init.text") == 0)))
return 1; return 1;
/* Check for pattern 5 */ /* Check for pattern 4 */
for (s = pat3refsym; *s; s++) for (s = pat3refsym; *s; s++)
if (strcmp(refsymname, *s) == 0) if (strcmp(refsymname, *s) == 0)
return 1; return 1;
/* Check for pattern 7 */ /* Check for pattern 5 */
if ((strcmp(tosec, ".init.data") == 0) && if ((strcmp(tosec, ".init.data") == 0) &&
(strncmp(fromsec, ".text", strlen(".text")) == 0) && (strncmp(fromsec, ".text", strlen(".text")) == 0) &&
(strncmp(refsymname, "logo_", strlen("logo_")) == 0)) (strncmp(refsymname, "logo_", strlen("logo_")) == 0))
return 1; return 1;
/* Check for pattern 10 */
if ((strcmp(fromsec, ".machvec") == 0) ||
(strcmp(fromsec, ".machine.desc") == 0))
return 1;
return 0; return 0;
} }
...@@ -1088,7 +1068,7 @@ static void check_sec_ref(struct module *mod, const char *modname, ...@@ -1088,7 +1068,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
* section, not the ia64 .opd section. * section, not the ia64 .opd section.
* ia64 .opd should not point to discarded sections. * ia64 .opd should not point to discarded sections.
* [.rodata] like for .init.text we ignore .rodata references -same reason * [.rodata] like for .init.text we ignore .rodata references -same reason
**/ */
static int initexit_section_ref_ok(const char *name) static int initexit_section_ref_ok(const char *name)
{ {
const char **s; const char **s;
...@@ -1099,6 +1079,8 @@ static int initexit_section_ref_ok(const char *name) ...@@ -1099,6 +1079,8 @@ static int initexit_section_ref_ok(const char *name)
".altinstructions", ".altinstructions",
".cranges", /* used by sh64 */ ".cranges", /* used by sh64 */
".fixup", ".fixup",
".machvec", /* ia64 + powerpc uses these */
".machine.desc",
".opd", /* See comment [OPD] */ ".opd", /* See comment [OPD] */
".parainstructions", ".parainstructions",
".pdr", ".pdr",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment