Commit 0d2a636ee6c3b8c292fbaae05976fe1537b70958
1 parent
bbd3f4fb84
Exists in
master
and in
7 other branches
modpost: pass around const struct sectioncheck * instead of enum mismatch
This prepares having a per-check whitelist of symbol names. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Showing 1 changed file with 9 additions and 7 deletions Side-by-side Diff
scripts/mod/modpost.c
... | ... | @@ -933,7 +933,8 @@ |
933 | 933 | } |
934 | 934 | }; |
935 | 935 | |
936 | -static int section_mismatch(const char *fromsec, const char *tosec) | |
936 | +static const struct sectioncheck *section_mismatch( | |
937 | + const char *fromsec, const char *tosec) | |
937 | 938 | { |
938 | 939 | int i; |
939 | 940 | int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck); |
940 | 941 | |
... | ... | @@ -942,10 +943,10 @@ |
942 | 943 | for (i = 0; i < elems; i++) { |
943 | 944 | if (match(fromsec, check->fromsec) && |
944 | 945 | match(tosec, check->tosec)) |
945 | - return check->mismatch; | |
946 | + return check; | |
946 | 947 | check++; |
947 | 948 | } |
948 | - return NO_MISMATCH; | |
949 | + return NULL; | |
949 | 950 | } |
950 | 951 | |
951 | 952 | /** |
... | ... | @@ -1158,7 +1159,8 @@ |
1158 | 1159 | * Try to find symbols near it so user can find it. |
1159 | 1160 | * Check whitelist before warning - it may be a false positive. |
1160 | 1161 | */ |
1161 | -static void report_sec_mismatch(const char *modname, enum mismatch mismatch, | |
1162 | +static void report_sec_mismatch(const char *modname, | |
1163 | + const struct sectioncheck *mismatch, | |
1162 | 1164 | const char *fromsec, |
1163 | 1165 | unsigned long long fromaddr, |
1164 | 1166 | const char *fromsym, |
... | ... | @@ -1189,7 +1191,7 @@ |
1189 | 1191 | modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, |
1190 | 1192 | tosym, to_p); |
1191 | 1193 | |
1192 | - switch (mismatch) { | |
1194 | + switch (mismatch->mismatch) { | |
1193 | 1195 | case TEXT_TO_ANY_INIT: |
1194 | 1196 | fprintf(stderr, |
1195 | 1197 | "The function %s%s() references\n" |
1196 | 1198 | |
... | ... | @@ -1289,11 +1291,11 @@ |
1289 | 1291 | Elf_Rela *r, Elf_Sym *sym, const char *fromsec) |
1290 | 1292 | { |
1291 | 1293 | const char *tosec; |
1292 | - enum mismatch mismatch; | |
1294 | + const struct sectioncheck *mismatch; | |
1293 | 1295 | |
1294 | 1296 | tosec = sec_name(elf, sym->st_shndx); |
1295 | 1297 | mismatch = section_mismatch(fromsec, tosec); |
1296 | - if (mismatch != NO_MISMATCH) { | |
1298 | + if (mismatch) { | |
1297 | 1299 | Elf_Sym *to; |
1298 | 1300 | Elf_Sym *from; |
1299 | 1301 | const char *tosym; |