Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62926
b: refs/heads/master
c: cb7e51d
h: refs/heads/master
v: v3
  • Loading branch information
Sam Ravnborg committed Jul 25, 2007
1 parent 9b3377a commit 32ac715
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 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: 83cda2bb37cb8476cd84659d9698ab48553be974
refs/heads/master: cb7e51d8b1f8e2390970f4bb7d095c414b1bf3cf
30 changes: 24 additions & 6 deletions trunk/scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static int data_section(const char *name)
* Pattern 0:
* Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
* The pattern is identified by:
* fromsec = .text.init.refok | .data.init.refok
* fromsec = .text.init.refok* | .data.init.refok*
*
* Pattern 1:
* If a module parameter is declared __initdata and permissions=0
Expand Down Expand Up @@ -675,11 +675,18 @@ static int data_section(const char *name)
* This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext
*
* Pattern 5:
* Xtensa uses literal sections for constants that are accessed PC-relative.
* Literal sections may safely reference their text sections.
* (Note that the name for the literal section omits any trailing '.text')
* tosec = <section>[.text]
* fromsec = <section>.literal
**/
static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
const char *refsymname)
{
int len;
const char **s;
const char *pat2sym[] = {
"driver",
Expand All @@ -701,8 +708,8 @@ static int secref_whitelist(const char *modname, const char *tosec,
};

/* Check for pattern 0 */
if ((strcmp(fromsec, ".text.init.refok") == 0) ||
(strcmp(fromsec, ".data.init.refok") == 0))
if ((strncmp(fromsec, ".text.init.refok", strlen(".text.init.refok")) == 0) ||
(strncmp(fromsec, ".data.init.refok", strlen(".data.init.refok")) == 0))
return 1;

/* Check for pattern 1 */
Expand All @@ -728,6 +735,15 @@ static int secref_whitelist(const char *modname, const char *tosec,
if (strcmp(refsymname, *s) == 0)
return 1;

/* Check for pattern 5 */
if (strrcmp(tosec, ".text") == 0)
len = strlen(tosec) - strlen(".text");
else
len = strlen(tosec);
if ((strncmp(tosec, fromsec, len) == 0) && (strlen(fromsec) > len) &&
(strcmp(fromsec + len, ".literal") == 0))
return 1;

return 0;
}

Expand Down Expand Up @@ -856,9 +872,9 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
refsymname = elf->strtab + refsym->st_name;

/* check whitelist - we may ignore it */
if (before &&
secref_whitelist(modname, secname, fromsec,
elf->strtab + before->st_name, refsymname))
if (secref_whitelist(modname, secname, fromsec,
before ? elf->strtab + before->st_name : "",
refsymname))
return;

if (before && after) {
Expand Down Expand Up @@ -1111,6 +1127,8 @@ static int initexit_section_ref_ok(const char *name)
".smp_locks",
".stab",
".m68k_fixup",
".xt.prop", /* xtensa informational section */
".xt.lit", /* xtensa informational section */
NULL
};
/* Start of section names */
Expand Down

0 comments on commit 32ac715

Please sign in to comment.