lkml.org 
[lkml]   [2022]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: objtool "no non-local symbols" error with tip of tree LLVM
On Tue, May 17, 2022 at 05:42:04PM +0200, Peter Zijlstra wrote:
> + for (;;) {
> + symtab_data = elf_getdata(s, symtab_data);
> + if (t)
> + shndx_data = elf_getdata(t, shndx_data);
>
> - sym->idx = symtab->sh.sh_size / sizeof(sym->sym);
> - elf_dirty_reloc_sym(elf, sym);
> + if (!symtab_data) {
> + if (!idx) {
> + void *buf;

I'm confused by whatever this is doing, how is !symtab_data possible,
i.e. why would symtab not have data?

> elf_create_section_symbol(struct elf *elf, struct section *sec)
> {
> struct section *symtab, *symtab_shndx;
> - Elf_Data *shndx_data = NULL;
> - struct symbol *sym;
> - Elf32_Word shndx;
> + Elf32_Word first_non_local, new;
> + struct symbol *sym, *old;
> + int size;
> +
> + if (elf->ehdr.e_ident[EI_CLASS] == ELFCLASS32)
> + size = sizeof(Elf32_Sym);
> + else
> + size = sizeof(Elf64_Sym);

This should probably be called 'entsize' and I think you can just get it
from symtab->sh.sh_entsize.

> + /*
> + * Either way, we added a LOCAL symbol.
> + */
> + symtab->sh.sh_info += 1;
> +
> elf_add_symbol(elf, sym);

Not sure if it matters here, but elf_add_symbol() doesn't set sym->alias
and sym->pv_target, and both of those are unconditionally initialized in
read_symbols(). Should elf_add_symbol() be changed to initialize them?

--
Josh

\
 
 \ /
  Last update: 2022-05-18 03:25    [W:0.113 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site