Skip to content

Commit 32d4327

Browse files
committed
Merge tag 'objtool_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fixes from Borislav Petkov: - Adjust objtool to handle a recent binutils change to not generate unused symbols anymore. - Revert the fail-the-build-on-fatal-errors objtool strategy for now due to the ever-increasing matrix of supported toolchains/plugins and them causing too many such fatal errors currently. - Do not add empty symbols to objdump's rbtree to accommodate clang removing section symbols. * tag 'objtool_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Don't fail on missing symbol table objtool: Don't fail the kernel build on fatal errors objtool: Don't add empty symbols to the rbtree
2 parents 24c56ee + 1d48915 commit 32d4327

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

tools/objtool/check.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,14 +2928,10 @@ int check(struct objtool_file *file)
29282928
warnings += ret;
29292929

29302930
out:
2931-
if (ret < 0) {
2932-
/*
2933-
* Fatal error. The binary is corrupt or otherwise broken in
2934-
* some way, or objtool itself is broken. Fail the kernel
2935-
* build.
2936-
*/
2937-
return ret;
2938-
}
2939-
2931+
/*
2932+
* For now, don't fail the kernel build on fatal warnings. These
2933+
* errors are still fairly common due to the growing matrix of
2934+
* supported toolchains and their recent pace of change.
2935+
*/
29402936
return 0;
29412937
}

tools/objtool/elf.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,11 @@ static int read_symbols(struct elf *elf)
380380

381381
symtab = find_section_by_name(elf, ".symtab");
382382
if (!symtab) {
383-
WARN("missing symbol table");
384-
return -1;
383+
/*
384+
* A missing symbol table is actually possible if it's an empty
385+
* .o file. This can happen for thunk_64.o.
386+
*/
387+
return 0;
385388
}
386389

387390
symtab_shndx = find_section_by_name(elf, ".symtab_shndx");
@@ -448,6 +451,13 @@ static int read_symbols(struct elf *elf)
448451
list_add(&sym->list, entry);
449452
elf_hash_add(elf->symbol_hash, &sym->hash, sym->idx);
450453
elf_hash_add(elf->symbol_name_hash, &sym->name_hash, str_hash(sym->name));
454+
455+
/*
456+
* Don't store empty STT_NOTYPE symbols in the rbtree. They
457+
* can exist within a function, confusing the sorting.
458+
*/
459+
if (!sym->len)
460+
rb_erase(&sym->node, &sym->sec->symbol_tree);
451461
}
452462

453463
if (stats)

0 commit comments

Comments
 (0)