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]

[RFA] Relocations in dwarf2, 2nd attempt


drow@mvista.com wrote:

> There's code in bfd/simple.c you can use to relocate a section if
> that's what you want.

Thanks for a hint! It simplified my patch "a little".
(however simple.c is pretty new, isn't it?)

Could someone approve it now, please?

Michal Ludvig
--
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
2002-10-29  Michal Ludvig  <mludvig@suse.cz>

	* bfd/dwarf2.c (read_indirect_string)
	(read_abbrevs, decode_line_info)
	(_bfd_dwarf2_find_nearest_line): Use 
	bfd_simple_get_relocated_section_contents() instead of
	bfd_get_section_contents().
	* bfd/reloc.c (bfd_perform_relocation): Add sanity check.

Index: dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.38
diff -u -p -r1.38 dwarf2.c
--- dwarf2.c	25 Oct 2002 02:45:53 -0000	1.38
+++ dwarf2.c	29 Oct 2002 13:36:45 -0000
@@ -389,8 +389,7 @@ read_indirect_string (unit, buf, bytes_r
       if (! stash->dwarf_abbrev_buffer)
 	return NULL;
 
-      if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer,
-				      (bfd_vma) 0, msec->_raw_size))
+      if (! bfd_simple_get_relocated_section_contents (abfd, msec, stash->dwarf_str_buffer))
 	return NULL;
     }
 
@@ -550,8 +549,7 @@ read_abbrevs (abfd, offset, stash)
       if (! stash->dwarf_abbrev_buffer)
 	  return 0;
 
-      if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer,
-				      (bfd_vma) 0, msec->_raw_size))
+      if (! bfd_simple_get_relocated_section_contents (abfd, msec, stash->dwarf_abbrev_buffer))
 	return 0;
     }
 
@@ -1023,8 +1021,7 @@ decode_line_info (unit, stash)
       if (! stash->dwarf_line_buffer)
 	return 0;
 
-      if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer,
-				      (bfd_vma) 0, msec->_raw_size))
+      if (! bfd_simple_get_relocated_section_contents (abfd, msec, stash->dwarf_line_buffer))
 	return 0;
 
       /* FIXME: We ought to apply the relocs against this section before
@@ -1939,8 +1936,7 @@ _bfd_dwarf2_find_nearest_line (abfd, sec
 
 	  start = stash->info_ptr_end - stash->info_ptr;
 
-	  if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start,
-					  (bfd_vma) 0, size))
+	  if (! bfd_simple_get_relocated_section_contents (abfd, msec, stash->info_ptr + start))
 	    continue;
 
 	  stash->info_ptr_end = stash->info_ptr + start + size;
Index: reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.69
diff -u -p -r1.69 reloc.c
--- reloc.c	25 Oct 2002 02:45:53 -0000	1.69
+++ reloc.c	29 Oct 2002 13:36:45 -0000
@@ -645,7 +645,7 @@ bfd_perform_relocation (abfd, reloc_entr
   reloc_target_output_section = symbol->section->output_section;
 
   /* Convert input-section-relative symbol value to absolute.  */
-  if (output_bfd && ! howto->partial_inplace)
+  if ((output_bfd && ! howto->partial_inplace) || !reloc_target_output_section)
     output_base = 0;
   else
     output_base = reloc_target_output_section->vma;

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