diff options
author | Quentin Casasnovas <quentin.casasnovas@oracle.com> | 2015-04-13 07:13:34 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-04-13 07:33:00 -0400 |
commit | 356ad538128ed9221f7d01199a3a7d080f158a5d (patch) | |
tree | f78d8a5836a83253f64f3bfd4c851f7c9b1d20a4 | |
parent | 644e8f14cb3bca5c66f6ddd944d9d26074eec46e (diff) |
modpost: factorize symbol pretty print in get_pretty_name().
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | scripts/mod/modpost.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0f48f8b97b17..c69681e815b2 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1270,6 +1270,15 @@ static void print_section_list(const char * const list[20]) | |||
1270 | fprintf(stderr, "\n"); | 1270 | fprintf(stderr, "\n"); |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | static inline void get_pretty_name(int is_func, const char** name, const char** name_p) | ||
1274 | { | ||
1275 | switch (is_func) { | ||
1276 | case 0: *name = "variable"; *name_p = ""; break; | ||
1277 | case 1: *name = "function"; *name_p = "()"; break; | ||
1278 | default: *name = "(unknown reference)"; *name_p = ""; break; | ||
1279 | } | ||
1280 | } | ||
1281 | |||
1273 | /* | 1282 | /* |
1274 | * Print a warning about a section mismatch. | 1283 | * Print a warning about a section mismatch. |
1275 | * Try to find symbols near it so user can find it. | 1284 | * Try to find symbols near it so user can find it. |
@@ -1289,21 +1298,13 @@ static void report_sec_mismatch(const char *modname, | |||
1289 | char *prl_from; | 1298 | char *prl_from; |
1290 | char *prl_to; | 1299 | char *prl_to; |
1291 | 1300 | ||
1292 | switch (from_is_func) { | ||
1293 | case 0: from = "variable"; from_p = ""; break; | ||
1294 | case 1: from = "function"; from_p = "()"; break; | ||
1295 | default: from = "(unknown reference)"; from_p = ""; break; | ||
1296 | } | ||
1297 | switch (to_is_func) { | ||
1298 | case 0: to = "variable"; to_p = ""; break; | ||
1299 | case 1: to = "function"; to_p = "()"; break; | ||
1300 | default: to = "(unknown reference)"; to_p = ""; break; | ||
1301 | } | ||
1302 | |||
1303 | sec_mismatch_count++; | 1301 | sec_mismatch_count++; |
1304 | if (!sec_mismatch_verbose) | 1302 | if (!sec_mismatch_verbose) |
1305 | return; | 1303 | return; |
1306 | 1304 | ||
1305 | get_pretty_name(from_is_func, &from, &from_p); | ||
1306 | get_pretty_name(to_is_func, &to, &to_p); | ||
1307 | |||
1307 | warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s " | 1308 | warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s " |
1308 | "to the %s %s:%s%s\n", | 1309 | "to the %s %s:%s%s\n", |
1309 | modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, | 1310 | modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, |