Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: Upstream bfd patch for ia64 vDSO support
@ 2005-06-01 20:13 Jeff Johnston
  2005-06-03 19:10 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Johnston @ 2005-06-01 20:13 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-03 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-01 20:13 [RFA]: Upstream bfd patch for ia64 vDSO support Jeff Johnston
2005-06-03 19:10 ` Daniel Jacobowitz
2005-06-03 19:36   ` Jeff Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox