summaryrefslogtreecommitdiff
path: root/tools/objtool/check.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2025-09-17 09:03:35 -0700
committerJosh Poimboeuf <jpoimboe@kernel.org>2025-10-14 14:45:25 -0700
commit96eceff331ea535b763b161df01300bbfd93b372 (patch)
treecbef885215be3a4ca4cccbb4835fc7d68ffbc394 /tools/objtool/check.c
parent72e4b6b44e9f53990315c6dd9fae2b2fc89c021a (diff)
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>
Diffstat (limited to 'tools/objtool/check.c')
-rw-r--r--tools/objtool/check.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 61e071c46ac2..dbc4fbdb77c4 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -106,7 +106,7 @@ static struct instruction *prev_insn_same_sym(struct objtool_file *file,
#define for_each_insn(file, insn) \
for (struct section *__sec, *__fake = (struct section *)1; \
__fake; __fake = NULL) \
- for_each_sec(file, __sec) \
+ for_each_sec(file->elf, __sec) \
sec_for_each_insn(file, __sec, insn)
#define func_for_each_insn(file, func, insn) \
@@ -431,7 +431,7 @@ static int decode_instructions(struct objtool_file *file)
unsigned long offset;
struct instruction *insn;
- for_each_sec(file, sec) {
+ for_each_sec(file->elf, sec) {
struct instruction *insns = NULL;
u8 prev_len = 0;
u8 idx = 0;
@@ -857,7 +857,7 @@ static int create_cfi_sections(struct objtool_file *file)
}
idx = 0;
- for_each_sym(file, sym) {
+ for_each_sym(file->elf, sym) {
if (sym->type != STT_FUNC)
continue;
@@ -873,7 +873,7 @@ static int create_cfi_sections(struct objtool_file *file)
return -1;
idx = 0;
- for_each_sym(file, sym) {
+ for_each_sym(file->elf, sym) {
if (sym->type != STT_FUNC)
continue;
@@ -2145,7 +2145,7 @@ static int add_jump_table_alts(struct objtool_file *file)
if (!file->rodata)
return 0;
- for_each_sym(file, func) {
+ for_each_sym(file->elf, func) {
if (func->type != STT_FUNC)
continue;
@@ -2451,7 +2451,7 @@ static int classify_symbols(struct objtool_file *file)
{
struct symbol *func;
- for_each_sym(file, func) {
+ for_each_sym(file->elf, func) {
if (func->type == STT_NOTYPE && strstarts(func->name, ".L"))
func->local_label = true;
@@ -2496,7 +2496,7 @@ static void mark_rodata(struct objtool_file *file)
*
* .rodata.str1.* sections are ignored; they don't contain jump tables.
*/
- for_each_sec(file, sec) {
+ for_each_sec(file->elf, sec) {
if ((!strncmp(sec->name, ".rodata", 7) &&
!strstr(sec->name, ".str1.")) ||
!strncmp(sec->name, ".data.rel.ro", 12)) {
@@ -4178,7 +4178,7 @@ static int add_prefix_symbols(struct objtool_file *file)
struct section *sec;
struct symbol *func;
- for_each_sec(file, sec) {
+ for_each_sec(file->elf, sec) {
if (!(sec->sh.sh_flags & SHF_EXECINSTR))
continue;
@@ -4270,7 +4270,7 @@ static int validate_functions(struct objtool_file *file)
struct section *sec;
int warnings = 0;
- for_each_sec(file, sec) {
+ for_each_sec(file->elf, sec) {
if (!(sec->sh.sh_flags & SHF_EXECINSTR))
continue;
@@ -4449,7 +4449,7 @@ static int validate_ibt(struct objtool_file *file)
for_each_insn(file, insn)
warnings += validate_ibt_insn(file, insn);
- for_each_sec(file, sec) {
+ for_each_sec(file->elf, sec) {
/* Already done by validate_ibt_insn() */
if (sec->sh.sh_flags & SHF_EXECINSTR)
@@ -4610,7 +4610,7 @@ static void disas_warned_funcs(struct objtool_file *file)
struct symbol *sym;
char *funcs = NULL, *tmp;
- for_each_sym(file, sym) {
+ for_each_sym(file->elf, sym) {
if (sym->warned) {
if (!funcs) {
funcs = malloc(strlen(sym->name) + 1);
@@ -4650,7 +4650,7 @@ static int check_abs_references(struct objtool_file *file)
struct reloc *reloc;
int ret = 0;
- for_each_sec(file, sec) {
+ for_each_sec(file->elf, sec) {
/* absolute references in non-loadable sections are fine */
if (!(sec->sh.sh_flags & SHF_ALLOC))
continue;