1
0

Merge tag 'objtool-core-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool updates from Ingo Molnar:

 - Speed up SHT_GROUP reindexing (Josh Poimboeuf)

 - Fix up st_info in COMDAT group section (Rong Xu)

* tag 'objtool-core-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Speed up SHT_GROUP reindexing
  objtool: Fix up st_info in COMDAT group section
This commit is contained in:
Linus Torvalds
2025-05-26 15:13:53 -07:00
2 changed files with 38 additions and 1 deletions

View File

@@ -572,6 +572,34 @@ err:
return -1;
}
static int mark_group_syms(struct elf *elf)
{
struct section *symtab, *sec;
struct symbol *sym;
symtab = find_section_by_name(elf, ".symtab");
if (!symtab) {
ERROR("no .symtab");
return -1;
}
list_for_each_entry(sec, &elf->sections, list) {
if (sec->sh.sh_type == SHT_GROUP &&
sec->sh.sh_link == symtab->idx) {
sym = find_symbol_by_index(elf, sec->sh.sh_info);
if (!sym) {
ERROR("%s: can't find SHT_GROUP signature symbol",
sec->name);
return -1;
}
sym->group_sec = sec;
}
}
return 0;
}
/*
* @sym's idx has changed. Update the relocs which reference it.
*/
@@ -745,7 +773,7 @@ __elf_create_symbol(struct elf *elf, struct symbol *sym)
/*
* Move the first global symbol, as per sh_info, into a new, higher
* symbol index. This fees up a spot for a new local symbol.
* symbol index. This frees up a spot for a new local symbol.
*/
first_non_local = symtab->sh.sh_info;
old = find_symbol_by_index(elf, first_non_local);
@@ -763,6 +791,11 @@ __elf_create_symbol(struct elf *elf, struct symbol *sym)
if (elf_update_sym_relocs(elf, old))
return NULL;
if (old->group_sec) {
old->group_sec->sh.sh_info = new_idx;
mark_sec_changed(elf, old->group_sec, true);
}
new_idx = first_non_local;
}
@@ -1035,6 +1068,9 @@ struct elf *elf_open_read(const char *name, int flags)
if (read_symbols(elf))
goto err;
if (mark_group_syms(elf))
goto err;
if (read_relocs(elf))
goto err;

View File

@@ -72,6 +72,7 @@ struct symbol {
u8 ignore : 1;
struct list_head pv_target;
struct reloc *relocs;
struct section *group_sec;
};
struct reloc {