diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-04-12 22:03:19 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-04-14 17:08:29 +0300 |
commit | 9290e772baccecec324ae9f2e0b470f870c097de (patch) | |
tree | 86828d08565e97beab028c30081c984b0c03aecd /tools/objtool/include | |
parent | 246b2c85487a7bc5f6a09098e18a96506b1b55df (diff) | |
download | linux-9290e772baccecec324ae9f2e0b470f870c097de.tar.xz |
objtool: Add symbol iteration helpers
Add [sec_]for_each_sym() and use them.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/59023e5886ab125aa30702e633be7732b1acaa7e.1681325924.git.jpoimboe@kernel.org
Diffstat (limited to 'tools/objtool/include')
-rw-r--r-- | tools/objtool/include/objtool/elf.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index ad0024da262b..e1ca588eb69d 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -188,4 +188,13 @@ struct symbol *find_func_containing(struct section *sec, unsigned long offset); #define for_each_sec(file, sec) \ list_for_each_entry(sec, &file->elf->sections, list) +#define sec_for_each_sym(sec, sym) \ + list_for_each_entry(sym, &sec->symbol_list, list) + +#define for_each_sym(file, sym) \ + for (struct section *__sec, *__fake = (struct section *)1; \ + __fake; __fake = NULL) \ + for_each_sec(file, __sec) \ + sec_for_each_sym(__sec, sym) + #endif /* _OBJTOOL_ELF_H */ |