Skip to content

Commit cd54779

Browse files
Li Yangsravnborg
authored andcommitted
kbuild: add "Section mismatch" warning whitelist for powerpc
This patch fixes the following class of "Section mismatch" warnings when building powerpc platforms. WARNING: arch/powerpc/kernel/built-in.o - Section mismatch: reference to .init.data:.got2 from prom_entry (offset 0x0) WARNING: arch/powerpc/platforms/built-in.o - Section mismatch: reference to .init.text:mpc8313_rdb_probe from .machine.desc after 'mach_mpc8313_rdb' (at offset 0x4) .... Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent f892b7d commit cd54779

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎scripts/mod/modpost.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,10 @@ static int strrcmp(const char *s, const char *sub)
650650
* tosec = .init.text
651651
*
652652
* Pattern 10:
653-
* ia64 has machvec table for each platform. It is mixture of function
654-
* pointer of .init.text and .text.
655-
* fromsec = .machvec
653+
* ia64 has machvec table for each platform and
654+
* powerpc has a machine desc table for each platform.
655+
* It is mixture of function pointers of .init.text and .text.
656+
* fromsec = .machvec | .machine.desc
656657
**/
657658
static int secref_whitelist(const char *modname, const char *tosec,
658659
const char *fromsec, const char *atsym,
@@ -751,7 +752,8 @@ static int secref_whitelist(const char *modname, const char *tosec,
751752
return 1;
752753

753754
/* Check for pattern 10 */
754-
if (strcmp(fromsec, ".machvec") == 0)
755+
if ((strcmp(fromsec, ".machvec") == 0) ||
756+
(strcmp(fromsec, ".machine.desc") == 0))
755757
return 1;
756758

757759
return 0;
@@ -887,6 +889,11 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
887889
elf->strtab + before->st_name, refsymname))
888890
return;
889891

892+
/* fromsec whitelist - without a valid 'before'
893+
* powerpc has a GOT table in .got2 section */
894+
if (strcmp(fromsec, ".got2") == 0)
895+
return;
896+
890897
if (before && after) {
891898
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
892899
"(between '%s' and '%s')\n",

0 commit comments

Comments
 (0)