Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jeff Johnston <jjohnstn@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA]: Upstream bfd patch for ia64 vDSO support
Date: Wed, 01 Jun 2005 20:13:00 -0000	[thread overview]
Message-ID: <429E16E9.8010301@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

The attached patch has been checked in to binutils by Jim Wilson.  It fixes a 
problem with the ia64 vDSO so that gdb can backtrace from system calls.  I need 
this to check in an ia64/libunwind patch that fixes backtracing through 
syscalls.  I didn't know if one could just check in upstream bfd patches without 
approval so I will ask.  May I commit this?

Without the patch, the bfd_from_remote_memory call sets a bogus address for 
loadbase and symbol_file_add_from_memory fails.

See http://sourceware.org/ml/binutils/2005-05/msg00725.html for the patch and 
references to the discussion

2005-05-31  James E Wilson  <wilson@specifixinc.com>

	* elfcode.h (NAME(bfd_elf,bfd_from_remote_memory)): Check for program
	header PF_R flag on PT_LOAD segments.

[-- Attachment #2: elfcode.h.patch --]
[-- Type: text/plain, Size: 1323 bytes --]

Index: elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.69
diff -u -p -r1.69 elfcode.h
--- elfcode.h	26 May 2005 07:41:13 -0000	1.69
+++ elfcode.h	1 Jun 2005 19:58:09 -0000
@@ -1656,7 +1656,10 @@ NAME(_bfd_elf,bfd_from_remote_memory)
   for (i = 0; i < i_ehdr.e_phnum; ++i)
     {
       elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]);
-      if (i_phdrs[i].p_type == PT_LOAD)
+      /* IA-64 vDSO may have two mappings for one segment, where one mapping
+	 is executable only, and one is read only.  We must not use the
+	 executable one.  */
+      if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
 	{
 	  bfd_vma segment_end;
 	  segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
@@ -1703,7 +1706,10 @@ NAME(_bfd_elf,bfd_from_remote_memory)
     }
 
   for (i = 0; i < i_ehdr.e_phnum; ++i)
-    if (i_phdrs[i].p_type == PT_LOAD)
+    /* IA-64 vDSO may have two mappings for one segment, where one mapping
+       is executable only, and one is read only.  We must not use the
+       executable one.  */
+    if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
       {
 	bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align;
 	bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz

             reply	other threads:[~2005-06-01 20:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-01 20:13 Jeff Johnston [this message]
2005-06-03 19:10 ` Daniel Jacobowitz
2005-06-03 19:36   ` Jeff Johnston

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=429E16E9.8010301@redhat.com \
    --to=jjohnstn@redhat.com \
    --cc=gdb-patches@sources.redhat.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