summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-03-05 12:02:46 +0100
committerSam Ravnborg <sam@mars.ravnborg.org>2006-03-05 12:02:46 +0100
commit43c74d179596ba1f8eceb8c6a5c7e11afe233662 (patch)
tree09f7fcee82d8a464706b77e171956cc23661baf4 /scripts
parente835a39c1c1f023ef443f735b0e98b08660ae0e4 (diff)
downloadlinux-43c74d179596ba1f8eceb8c6a5c7e11afe233662.tar.gz
linux-43c74d179596ba1f8eceb8c6a5c7e11afe233662.tar.bz2
linux-43c74d179596ba1f8eceb8c6a5c7e11afe233662.zip
kbuild: in the section mismatch check try harder to find symbols
When searching for symbols the only check performed was if offset equals st_value. Adding an additional check to see if st_name points t a valid name made us sort out a few more false positives and let us report more correct names in warnings. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3b570b18c2e4..3648683a26c5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -558,7 +558,10 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
}
/*
- * Find symbols before or equal addr and after addr - in the section sec
+ * Find symbols before or equal addr and after addr - in the section sec.
+ * If we find two symbols with equal offset prefer one with a valid name.
+ * The ELF format may have a better way to detect what type of symbol
+ * it is, but this works for now.
**/
static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
const char *sec,
@@ -587,6 +590,12 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
beforediff = addr - sym->st_value;
*before = sym;
}
+ else if ((addr - sym->st_value) == beforediff) {
+ /* equal offset, valid name? */
+ const char *name = elf->strtab + sym->st_name;
+ if (name && strlen(name))
+ *before = sym;
+ }
}
else
{
@@ -594,6 +603,12 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
afterdiff = sym->st_value - addr;
*after = sym;
}
+ else if ((sym->st_value - addr) == afterdiff) {
+ /* equal offset, valid name? */
+ const char *name = elf->strtab + sym->st_name;
+ if (name && strlen(name))
+ *after = sym;
+ }
}
}
}