Messages in this thread | | | Date | Tue, 17 May 2022 18:24:29 -0700 | From | Josh Poimboeuf <> | Subject | Re: 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
| |