[patch] elf loader detection of code sections

Dave Brolley <[email protected]>
Newsgroups gmane.comp.emulators.sid.devel
Organization Red Hat Canada, Ltd
Message-ID <[email protected]>
The attached patch makes a correction in the way code sections are 
detected by the elf loader. It now uses the VMA address of the section 
as intended.

Dave
elfload-1.ChangeLog (text/plain, 142 B)
2004-02-23  Dave Brolley  <[email protected]>

	* elfload.c (readElfFile): Get address from offset 16 for 64 bit and
	offset 12 for 16 bit.
elfload-1.patch.txt (text/plain, 1.7 KB)
Index: sid/component/loader/elfload.c
===================================================================
RCS file: /cvs/src/src/sid/component/loader/elfload.c,v
retrieving revision 1.6
diff -c -p -r1.6 elfload.c
*** sid/component/loader/elfload.c	12 Feb 2004 20:30:08 -0000	1.6
--- sid/component/loader/elfload.c	23 Feb 2004 20:07:02 -0000
*************** readElfFile (PFLOAD func, unsigned* entr
*** 229,235 ****
  	  if (fetchQuad(secHdr+8, littleEndian) & SHF_EXECINSTR)
  	    {
  	      textSections[textSectionCount].lbound = 
! 		fetchQuad(secHdr+24, littleEndian);
  	      textSections[textSectionCount].hbound = 
  		textSections[textSectionCount].lbound
  		+ fetchQuad(secHdr+32, littleEndian) - 1;
--- 229,235 ----
  	  if (fetchQuad(secHdr+8, littleEndian) & SHF_EXECINSTR)
  	    {
  	      textSections[textSectionCount].lbound = 
! 		fetchQuad(secHdr+16, littleEndian);
  	      textSections[textSectionCount].hbound = 
  		textSections[textSectionCount].lbound
  		+ fetchQuad(secHdr+32, littleEndian) - 1;
*************** readElfFile (PFLOAD func, unsigned* entr
*** 242,248 ****
  	  if (fetchWord(secHdr+8, littleEndian) & SHF_EXECINSTR)
  	    {
  	      textSections[textSectionCount].lbound = 
! 		fetchWord(secHdr+16, littleEndian);
  	      textSections[textSectionCount].hbound = 
  		textSections[textSectionCount].lbound
  		+ fetchWord(secHdr+20, littleEndian) - 1;
--- 242,248 ----
  	  if (fetchWord(secHdr+8, littleEndian) & SHF_EXECINSTR)
  	    {
  	      textSections[textSectionCount].lbound = 
! 		fetchWord(secHdr+12, littleEndian);
  	      textSections[textSectionCount].hbound = 
  		textSections[textSectionCount].lbound
  		+ fetchWord(secHdr+20, littleEndian) - 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.