Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45460
b: refs/heads/master
c: ee6a854
h: refs/heads/master
v: v3
  • Loading branch information
Vivek Goyal authored and Andi Kleen committed Jan 11, 2007
1 parent 76f1235 commit f274d06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 118c0ace1b61433311ae4e067fdd32841baa7f91
refs/heads/master: ee6a8545a4cbc620625c7956c95aac513842156b
26 changes: 24 additions & 2 deletions trunk/scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,19 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.text | .exit.text | .init.data
* fromsec = .data
* atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one
*
* Pattern 3:
* 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
* if init section is freed, its ok to reference those symbols.
* For ex. symbols marking the init section boundaries.
* This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext
**/
static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym)
const char *fromsec, const char *atsym,
const char *refsymname)
{
int f1 = 1, f2 = 1;
const char **s;
Expand All @@ -599,6 +609,13 @@ static int secref_whitelist(const char *modname, const char *tosec,
NULL
};

const char *pat3refsym[] = {
"__init_begin",
"_sinittext",
"_einittext",
NULL
};

/* Check for pattern 1 */
if (strcmp(tosec, ".init.data") != 0)
f1 = 0;
Expand Down Expand Up @@ -629,6 +646,11 @@ static int secref_whitelist(const char *modname, const char *tosec,
if ((strcmp(fromsec, ".pci_fixup") == 0) &&
(strcmp(tosec, ".init.text") == 0))
return 1;

/* Check for pattern 3 */
for (s = pat3refsym; *s; s++)
if (strcmp(refsymname, *s) == 0)
return 1;
}
return 0;
}
Expand Down Expand Up @@ -738,7 +760,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
/* check whitelist - we may ignore it */
if (before &&
secref_whitelist(modname, secname, fromsec,
elf->strtab + before->st_name))
elf->strtab + before->st_name, refsymname))
return;

if (before && after) {
Expand Down

0 comments on commit f274d06

Please sign in to comment.