Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Convert elf iterator macros to use 'struct elf'

'struct objtool_file' is specific to the check code and doesn't belong
in the elf code which is supposed to be objtool_file-agnostic. Convert
the elf iterator macros to use 'struct elf' instead.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+17 -17
+12 -12
tools/objtool/check.c
··· 106 106 #define for_each_insn(file, insn) \ 107 107 for (struct section *__sec, *__fake = (struct section *)1; \ 108 108 __fake; __fake = NULL) \ 109 - for_each_sec(file, __sec) \ 109 + for_each_sec(file->elf, __sec) \ 110 110 sec_for_each_insn(file, __sec, insn) 111 111 112 112 #define func_for_each_insn(file, func, insn) \ ··· 431 431 unsigned long offset; 432 432 struct instruction *insn; 433 433 434 - for_each_sec(file, sec) { 434 + for_each_sec(file->elf, sec) { 435 435 struct instruction *insns = NULL; 436 436 u8 prev_len = 0; 437 437 u8 idx = 0; ··· 857 857 } 858 858 859 859 idx = 0; 860 - for_each_sym(file, sym) { 860 + for_each_sym(file->elf, sym) { 861 861 if (sym->type != STT_FUNC) 862 862 continue; 863 863 ··· 873 873 return -1; 874 874 875 875 idx = 0; 876 - for_each_sym(file, sym) { 876 + for_each_sym(file->elf, sym) { 877 877 if (sym->type != STT_FUNC) 878 878 continue; 879 879 ··· 2145 2145 if (!file->rodata) 2146 2146 return 0; 2147 2147 2148 - for_each_sym(file, func) { 2148 + for_each_sym(file->elf, func) { 2149 2149 if (func->type != STT_FUNC) 2150 2150 continue; 2151 2151 ··· 2451 2451 { 2452 2452 struct symbol *func; 2453 2453 2454 - for_each_sym(file, func) { 2454 + for_each_sym(file->elf, func) { 2455 2455 if (func->type == STT_NOTYPE && strstarts(func->name, ".L")) 2456 2456 func->local_label = true; 2457 2457 ··· 2496 2496 * 2497 2497 * .rodata.str1.* sections are ignored; they don't contain jump tables. 2498 2498 */ 2499 - for_each_sec(file, sec) { 2499 + for_each_sec(file->elf, sec) { 2500 2500 if ((!strncmp(sec->name, ".rodata", 7) && 2501 2501 !strstr(sec->name, ".str1.")) || 2502 2502 !strncmp(sec->name, ".data.rel.ro", 12)) { ··· 4178 4178 struct section *sec; 4179 4179 struct symbol *func; 4180 4180 4181 - for_each_sec(file, sec) { 4181 + for_each_sec(file->elf, sec) { 4182 4182 if (!(sec->sh.sh_flags & SHF_EXECINSTR)) 4183 4183 continue; 4184 4184 ··· 4270 4270 struct section *sec; 4271 4271 int warnings = 0; 4272 4272 4273 - for_each_sec(file, sec) { 4273 + for_each_sec(file->elf, sec) { 4274 4274 if (!(sec->sh.sh_flags & SHF_EXECINSTR)) 4275 4275 continue; 4276 4276 ··· 4449 4449 for_each_insn(file, insn) 4450 4450 warnings += validate_ibt_insn(file, insn); 4451 4451 4452 - for_each_sec(file, sec) { 4452 + for_each_sec(file->elf, sec) { 4453 4453 4454 4454 /* Already done by validate_ibt_insn() */ 4455 4455 if (sec->sh.sh_flags & SHF_EXECINSTR) ··· 4610 4610 struct symbol *sym; 4611 4611 char *funcs = NULL, *tmp; 4612 4612 4613 - for_each_sym(file, sym) { 4613 + for_each_sym(file->elf, sym) { 4614 4614 if (sym->warned) { 4615 4615 if (!funcs) { 4616 4616 funcs = malloc(strlen(sym->name) + 1); ··· 4650 4650 struct reloc *reloc; 4651 4651 int ret = 0; 4652 4652 4653 - for_each_sec(file, sec) { 4653 + for_each_sec(file->elf, sec) { 4654 4654 /* absolute references in non-loadable sections are fine */ 4655 4655 if (!(sec->sh.sh_flags & SHF_ALLOC)) 4656 4656 continue;
+4 -4
tools/objtool/include/objtool/elf.h
··· 325 325 reloc->_sym_next_reloc = (unsigned long)next | bit; 326 326 } 327 327 328 - #define for_each_sec(file, sec) \ 329 - list_for_each_entry(sec, &file->elf->sections, list) 328 + #define for_each_sec(elf, sec) \ 329 + list_for_each_entry(sec, &elf->sections, list) 330 330 331 331 #define sec_for_each_sym(sec, sym) \ 332 332 list_for_each_entry(sym, &sec->symbol_list, list) 333 333 334 - #define for_each_sym(file, sym) \ 334 + #define for_each_sym(elf, sym) \ 335 335 for (struct section *__sec, *__fake = (struct section *)1; \ 336 336 __fake; __fake = NULL) \ 337 - for_each_sec(file, __sec) \ 337 + for_each_sec(elf, __sec) \ 338 338 sec_for_each_sym(__sec, sym) 339 339 340 340 #define for_each_reloc(rsec, reloc) \
+1 -1
tools/objtool/orc_gen.c
··· 57 57 58 58 /* Build a deduplicated list of ORC entries: */ 59 59 INIT_LIST_HEAD(&orc_list); 60 - for_each_sec(file, sec) { 60 + for_each_sec(file->elf, sec) { 61 61 struct orc_entry orc, prev_orc = {0}; 62 62 struct instruction *insn; 63 63 bool empty = true;