Commit 5ecdd0f6 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by Sam Ravnborg

kbuild: fix false section mismatch warnings

Darren Jenkins <darrenrjenkins@gmail.com> pointed out a
number of false positives where we referenced variables
from a _driver variable.
Fix it by check for that pattern and ignore it.

Randy.Dunlap <rdunlap@xenotime.net> pointed out a similar
set of warnings for a number of scsi drivers.
In scsi world they misname their variables *_template or
*_sht so add these to list of variables that may have references
to .init.text with no warning.

Randy.Dunlap <rdunlap@xenotime.net> also pointed out a scsi driver
with many references to .exit.text from .rodata. This is compiler
generated references and we already ignore these for .init.text, so
ignore them for .exit.text also.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent b5ac4817
......@@ -492,9 +492,9 @@ static int strrcmp(const char *s, const char *sub)
* These functions may often be marked __init and we do not want to
* warn here.
* the pattern is identified by:
* tosec = .init.text | .exit.text
* tosec = .init.text | .exit.text | .init.data
* fromsec = .data
* atsym = *_driver, *_ops, *_probe, *probe_one
* atsym = *_driver, *_template, *_sht, *_ops, *_probe, *probe_one
**/
static int secref_whitelist(const char *tosec, const char *fromsec,
const char *atsym)
......@@ -503,6 +503,8 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
const char **s;
const char *pat2sym[] = {
"_driver",
"_template", /* scsi uses *_template a lot */
"_sht", /* scsi also used *_sht to some extent */
"_ops",
"_probe",
"_probe_one",
......@@ -522,7 +524,8 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
/* Check for pattern 2 */
if ((strcmp(tosec, ".init.text") != 0) &&
(strcmp(tosec, ".exit.text") != 0))
(strcmp(tosec, ".exit.text") != 0) &&
(strcmp(tosec, ".init.data") != 0))
f2 = 0;
if (strcmp(fromsec, ".data") != 0)
f2 = 0;
......@@ -820,6 +823,7 @@ static int exit_section(const char *name)
* For our future {in}sanity, add a comment that this is the ppc .opd
* 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 exit_section_ref_ok(const char *name)
{
......@@ -829,6 +833,7 @@ static int exit_section_ref_ok(const char *name)
".exit.text",
".exit.data",
".init.text",
".rodata",
".opd", /* See comment [OPD] */
".toc1", /* used by ppc64 */
".altinstructions",
......
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