This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA]: Upstream bfd patch for ia64 vDSO support


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]