aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 598d54a0fefb..3f0380b8d8f7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -933,7 +933,8 @@ const struct sectioncheck sectioncheck[] = {
933} 933}
934}; 934};
935 935
936static int section_mismatch(const char *fromsec, const char *tosec) 936static const struct sectioncheck *section_mismatch(
937 const char *fromsec, const char *tosec)
937{ 938{
938 int i; 939 int i;
939 int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck); 940 int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck);
@@ -942,10 +943,10 @@ static int section_mismatch(const char *fromsec, const char *tosec)
942 for (i = 0; i < elems; i++) { 943 for (i = 0; i < elems; i++) {
943 if (match(fromsec, check->fromsec) && 944 if (match(fromsec, check->fromsec) &&
944 match(tosec, check->tosec)) 945 match(tosec, check->tosec))
945 return check->mismatch; 946 return check;
946 check++; 947 check++;
947 } 948 }
948 return NO_MISMATCH; 949 return NULL;
949} 950}
950 951
951/** 952/**
@@ -1158,7 +1159,8 @@ static int is_function(Elf_Sym *sym)
1158 * Try to find symbols near it so user can find it. 1159 * Try to find symbols near it so user can find it.
1159 * Check whitelist before warning - it may be a false positive. 1160 * Check whitelist before warning - it may be a false positive.
1160 */ 1161 */
1161static void report_sec_mismatch(const char *modname, enum mismatch mismatch, 1162static void report_sec_mismatch(const char *modname,
1163 const struct sectioncheck *mismatch,
1162 const char *fromsec, 1164 const char *fromsec,
1163 unsigned long long fromaddr, 1165 unsigned long long fromaddr,
1164 const char *fromsym, 1166 const char *fromsym,
@@ -1189,7 +1191,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
1189 modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, 1191 modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec,
1190 tosym, to_p); 1192 tosym, to_p);
1191 1193
1192 switch (mismatch) { 1194 switch (mismatch->mismatch) {
1193 case TEXT_TO_ANY_INIT: 1195 case TEXT_TO_ANY_INIT:
1194 fprintf(stderr, 1196 fprintf(stderr,
1195 "The function %s%s() references\n" 1197 "The function %s%s() references\n"
@@ -1289,11 +1291,11 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
1289 Elf_Rela *r, Elf_Sym *sym, const char *fromsec) 1291 Elf_Rela *r, Elf_Sym *sym, const char *fromsec)
1290{ 1292{
1291 const char *tosec; 1293 const char *tosec;
1292 enum mismatch mismatch; 1294 const struct sectioncheck *mismatch;
1293 1295
1294 tosec = sec_name(elf, sym->st_shndx); 1296 tosec = sec_name(elf, sym->st_shndx);
1295 mismatch = section_mismatch(fromsec, tosec); 1297 mismatch = section_mismatch(fromsec, tosec);
1296 if (mismatch != NO_MISMATCH) { 1298 if (mismatch) {
1297 Elf_Sym *to; 1299 Elf_Sym *to;
1298 Elf_Sym *from; 1300 Elf_Sym *from;
1299 const char *tosym; 1301 const char *tosym;