Skip to content

Commit

Permalink
Merge tag 'objtool_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Jan 24, 2021
2 parents 24c56ee + 1d48915 commit 32d4327
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
14 changes: 5 additions & 9 deletions tools/objtool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -2928,14 +2928,10 @@ int check(struct objtool_file *file)
warnings += ret;

out:
if (ret < 0) {
/*
* Fatal error. The binary is corrupt or otherwise broken in
* some way, or objtool itself is broken. Fail the kernel
* build.
*/
return ret;
}

/*
* For now, don't fail the kernel build on fatal warnings. These
* errors are still fairly common due to the growing matrix of
* supported toolchains and their recent pace of change.
*/
return 0;
}
14 changes: 12 additions & 2 deletions tools/objtool/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,11 @@ static int read_symbols(struct elf *elf)

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

symtab_shndx = find_section_by_name(elf, ".symtab_shndx");
Expand Down Expand Up @@ -448,6 +451,13 @@ static int read_symbols(struct elf *elf)
list_add(&sym->list, entry);
elf_hash_add(elf->symbol_hash, &sym->hash, sym->idx);
elf_hash_add(elf->symbol_name_hash, &sym->name_hash, str_hash(sym->name));

/*
* Don't store empty STT_NOTYPE symbols in the rbtree. They
* can exist within a function, confusing the sorting.
*/
if (!sym->len)
rb_erase(&sym->node, &sym->sec->symbol_tree);
}

if (stats)
Expand Down

0 comments on commit 32d4327

Please sign in to comment.