aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c162
1 files changed, 120 insertions, 42 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f6127b9f5ac..253c107b9a9 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -14,6 +14,7 @@
14#define _GNU_SOURCE 14#define _GNU_SOURCE
15#include <stdio.h> 15#include <stdio.h>
16#include <ctype.h> 16#include <ctype.h>
17#include <string.h>
17#include "modpost.h" 18#include "modpost.h"
18#include "../../include/generated/autoconf.h" 19#include "../../include/generated/autoconf.h"
19#include "../../include/linux/license.h" 20#include "../../include/linux/license.h"
@@ -253,7 +254,7 @@ static enum export export_no(const char *s)
253 return export_unknown; 254 return export_unknown;
254} 255}
255 256
256static enum export export_from_sec(struct elf_info *elf, Elf_Section sec) 257static enum export export_from_sec(struct elf_info *elf, unsigned int sec)
257{ 258{
258 if (sec == elf->export_sec) 259 if (sec == elf->export_sec)
259 return export_plain; 260 return export_plain;
@@ -373,6 +374,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
373 Elf_Ehdr *hdr; 374 Elf_Ehdr *hdr;
374 Elf_Shdr *sechdrs; 375 Elf_Shdr *sechdrs;
375 Elf_Sym *sym; 376 Elf_Sym *sym;
377 const char *secstrings;
378 unsigned int symtab_idx = ~0U, symtab_shndx_idx = ~0U;
376 379
377 hdr = grab_file(filename, &info->size); 380 hdr = grab_file(filename, &info->size);
378 if (!hdr) { 381 if (!hdr) {
@@ -417,8 +420,27 @@ static int parse_elf(struct elf_info *info, const char *filename)
417 return 0; 420 return 0;
418 } 421 }
419 422
423 if (hdr->e_shnum == 0) {
424 /*
425 * There are more than 64k sections,
426 * read count from .sh_size.
427 * note: it doesn't need shndx2secindex()
428 */
429 info->num_sections = TO_NATIVE(sechdrs[0].sh_size);
430 }
431 else {
432 info->num_sections = hdr->e_shnum;
433 }
434 if (hdr->e_shstrndx == SHN_XINDEX) {
435 info->secindex_strings =
436 shndx2secindex(TO_NATIVE(sechdrs[0].sh_link));
437 }
438 else {
439 info->secindex_strings = hdr->e_shstrndx;
440 }
441
420 /* Fix endianness in section headers */ 442 /* Fix endianness in section headers */
421 for (i = 0; i < hdr->e_shnum; i++) { 443 for (i = 0; i < info->num_sections; i++) {
422 sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); 444 sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name);
423 sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type); 445 sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type);
424 sechdrs[i].sh_flags = TO_NATIVE(sechdrs[i].sh_flags); 446 sechdrs[i].sh_flags = TO_NATIVE(sechdrs[i].sh_flags);
@@ -431,9 +453,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
431 sechdrs[i].sh_entsize = TO_NATIVE(sechdrs[i].sh_entsize); 453 sechdrs[i].sh_entsize = TO_NATIVE(sechdrs[i].sh_entsize);
432 } 454 }
433 /* Find symbol table. */ 455 /* Find symbol table. */
434 for (i = 1; i < hdr->e_shnum; i++) { 456 secstrings = (void *)hdr + sechdrs[info->secindex_strings].sh_offset;
435 const char *secstrings 457 for (i = 1; i < info->num_sections; i++) {
436 = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
437 const char *secname; 458 const char *secname;
438 int nobits = sechdrs[i].sh_type == SHT_NOBITS; 459 int nobits = sechdrs[i].sh_type == SHT_NOBITS;
439 460
@@ -461,14 +482,26 @@ static int parse_elf(struct elf_info *info, const char *filename)
461 else if (strcmp(secname, "__ksymtab_gpl_future") == 0) 482 else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
462 info->export_gpl_future_sec = i; 483 info->export_gpl_future_sec = i;
463 484
464 if (sechdrs[i].sh_type != SHT_SYMTAB) 485 if (sechdrs[i].sh_type == SHT_SYMTAB) {
465 continue; 486 unsigned int sh_link_idx;
487 symtab_idx = i;
488 info->symtab_start = (void *)hdr +
489 sechdrs[i].sh_offset;
490 info->symtab_stop = (void *)hdr +
491 sechdrs[i].sh_offset + sechdrs[i].sh_size;
492 sh_link_idx = shndx2secindex(sechdrs[i].sh_link);
493 info->strtab = (void *)hdr +
494 sechdrs[sh_link_idx].sh_offset;
495 }
466 496
467 info->symtab_start = (void *)hdr + sechdrs[i].sh_offset; 497 /* 32bit section no. table? ("more than 64k sections") */
468 info->symtab_stop = (void *)hdr + sechdrs[i].sh_offset 498 if (sechdrs[i].sh_type == SHT_SYMTAB_SHNDX) {
469 + sechdrs[i].sh_size; 499 symtab_shndx_idx = i;
470 info->strtab = (void *)hdr + 500 info->symtab_shndx_start = (void *)hdr +
471 sechdrs[sechdrs[i].sh_link].sh_offset; 501 sechdrs[i].sh_offset;
502 info->symtab_shndx_stop = (void *)hdr +
503 sechdrs[i].sh_offset + sechdrs[i].sh_size;
504 }
472 } 505 }
473 if (!info->symtab_start) 506 if (!info->symtab_start)
474 fatal("%s has no symtab?\n", filename); 507 fatal("%s has no symtab?\n", filename);
@@ -480,6 +513,21 @@ static int parse_elf(struct elf_info *info, const char *filename)
480 sym->st_value = TO_NATIVE(sym->st_value); 513 sym->st_value = TO_NATIVE(sym->st_value);
481 sym->st_size = TO_NATIVE(sym->st_size); 514 sym->st_size = TO_NATIVE(sym->st_size);
482 } 515 }
516
517 if (symtab_shndx_idx != ~0U) {
518 Elf32_Word *p;
519 if (symtab_idx !=
520 shndx2secindex(sechdrs[symtab_shndx_idx].sh_link))
521 fatal("%s: SYMTAB_SHNDX has bad sh_link: %u!=%u\n",
522 filename,
523 shndx2secindex(sechdrs[symtab_shndx_idx].sh_link),
524 symtab_idx);
525 /* Fix endianness */
526 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop;
527 p++)
528 *p = TO_NATIVE(*p);
529 }
530
483 return 1; 531 return 1;
484} 532}
485 533
@@ -519,7 +567,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
519 Elf_Sym *sym, const char *symname) 567 Elf_Sym *sym, const char *symname)
520{ 568{
521 unsigned int crc; 569 unsigned int crc;
522 enum export export = export_from_sec(info, sym->st_shndx); 570 enum export export = export_from_sec(info, get_secindex(info, sym));
523 571
524 switch (sym->st_shndx) { 572 switch (sym->st_shndx) {
525 case SHN_COMMON: 573 case SHN_COMMON:
@@ -661,19 +709,19 @@ static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)
661 return "(unknown)"; 709 return "(unknown)";
662} 710}
663 711
664static const char *sec_name(struct elf_info *elf, int shndx) 712static const char *sec_name(struct elf_info *elf, int secindex)
665{ 713{
666 Elf_Shdr *sechdrs = elf->sechdrs; 714 Elf_Shdr *sechdrs = elf->sechdrs;
667 return (void *)elf->hdr + 715 return (void *)elf->hdr +
668 elf->sechdrs[elf->hdr->e_shstrndx].sh_offset + 716 elf->sechdrs[elf->secindex_strings].sh_offset +
669 sechdrs[shndx].sh_name; 717 sechdrs[secindex].sh_name;
670} 718}
671 719
672static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr) 720static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
673{ 721{
674 return (void *)elf->hdr + 722 return (void *)elf->hdr +
675 elf->sechdrs[elf->hdr->e_shstrndx].sh_offset + 723 elf->sechdrs[elf->secindex_strings].sh_offset +
676 sechdr->sh_name; 724 sechdr->sh_name;
677} 725}
678 726
679/* if sym is empty or point to a string 727/* if sym is empty or point to a string
@@ -742,6 +790,7 @@ static const char *section_white_list[] =
742{ 790{
743 ".comment*", 791 ".comment*",
744 ".debug*", 792 ".debug*",
793 ".GCC-command-line", /* mn10300 */
745 ".mdebug*", /* alpha, score, mips etc. */ 794 ".mdebug*", /* alpha, score, mips etc. */
746 ".pdr", /* alpha, score, mips etc. */ 795 ".pdr", /* alpha, score, mips etc. */
747 ".stab*", 796 ".stab*",
@@ -1052,11 +1101,14 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
1052 Elf_Sym *near = NULL; 1101 Elf_Sym *near = NULL;
1053 Elf64_Sword distance = 20; 1102 Elf64_Sword distance = 20;
1054 Elf64_Sword d; 1103 Elf64_Sword d;
1104 unsigned int relsym_secindex;
1055 1105
1056 if (relsym->st_name != 0) 1106 if (relsym->st_name != 0)
1057 return relsym; 1107 return relsym;
1108
1109 relsym_secindex = get_secindex(elf, relsym);
1058 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { 1110 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
1059 if (sym->st_shndx != relsym->st_shndx) 1111 if (get_secindex(elf, sym) != relsym_secindex)
1060 continue; 1112 continue;
1061 if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) 1113 if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
1062 continue; 1114 continue;
@@ -1118,9 +1170,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
1118 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { 1170 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
1119 const char *symsec; 1171 const char *symsec;
1120 1172
1121 if (sym->st_shndx >= SHN_LORESERVE) 1173 if (is_shndx_special(sym->st_shndx))
1122 continue; 1174 continue;
1123 symsec = sec_name(elf, sym->st_shndx); 1175 symsec = sec_name(elf, get_secindex(elf, sym));
1124 if (strcmp(symsec, sec) != 0) 1176 if (strcmp(symsec, sec) != 0)
1125 continue; 1177 continue;
1126 if (!is_valid_name(elf, sym)) 1178 if (!is_valid_name(elf, sym))
@@ -1167,7 +1219,7 @@ static char *sec2annotation(const char *s)
1167 strcat(p, " "); 1219 strcat(p, " ");
1168 return r; /* we leak her but we do not care */ 1220 return r; /* we leak her but we do not care */
1169 } else { 1221 } else {
1170 return ""; 1222 return strdup("");
1171 } 1223 }
1172} 1224}
1173 1225
@@ -1195,6 +1247,8 @@ static void report_sec_mismatch(const char *modname,
1195{ 1247{
1196 const char *from, *from_p; 1248 const char *from, *from_p;
1197 const char *to, *to_p; 1249 const char *to, *to_p;
1250 char *prl_from;
1251 char *prl_to;
1198 1252
1199 switch (from_is_func) { 1253 switch (from_is_func) {
1200 case 0: from = "variable"; from_p = ""; break; 1254 case 0: from = "variable"; from_p = ""; break;
@@ -1218,16 +1272,21 @@ static void report_sec_mismatch(const char *modname,
1218 1272
1219 switch (mismatch->mismatch) { 1273 switch (mismatch->mismatch) {
1220 case TEXT_TO_ANY_INIT: 1274 case TEXT_TO_ANY_INIT:
1275 prl_from = sec2annotation(fromsec);
1276 prl_to = sec2annotation(tosec);
1221 fprintf(stderr, 1277 fprintf(stderr,
1222 "The function %s%s() references\n" 1278 "The function %s%s() references\n"
1223 "the %s %s%s%s.\n" 1279 "the %s %s%s%s.\n"
1224 "This is often because %s lacks a %s\n" 1280 "This is often because %s lacks a %s\n"
1225 "annotation or the annotation of %s is wrong.\n", 1281 "annotation or the annotation of %s is wrong.\n",
1226 sec2annotation(fromsec), fromsym, 1282 prl_from, fromsym,
1227 to, sec2annotation(tosec), tosym, to_p, 1283 to, prl_to, tosym, to_p,
1228 fromsym, sec2annotation(tosec), tosym); 1284 fromsym, prl_to, tosym);
1285 free(prl_from);
1286 free(prl_to);
1229 break; 1287 break;
1230 case DATA_TO_ANY_INIT: { 1288 case DATA_TO_ANY_INIT: {
1289 prl_to = sec2annotation(tosec);
1231 const char *const *s = mismatch->symbol_white_list; 1290 const char *const *s = mismatch->symbol_white_list;
1232 fprintf(stderr, 1291 fprintf(stderr,
1233 "The variable %s references\n" 1292 "The variable %s references\n"
@@ -1235,20 +1294,24 @@ static void report_sec_mismatch(const char *modname,
1235 "If the reference is valid then annotate the\n" 1294 "If the reference is valid then annotate the\n"
1236 "variable with __init* or __refdata (see linux/init.h) " 1295 "variable with __init* or __refdata (see linux/init.h) "
1237 "or name the variable:\n", 1296 "or name the variable:\n",
1238 fromsym, to, sec2annotation(tosec), tosym, to_p); 1297 fromsym, to, prl_to, tosym, to_p);
1239 while (*s) 1298 while (*s)
1240 fprintf(stderr, "%s, ", *s++); 1299 fprintf(stderr, "%s, ", *s++);
1241 fprintf(stderr, "\n"); 1300 fprintf(stderr, "\n");
1301 free(prl_to);
1242 break; 1302 break;
1243 } 1303 }
1244 case TEXT_TO_ANY_EXIT: 1304 case TEXT_TO_ANY_EXIT:
1305 prl_to = sec2annotation(tosec);
1245 fprintf(stderr, 1306 fprintf(stderr,
1246 "The function %s() references a %s in an exit section.\n" 1307 "The function %s() references a %s in an exit section.\n"
1247 "Often the %s %s%s has valid usage outside the exit section\n" 1308 "Often the %s %s%s has valid usage outside the exit section\n"
1248 "and the fix is to remove the %sannotation of %s.\n", 1309 "and the fix is to remove the %sannotation of %s.\n",
1249 fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym); 1310 fromsym, to, to, tosym, to_p, prl_to, tosym);
1311 free(prl_to);
1250 break; 1312 break;
1251 case DATA_TO_ANY_EXIT: { 1313 case DATA_TO_ANY_EXIT: {
1314 prl_to = sec2annotation(tosec);
1252 const char *const *s = mismatch->symbol_white_list; 1315 const char *const *s = mismatch->symbol_white_list;
1253 fprintf(stderr, 1316 fprintf(stderr,
1254 "The variable %s references\n" 1317 "The variable %s references\n"
@@ -1256,24 +1319,31 @@ static void report_sec_mismatch(const char *modname,
1256 "If the reference is valid then annotate the\n" 1319 "If the reference is valid then annotate the\n"
1257 "variable with __exit* (see linux/init.h) or " 1320 "variable with __exit* (see linux/init.h) or "
1258 "name the variable:\n", 1321 "name the variable:\n",
1259 fromsym, to, sec2annotation(tosec), tosym, to_p); 1322 fromsym, to, prl_to, tosym, to_p);
1260 while (*s) 1323 while (*s)
1261 fprintf(stderr, "%s, ", *s++); 1324 fprintf(stderr, "%s, ", *s++);
1262 fprintf(stderr, "\n"); 1325 fprintf(stderr, "\n");
1326 free(prl_to);
1263 break; 1327 break;
1264 } 1328 }
1265 case XXXINIT_TO_SOME_INIT: 1329 case XXXINIT_TO_SOME_INIT:
1266 case XXXEXIT_TO_SOME_EXIT: 1330 case XXXEXIT_TO_SOME_EXIT:
1331 prl_from = sec2annotation(fromsec);
1332 prl_to = sec2annotation(tosec);
1267 fprintf(stderr, 1333 fprintf(stderr,
1268 "The %s %s%s%s references\n" 1334 "The %s %s%s%s references\n"
1269 "a %s %s%s%s.\n" 1335 "a %s %s%s%s.\n"
1270 "If %s is only used by %s then\n" 1336 "If %s is only used by %s then\n"
1271 "annotate %s with a matching annotation.\n", 1337 "annotate %s with a matching annotation.\n",
1272 from, sec2annotation(fromsec), fromsym, from_p, 1338 from, prl_from, fromsym, from_p,
1273 to, sec2annotation(tosec), tosym, to_p, 1339 to, prl_to, tosym, to_p,
1274 tosym, fromsym, tosym); 1340 tosym, fromsym, tosym);
1341 free(prl_from);
1342 free(prl_to);
1275 break; 1343 break;
1276 case ANY_INIT_TO_ANY_EXIT: 1344 case ANY_INIT_TO_ANY_EXIT:
1345 prl_from = sec2annotation(fromsec);
1346 prl_to = sec2annotation(tosec);
1277 fprintf(stderr, 1347 fprintf(stderr,
1278 "The %s %s%s%s references\n" 1348 "The %s %s%s%s references\n"
1279 "a %s %s%s%s.\n" 1349 "a %s %s%s%s.\n"
@@ -1282,11 +1352,15 @@ static void report_sec_mismatch(const char *modname,
1282 "uses functionality in the exit path.\n" 1352 "uses functionality in the exit path.\n"
1283 "The fix is often to remove the %sannotation of\n" 1353 "The fix is often to remove the %sannotation of\n"
1284 "%s%s so it may be used outside an exit section.\n", 1354 "%s%s so it may be used outside an exit section.\n",
1285 from, sec2annotation(fromsec), fromsym, from_p, 1355 from, prl_from, fromsym, from_p,
1286 to, sec2annotation(tosec), tosym, to_p, 1356 to, prl_to, tosym, to_p,
1287 sec2annotation(tosec), tosym, to_p); 1357 prl_to, tosym, to_p);
1358 free(prl_from);
1359 free(prl_to);
1288 break; 1360 break;
1289 case ANY_EXIT_TO_ANY_INIT: 1361 case ANY_EXIT_TO_ANY_INIT:
1362 prl_from = sec2annotation(fromsec);
1363 prl_to = sec2annotation(tosec);
1290 fprintf(stderr, 1364 fprintf(stderr,
1291 "The %s %s%s%s references\n" 1365 "The %s %s%s%s references\n"
1292 "a %s %s%s%s.\n" 1366 "a %s %s%s%s.\n"
@@ -1295,16 +1369,20 @@ static void report_sec_mismatch(const char *modname,
1295 "uses functionality in the init path.\n" 1369 "uses functionality in the init path.\n"
1296 "The fix is often to remove the %sannotation of\n" 1370 "The fix is often to remove the %sannotation of\n"
1297 "%s%s so it may be used outside an init section.\n", 1371 "%s%s so it may be used outside an init section.\n",
1298 from, sec2annotation(fromsec), fromsym, from_p, 1372 from, prl_from, fromsym, from_p,
1299 to, sec2annotation(tosec), tosym, to_p, 1373 to, prl_to, tosym, to_p,
1300 sec2annotation(tosec), tosym, to_p); 1374 prl_to, tosym, to_p);
1375 free(prl_from);
1376 free(prl_to);
1301 break; 1377 break;
1302 case EXPORT_TO_INIT_EXIT: 1378 case EXPORT_TO_INIT_EXIT:
1379 prl_to = sec2annotation(tosec);
1303 fprintf(stderr, 1380 fprintf(stderr,
1304 "The symbol %s is exported and annotated %s\n" 1381 "The symbol %s is exported and annotated %s\n"
1305 "Fix this by removing the %sannotation of %s " 1382 "Fix this by removing the %sannotation of %s "
1306 "or drop the export.\n", 1383 "or drop the export.\n",
1307 tosym, sec2annotation(tosec), sec2annotation(tosec), tosym); 1384 tosym, prl_to, prl_to, tosym);
1385 free(prl_to);
1308 break; 1386 break;
1309 } 1387 }
1310 fprintf(stderr, "\n"); 1388 fprintf(stderr, "\n");
@@ -1316,7 +1394,7 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
1316 const char *tosec; 1394 const char *tosec;
1317 const struct sectioncheck *mismatch; 1395 const struct sectioncheck *mismatch;
1318 1396
1319 tosec = sec_name(elf, sym->st_shndx); 1397 tosec = sec_name(elf, get_secindex(elf, sym));
1320 mismatch = section_mismatch(fromsec, tosec); 1398 mismatch = section_mismatch(fromsec, tosec);
1321 if (mismatch) { 1399 if (mismatch) {
1322 Elf_Sym *to; 1400 Elf_Sym *to;
@@ -1344,7 +1422,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
1344 Elf_Shdr *sechdr, Elf_Rela *r) 1422 Elf_Shdr *sechdr, Elf_Rela *r)
1345{ 1423{
1346 Elf_Shdr *sechdrs = elf->sechdrs; 1424 Elf_Shdr *sechdrs = elf->sechdrs;
1347 int section = sechdr->sh_info; 1425 int section = shndx2secindex(sechdr->sh_info);
1348 1426
1349 return (void *)elf->hdr + sechdrs[section].sh_offset + 1427 return (void *)elf->hdr + sechdrs[section].sh_offset +
1350 r->r_offset - sechdrs[section].sh_addr; 1428 r->r_offset - sechdrs[section].sh_addr;
@@ -1452,7 +1530,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
1452 r.r_addend = TO_NATIVE(rela->r_addend); 1530 r.r_addend = TO_NATIVE(rela->r_addend);
1453 sym = elf->symtab_start + r_sym; 1531 sym = elf->symtab_start + r_sym;
1454 /* Skip special sections */ 1532 /* Skip special sections */
1455 if (sym->st_shndx >= SHN_LORESERVE) 1533 if (is_shndx_special(sym->st_shndx))
1456 continue; 1534 continue;
1457 check_section_mismatch(modname, elf, &r, sym, fromsec); 1535 check_section_mismatch(modname, elf, &r, sym, fromsec);
1458 } 1536 }
@@ -1510,7 +1588,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1510 } 1588 }
1511 sym = elf->symtab_start + r_sym; 1589 sym = elf->symtab_start + r_sym;
1512 /* Skip special sections */ 1590 /* Skip special sections */
1513 if (sym->st_shndx >= SHN_LORESERVE) 1591 if (is_shndx_special(sym->st_shndx))
1514 continue; 1592 continue;
1515 check_section_mismatch(modname, elf, &r, sym, fromsec); 1593 check_section_mismatch(modname, elf, &r, sym, fromsec);
1516 } 1594 }
@@ -1535,7 +1613,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
1535 Elf_Shdr *sechdrs = elf->sechdrs; 1613 Elf_Shdr *sechdrs = elf->sechdrs;
1536 1614
1537 /* Walk through all sections */ 1615 /* Walk through all sections */
1538 for (i = 0; i < elf->hdr->e_shnum; i++) { 1616 for (i = 0; i < elf->num_sections; i++) {
1539 check_section(modname, elf, &elf->sechdrs[i]); 1617 check_section(modname, elf, &elf->sechdrs[i]);
1540 /* We want to process only relocation sections and not .init */ 1618 /* We want to process only relocation sections and not .init */
1541 if (sechdrs[i].sh_type == SHT_RELA) 1619 if (sechdrs[i].sh_type == SHT_RELA)