public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: will schmidt <will_schmidt@vnet.ibm.com>
To: Alan Modra <amodra@gmail.com>
Cc: Ulrich Weigand <uweigand@de.ibm.com>,
	gdb-patches@sourceware.org, rogerio <rogealve@br.ibm.com>,
	"Carl E. Love" <cel@us.ibm.com>
Subject: Re: gdb compile for powerpc64 target - Could not find symbol ".TOC."
Date: Mon, 12 Jul 2021 23:33:05 -0500	[thread overview]
Message-ID: <fc4047723f50861f7100602cd5be41a89187d4ea.camel@vnet.ibm.com> (raw)
In-Reply-To: <YOjxdOaP6uy4i8tU@squeak.grove.modra.org>

On Sat, 2021-07-10 at 10:31 +0930, Alan Modra wrote:
> 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.


So is that creating a new section named vma, or updating one of the
existing sections?
I see that we currently call setup_one_section for all(?) of the
sections , the full list being .data, .bss, .toc, .debug_info,
.debug_abbrev, .debug_aranges, .debug_line, .debug_str, .comment,
.note.GNU-stack, .debug_frame.   
It appears we call bfd_set_section_vma (sect, m_last_size);  for each
of those.
I can't immediately tell if or how I should try adding a call to
bfd_set_gp_value from within there.    (how to get to the parent abfd
from within a scope that only deals with the section?)
If/when I sort that part out, I'm still not sure what value I should be
trying to set that gp value to.  :-)

> 
> 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.

At the moment (before further changes)..


(gdbouter) p TOCstart
$42 = 01000000002200000


Thanks
-Will


  reply	other threads:[~2021-07-13  4:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 18:54 will schmidt
2021-06-23 15:36 ` Ulrich Weigand
2021-06-23 17:37   ` will schmidt
2021-06-24  3:11     ` Alan Modra
2021-06-24  4:39       ` Alan Modra
2021-06-24 15:32       ` Ulrich Weigand
2021-06-24 23:05         ` Alan Modra
2021-06-25 14:49           ` will schmidt
2021-07-09 16:51           ` will schmidt
2021-07-10  1:01             ` Alan Modra
2021-07-13  4:33               ` will schmidt [this message]
2021-07-13 11:11                 ` Alan Modra
2021-07-13 22:59                   ` will schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc4047723f50861f7100602cd5be41a89187d4ea.camel@vnet.ibm.com \
    --to=will_schmidt@vnet.ibm.com \
    --cc=amodra@gmail.com \
    --cc=cel@us.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rogealve@br.ibm.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).