public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH]:  add ia64 vDSO support to bfd_from_remote_memory
@ 2005-05-19 16:58 Jeff Johnston
  2005-05-27 23:09 ` James E Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Johnston @ 2005-05-19 16:58 UTC (permalink / raw)
  To: binutils

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];

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-19 16:58 [PATCH]: add ia64 vDSO support to bfd_from_remote_memory Jeff Johnston
2005-05-27 23:09 ` James E Wilson
2005-05-28  0:15   ` James E Wilson
2005-05-28 10:27     ` Andreas Schwab
2005-05-30 16:35       ` Jeff Johnston
2005-05-30 18:23   ` Jeff Johnston
2005-05-31 20:40     ` James E Wilson

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