mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
objtool: Do not retrieve data from empty sections
Binutils 2.29-9 in Debian return an error when elf_getdata is invoked on empty section (.note.GNU-stack in all kernel files), causing immediate failure of kernel build with: elf_getdata: can't manipulate null section As nothing is done with sections that have zero size, just do not retrieve their data at all. Signed-off-by: Petr Vandrovec <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/2ce30a44349065b70d0f00e71e286dc0cbe745e6.1505459652.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
0998b7a0be
commit
df968c9329
1 changed files with 13 additions and 12 deletions
|
|
@ -175,19 +175,20 @@ static int read_sections(struct elf *elf)
|
|||
return -1;
|
||||
}
|
||||
|
||||
sec->data = elf_getdata(s, NULL);
|
||||
if (!sec->data) {
|
||||
WARN_ELF("elf_getdata");
|
||||
return -1;
|
||||
if (sec->sh.sh_size != 0) {
|
||||
sec->data = elf_getdata(s, NULL);
|
||||
if (!sec->data) {
|
||||
WARN_ELF("elf_getdata");
|
||||
return -1;
|
||||
}
|
||||
if (sec->data->d_off != 0 ||
|
||||
sec->data->d_size != sec->sh.sh_size) {
|
||||
WARN("unexpected data attributes for %s",
|
||||
sec->name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (sec->data->d_off != 0 ||
|
||||
sec->data->d_size != sec->sh.sh_size) {
|
||||
WARN("unexpected data attributes for %s", sec->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sec->len = sec->data->d_size;
|
||||
sec->len = sec->sh.sh_size;
|
||||
}
|
||||
|
||||
/* sanity check, one more call to elf_nextscn() should return NULL */
|
||||
|
|
|
|||
Loading…
Reference in a new issue