1
0
Fork 0

- 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmANZFcACgkQEsHwGGHe
 VUp0jg//UtL0PMCun6DLVf8jTLwtzlCb25/FFLyF6RpPQvt+Zpda89ZqG9R81pXm
 lMMc3L+2YBddVG2pnUC6jyWwZIpx+M5D0ZKa7AKY6K5o7tS/9BtCPrWwmuf+6TDi
 6meLWy0hDOxSS5YifwH7LR8aj57SfsHqNfO4LF2ml857MX31Wwr/x5yryWPqho1g
 8v4sK+cAesu8m7leVAVwbdSEiqEP9NMQxR3Te/4+aT3Xyqc/+EPttFJ30564/gaF
 Zes1CqmUB7G9l8c9igvvCNqZyYyy8OoPp/UjW6NTu7soYhutsWkz/28deiW9WGks
 sKiJ5E/lEIimuORj0M++85CZcS4SaH4MRbfXi2F4BisGFS8c7CSwH3457WAnCuOf
 FZ/kaVYN2CP9DWbBQI032hdUkWScEzF2racNQ6uXghlhLFQE3l/sBPS2WsHzKhnF
 Jtwt1fGEHAaC3LeI2AenmSLX8q/5chZMTByp5z7Lq97SSsrk65N5uFSuSaU6cK5G
 0WDA5r6v0dy6szqzLe7mzaKdx2MOK6ygLisGBJDtYr7FZ5szHXz6e2vgJUEB82WB
 H21/mGf0Rl4GhHIH76W14imEWlQscp2wIEXJ8RWgoytRkWgHxBe59dMrwTB0s4jB
 R/KPlwA1eUzEaTBbARGMRGNv+Te/Z3QMYAXLlq1BZW3EKuw4L84=
 =FWZ1
 -----END PGP SIGNATURE-----

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
master
Linus Torvalds 2021-01-24 10:17:03 -08:00
commit 32d43270ca
2 changed files with 17 additions and 11 deletions

View File

@ -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;
}

View File

@ -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");
@ -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)