Skip to content

Commit

Permalink
objtool: Fix elf_create_undef_symbol() endianness
Browse files Browse the repository at this point in the history
Currently x86 cross-compilation fails on big endian system with:

  x86_64-cross-ld: init/main.o: invalid string offset 488112128 >= 6229 for section `.strtab'

Mark new ELF data in elf_create_undef_symbol() as symbol, so that libelf
does endianness handling correctly.

Fixes: 2f2f7e4 ("objtool: Add elf_create_undef_symbol()")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: https://lore.kernel.org/r/patch-1.thread-6c9df9.git-d39264656387.your-ad-here.call-01620841104-ext-2554@work.hours
  • Loading branch information
Vasily Gorbik authored and Ingo Molnar committed May 12, 2021
1 parent 88b0639 commit 46c7405
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/objtool/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ struct symbol *elf_create_undef_symbol(struct elf *elf, const char *name)
data->d_buf = &sym->sym;
data->d_size = sizeof(sym->sym);
data->d_align = 1;
data->d_type = ELF_T_SYM;

sym->idx = symtab->len / sizeof(sym->sym);

Expand Down

0 comments on commit 46c7405

Please sign in to comment.