* kbuild, modpost: fix "non-allocatable section" warnings
@ 2009-05-04 11:57 Sam Ravnborg
2009-05-04 11:59 ` [PATCH 1/3] kbuild, modpost: fix unexpected non-allocatable section when cross compiling Sam Ravnborg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sam Ravnborg @ 2009-05-04 11:57 UTC (permalink / raw)
To: LKML, linux-kbuild
Cc: Stephen Rothwell, Wolfgang Denk, Manuel Lauss, Anders Kaseorg,
linuxppc-dev, Sean MacLennan, Jean Delvare
It turned out there were at least three sources of
the "non-allocatable section" warning.
1) SUSE specific .comment section
2) endianness issues in elf header
3) additional debug sections
I have updated kbuild-fixes.git with
patches for all of the above.
But as we have seen three independent sources of this
warning within short time I expect there may be
yet-to-be-discovered issues.
The patches accumulated so far all looks trivially correct
and Jean and Sean has been quick to test them.
So unless something unexpected shows up I plan to push them
within a day or two.
I would like to see them in -next for a day or two first
in the hope that if other architectures has troubles
they will report this before it hits upstream.
Patches will follow for reference / testing.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] kbuild, modpost: fix unexpected non-allocatable section when cross compiling
2009-05-04 11:57 kbuild, modpost: fix "non-allocatable section" warnings Sam Ravnborg
@ 2009-05-04 11:59 ` Sam Ravnborg
2009-05-04 12:00 ` [PATCH 2/3] kbuild, modpost: fix "unexpected non-allocatable" warning with SUSE gcc Sam Ravnborg
2009-05-04 12:01 ` [PATCH 3/3] kbuild, modpost: fix unexpected non-allocatable warning with mips Sam Ravnborg
2 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2009-05-04 11:59 UTC (permalink / raw)
To: LKML, linux-kbuild
Cc: Stephen Rothwell, Wolfgang Denk, Manuel Lauss, Anders Kaseorg,
linuxppc-dev, Sean MacLennan, Jean Delvare
>From 7d875a02864a35532543897195dfea2235815df8 Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@MIT.EDU>
Date: Sun, 3 May 2009 22:02:55 +0200
Subject: [PATCH 1/3] kbuild, modpost: fix unexpected non-allocatable section when cross compiling
The missing TO_NATIVE(sechdrs[i].sh_flags) was causing many
unexpected non-allocatable section warnings when cross-compiling
for an architecture with a different endianness.
Fix endianness of all the fields in the ELF header and
section headers, not just some of them so we are not
hit by this anohter time.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reported-by: Sean MacLennan <smaclennan@pikatech.com>
Tested-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 936b6f8..a5c17db 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -384,11 +384,19 @@ static int parse_elf(struct elf_info *info, const char *filename)
return 0;
}
/* Fix endianness in ELF header */
- hdr->e_shoff = TO_NATIVE(hdr->e_shoff);
- hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx);
- hdr->e_shnum = TO_NATIVE(hdr->e_shnum);
- hdr->e_machine = TO_NATIVE(hdr->e_machine);
- hdr->e_type = TO_NATIVE(hdr->e_type);
+ hdr->e_type = TO_NATIVE(hdr->e_type);
+ hdr->e_machine = TO_NATIVE(hdr->e_machine);
+ hdr->e_version = TO_NATIVE(hdr->e_version);
+ hdr->e_entry = TO_NATIVE(hdr->e_entry);
+ hdr->e_phoff = TO_NATIVE(hdr->e_phoff);
+ hdr->e_shoff = TO_NATIVE(hdr->e_shoff);
+ hdr->e_flags = TO_NATIVE(hdr->e_flags);
+ hdr->e_ehsize = TO_NATIVE(hdr->e_ehsize);
+ hdr->e_phentsize = TO_NATIVE(hdr->e_phentsize);
+ hdr->e_phnum = TO_NATIVE(hdr->e_phnum);
+ hdr->e_shentsize = TO_NATIVE(hdr->e_shentsize);
+ hdr->e_shnum = TO_NATIVE(hdr->e_shnum);
+ hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx);
sechdrs = (void *)hdr + hdr->e_shoff;
info->sechdrs = sechdrs;
@@ -402,13 +410,16 @@ static int parse_elf(struct elf_info *info, const char *filename)
/* Fix endianness in section headers */
for (i = 0; i < hdr->e_shnum; i++) {
- sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type);
- sechdrs[i].sh_offset = TO_NATIVE(sechdrs[i].sh_offset);
- sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size);
- sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link);
- sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name);
- sechdrs[i].sh_info = TO_NATIVE(sechdrs[i].sh_info);
- sechdrs[i].sh_addr = TO_NATIVE(sechdrs[i].sh_addr);
+ sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name);
+ sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type);
+ sechdrs[i].sh_flags = TO_NATIVE(sechdrs[i].sh_flags);
+ sechdrs[i].sh_addr = TO_NATIVE(sechdrs[i].sh_addr);
+ sechdrs[i].sh_offset = TO_NATIVE(sechdrs[i].sh_offset);
+ sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size);
+ sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link);
+ sechdrs[i].sh_info = TO_NATIVE(sechdrs[i].sh_info);
+ sechdrs[i].sh_addralign = TO_NATIVE(sechdrs[i].sh_addralign);
+ sechdrs[i].sh_entsize = TO_NATIVE(sechdrs[i].sh_entsize);
}
/* Find symbol table. */
for (i = 1; i < hdr->e_shnum; i++) {
--
1.6.3.rc3.40.g75b44
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] kbuild, modpost: fix "unexpected non-allocatable" warning with SUSE gcc
2009-05-04 11:57 kbuild, modpost: fix "non-allocatable section" warnings Sam Ravnborg
2009-05-04 11:59 ` [PATCH 1/3] kbuild, modpost: fix unexpected non-allocatable section when cross compiling Sam Ravnborg
@ 2009-05-04 12:00 ` Sam Ravnborg
2009-05-04 12:01 ` [PATCH 3/3] kbuild, modpost: fix unexpected non-allocatable warning with mips Sam Ravnborg
2 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2009-05-04 12:00 UTC (permalink / raw)
To: LKML, linux-kbuild
Cc: Stephen Rothwell, Wolfgang Denk, Manuel Lauss, Anders Kaseorg,
linuxppc-dev, Sean MacLennan, Jean Delvare
>From 028ecebdd83cc4a7f8c7e96e28a5537d2ac98dae Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sun, 3 May 2009 22:17:37 +0200
Subject: [PATCH 2/3] kbuild, modpost: fix "unexpected non-allocatable" warning with SUSE gcc
Jean reported that he saw one warning for each module like the one below:
WARNING: arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.o (.comment.SUSE.OPTs): unexpected non-allocatable section.
The warning appeared with the improved version of the
check of the flags in the sections.
That check already ignored sections named ".comment" - but SUSE store
additional info in the comment section and has named it in a SUSE
specific way. Therefore modpost failed to ignore the section.
The fix is to extend the pattern so we ignore all sections
that start with the name ".comment.".
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reported-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Jean Delvare <khali@linux-fr.org>
---
scripts/mod/modpost.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a5c17db..268d457 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -727,7 +727,7 @@ int match(const char *sym, const char * const pat[])
/* sections that we do not want to do full section mismatch check on */
static const char *section_white_list[] =
- { ".comment", ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
+ { ".comment*", ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
/*
* This is used to find sections missing the SHF_ALLOC flag.
--
1.6.3.rc3.40.g75b44
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] kbuild, modpost: fix unexpected non-allocatable warning with mips
2009-05-04 11:57 kbuild, modpost: fix "non-allocatable section" warnings Sam Ravnborg
2009-05-04 11:59 ` [PATCH 1/3] kbuild, modpost: fix unexpected non-allocatable section when cross compiling Sam Ravnborg
2009-05-04 12:00 ` [PATCH 2/3] kbuild, modpost: fix "unexpected non-allocatable" warning with SUSE gcc Sam Ravnborg
@ 2009-05-04 12:01 ` Sam Ravnborg
2 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2009-05-04 12:01 UTC (permalink / raw)
To: LKML, linux-kbuild
Cc: Stephen Rothwell, Wolfgang Denk, Manuel Lauss, Anders Kaseorg,
linuxppc-dev, Sean MacLennan, Jean Delvare
>From 4391ed6aa9a38cdfb48addd7a9b24a2ff099b1a7 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Mon, 4 May 2009 13:05:26 +0200
Subject: [PATCH 3/3] kbuild, modpost: fix unexpected non-allocatable warning with mips
mips emit the following debug sections:
.mdebug* and .pdr
They were included in the check for non-allocatable section
and caused modpost to warn.
Manuel Lauss suggested to fix this by adding the relevant
sections to the list of sections we do not check.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reported-by: Manuel Lauss <mano@roarinelk.homelinux.net>
---
scripts/mod/modpost.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 268d457..161b784 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -727,7 +727,17 @@ int match(const char *sym, const char * const pat[])
/* sections that we do not want to do full section mismatch check on */
static const char *section_white_list[] =
- { ".comment*", ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
+{
+ ".comment*",
+ ".debug*",
+ ".mdebug*", /* alpha, score, mips etc. */
+ ".pdr", /* alpha, score, mips etc. */
+ ".stab*",
+ ".note*",
+ ".got*",
+ ".toc*",
+ NULL
+};
/*
* This is used to find sections missing the SHF_ALLOC flag.
--
1.6.3.rc3.40.g75b44
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-04 11:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-04 11:57 kbuild, modpost: fix "non-allocatable section" warnings Sam Ravnborg
2009-05-04 11:59 ` [PATCH 1/3] kbuild, modpost: fix unexpected non-allocatable section when cross compiling Sam Ravnborg
2009-05-04 12:00 ` [PATCH 2/3] kbuild, modpost: fix "unexpected non-allocatable" warning with SUSE gcc Sam Ravnborg
2009-05-04 12:01 ` [PATCH 3/3] kbuild, modpost: fix unexpected non-allocatable warning with mips Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).