gdb compile for powerpc64 target - Could not find symbol ".TOC."

Alan Modra amodra@gmail.com
Sat Jul 10 01:01:40 GMT 2021


On Fri, Jul 09, 2021 at 11:51:35AM -0500, will schmidt wrote:
> I've made some local changes so I'm now calling bfd_set_gp_value when
> the ".TOC." symbol is handled in compile_object_load. 
> i.e. 
>       if (strcmp (sym->name, ".TOC.") == 0)
>         bfd_set_gp_value(abfd.get(), sym->value);
> 
> This is either wrong, or insufficient.  :-)

Symbol value here is section relative.  You need to add the symbol
section vma, which is set by setup_sections_data::setup_one_section.

If that doesn't help, I would run gdb under gdb with a breakpoint on
ppc64_elf_toc_reloc looking to see whether that function is using the
value you expect given your bfd_set_gp_value call.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Gdb-patches mailing list