This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

[PATCH]: add ia64 vDSO support to bfd_from_remote_memory


The following patch is required to get ia64 vsyscall support working in gdb. It was created by Roland McGrath.

The problem is that the ia64 vDSO has two pages in the address space that map to the same single page of contents. This is because the vsyscall entry point requires a special kind of mapping which must be executable, but not readable. There is a 2nd mapping required which is readable and non-executable that allows reading of the ELF info. This means that the program headers in the ia64 vDSO are non-standard with two PT_LOAD segments, both with p_offset of 0, but different p_vaddr values.

The bfd_from_remote_memory code in bfd/elfcode.h doesn't handle this scenario correctly. It needs to use the segment with the lowest p_vaddr whose p_offset is zero modulo p_align. The following patch adds an additional test which causes the loadbase to be correctly calculated. With the patch, gdb can support ia64 vsyscall backtracing.

This change has been present in Red Hat gdb sources for some time and has been tested on i686, ia64, s390, s390x, ppc, ppc64, and x86_64.

Ok to commit to general sources?

2005-05-19 Roland McGrath <roland@redhat.com>

	* elfcode.h (NAME (_bfd_elf, bfd_from_remote_memory): Adjust to support
	ia64 vDSO ideosyncracies.

Index: elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.68
diff -u -p -r1.68 elfcode.h
--- elfcode.h	9 May 2005 03:35:38 -0000	1.68
+++ elfcode.h	19 May 2005 16:39:08 -0000
@@ -1641,7 +1641,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
 	  if (segment_end > (bfd_vma) contents_size)
 	    contents_size = segment_end;

-	  if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
+	  if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0
+	      && loadbase == ehdr_vma)
 	    loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);

last_phdr = &i_phdrs[i];


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