* [PATCH] fix modpost warnings for xtensa
@ 2007-07-19 18:37 Chris Zankel
2007-07-19 21:00 ` Andrew Morton
2007-07-25 20:29 ` Sam Ravnborg
0 siblings, 2 replies; 4+ messages in thread
From: Chris Zankel @ 2007-07-19 18:37 UTC (permalink / raw)
To: akpm, torvalds; +Cc: chris, linux-kernel
[PATCH] fix modpost warnings for xtensa
The Xtensa architecture places literal pools in sections separate
from the instructions. The corresponsing text sections, therefore,
reference the .literal section, and we have to suppress those
warnings. The naming convention defines the name for a literal
section as .SECTION.literal, unless .SECTION is .text. In that case
the name is only .literal. Using strncmp() instead of strcmp()
to compare the from-section with .SECTION.init.refok in pattern 0
should not cause any regressions for other architectures.
We also need to suppress warnings for two informational
sections (.xt.lit and .xt.prop) used by the Xtensa architecture.
Signed-off-by: Chris Zankel <chris@zankel.net>
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3645e98..9061443 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -645,12 +645,20 @@ static int strrcmp(const char *s, const char *sub)
* powerpc has a machine desc table for each platform.
* It is mixture of function pointers of .init.text and .text.
* fromsec = .machvec | .machine.desc
+ *
+ * Pattern 11:
+ * Xtensa uses literal sections for constants that are accessed PC-relative.
+ * Literal sections may savely 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 f1 = 1, f2 = 1;
+ int len;
const char **s;
const char *pat2sym[] = {
"driver",
@@ -672,8 +680,10 @@ 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 */
@@ -733,6 +743,16 @@ static int secref_whitelist(const char *modname, const char *tosec,
(strcmp(fromsec, ".machine.desc") == 0))
return 1;
+
+ /* Check for pattern 11 */
+ len = strlen(tosec) - strlen(".text");
+ if (len <= 0 || strcmp(tosec + len, ".text") != 0)
+ len = strlen(tosec);
+ if (strncmp(tosec, fromsec, len) == 0
+ && (strlen(fromsec) > len)
+ && (strcmp(fromsec + len, ".literal") == 0))
+ return 1;
+
return 0;
}
@@ -858,10 +878,9 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
if (refsym && strlen(elf->strtab + refsym->st_name))
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;
/* fromsec whitelist - without a valid 'before'
@@ -1053,6 +1072,8 @@ static int init_section_ref_ok(const char *name)
"__ftr_fixup", /* powerpc cpu feature fixup */
"__fw_ftr_fixup", /* powerpc firmware feature fixup */
".cranges", /* used by sh64 */
+ ".xt.prop", /* xtensa informational section */
+ ".xt.lit", /* xtensa informational section */
NULL
};
/* Start of section names */
@@ -1134,6 +1155,8 @@ static int exit_section_ref_ok(const char *name)
".smp_locks",
".plt", /* seen on ARCH=um build on x86_64. Harmless */
".cranges", /* used by sh64 */
+ ".xt.prop", /* xtensa informational section */
+ ".xt.lit", /* xtensa informational section */
NULL
};
/* Start of section names */
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fix modpost warnings for xtensa
2007-07-19 18:37 [PATCH] fix modpost warnings for xtensa Chris Zankel
@ 2007-07-19 21:00 ` Andrew Morton
2007-07-19 21:10 ` Chris Zankel
2007-07-25 20:29 ` Sam Ravnborg
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2007-07-19 21:00 UTC (permalink / raw)
To: Chris Zankel; +Cc: torvalds, chris, linux-kernel
On Thu, 19 Jul 2007 11:37:56 -0700
Chris Zankel <czankel@tensilica.com> wrote:
>
> [PATCH] fix modpost warnings for xtensa
>
> The Xtensa architecture places literal pools in sections separate
> from the instructions. The corresponsing text sections, therefore,
> reference the .literal section, and we have to suppress those
> warnings. The naming convention defines the name for a literal
> section as .SECTION.literal, unless .SECTION is .text. In that case
> the name is only .literal. Using strncmp() instead of strcmp()
> to compare the from-section with .SECTION.init.refok in pattern 0
> should not cause any regressions for other architectures.
> We also need to suppress warnings for two informational
> sections (.xt.lit and .xt.prop) used by the Xtensa architecture.
This generates unfixable-by-me rejects against Sam's git-kbuild tree.
Sam already had a pull request into Linus for that tree. Could I ask
that you wait for that piece of dust to settle and then regenerate the
diff?
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix modpost warnings for xtensa
2007-07-19 21:00 ` Andrew Morton
@ 2007-07-19 21:10 ` Chris Zankel
0 siblings, 0 replies; 4+ messages in thread
From: Chris Zankel @ 2007-07-19 21:10 UTC (permalink / raw)
To: Andrew Morton; +Cc: Chris Zankel, torvalds, chris, linux-kernel, sam
Andrew,
Andrew Morton wrote:
> This generates unfixable-by-me rejects against Sam's git-kbuild tree.
> Sam already had a pull request into Linus for that tree. Could I ask
> that you wait for that piece of dust to settle and then regenerate the
> diff?
Thanks Andrew. I will wait for his updates.
-Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix modpost warnings for xtensa
2007-07-19 18:37 [PATCH] fix modpost warnings for xtensa Chris Zankel
2007-07-19 21:00 ` Andrew Morton
@ 2007-07-25 20:29 ` Sam Ravnborg
1 sibling, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2007-07-25 20:29 UTC (permalink / raw)
To: Chris Zankel; +Cc: akpm, torvalds, chris, linux-kernel
On Thu, Jul 19, 2007 at 11:37:56AM -0700, Chris Zankel wrote:
> [PATCH] fix modpost warnings for xtensa
>
> The Xtensa architecture places literal pools in sections separate
> from the instructions. The corresponsing text sections, therefore,
> reference the .literal section, and we have to suppress those
> warnings. The naming convention defines the name for a literal
> section as .SECTION.literal, unless .SECTION is .text. In that case
> the name is only .literal. Using strncmp() instead of strcmp()
> to compare the from-section with .SECTION.init.refok in pattern 0
> should not cause any regressions for other architectures.
> We also need to suppress warnings for two informational
> sections (.xt.lit and .xt.prop) used by the Xtensa architecture.
>
> Signed-off-by: Chris Zankel <chris@zankel.net>
Hi Chris,
I hand applied your patch and have pushed the following patch to kbuild.git.
I simplified it a bit and decided to break the 80 char limit..
Sam
>From cb7e51d8b1f8e2390970f4bb7d095c414b1bf3cf Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Wed, 25 Jul 2007 22:24:52 +0200
Subject: [PATCH] kbuild: fix modpost warnings for xtensa
The Xtensa architecture places literal pools in sections separate
from the instructions. The corresponsing text sections, therefore,
reference the .literal section, and we have to suppress those
warnings.
The naming convention defines the name for a literal
section as .SECTION.literal, unless .SECTION is .text. In that case
the name is only .literal. Using strncmp() instead of strcmp()
to compare the from-section with .SECTION.init.refok in pattern 0
should not cause any regressions for other architectures.
We also need to suppress warnings for two informational
sections (.xt.lit and .xt.prop) used by the Xtensa architecture.
Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3db4edc..ee58ded 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -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
@@ -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",
@@ -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 */
@@ -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;
}
@@ -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) {
@@ -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 */
--
1.5.1.rc3.g84b7-dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-25 20:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 18:37 [PATCH] fix modpost warnings for xtensa Chris Zankel
2007-07-19 21:00 ` Andrew Morton
2007-07-19 21:10 ` Chris Zankel
2007-07-25 20:29 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox