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: Check raw size when preserving debug information


On ia64, we have a case that

(gdb) p *sec->kept_section
$2 = {name = 0x600000000066a993 ".gnu.linkonce.t.stat", id = 891, index = 12,
  next = 0x6000000000662820, flags = 1049143, user_set_vma = 1,
  reloc_done = 0, linker_mark = 1, linker_has_input = 0, gc_mark = 0,
  segment_mark = 0, sec_info_type = 0, use_rela_p = 1, has_tls_reloc = 0,
  need_finalize_relax = 0, has_gp_reloc = 0, flag13 = 0, flag14 = 0,
  flag15 = 0, flag16 = 0, flag20 = 0, flag24 = 0, vma = 0, lma = 0,
  _cooked_size = 352, _raw_size = 320, output_offset = 83995776,
  output_section = 0x60000000043d0e40, alignment_power = 6, relocation = 0x0,
  orelocation = 0x0, reloc_count = 1, filepos = 83519, rel_filepos = 221372,
  line_filepos = 0, userdata = 0x0, contents = 0x0, lineno = 0x0,
  lineno_count = 0, entsize = 0, comdat = 0x0, kept_section = 0x0,
  moving_line_filepos = 0, target_index = 0, used_by_bfd = 0x600000000066f630,
  constructor_chain = 0x0, owner = 0x600000000065f8b0,
  symbol = 0x600000000066f558, symbol_ptr_ptr = 0x60000000006627e8,
  link_order_head = 0x0, link_order_tail = 0x0}
(gdb) p *sec
$5 = {name = 0x60000000016e1a12 ".gnu.linkonce.t.stat", id = 3427, index = 12,
  next = 0x60000000016d98a0, flags = 1049143, user_set_vma = 1,
  reloc_done = 0, linker_mark = 0, linker_has_input = 0, gc_mark = 0,
  segment_mark = 0, sec_info_type = 0, use_rela_p = 1, has_tls_reloc = 0,
  need_finalize_relax = 0, has_gp_reloc = 0, flag13 = 0, flag14 = 0,
  flag15 = 0, flag16 = 0, flag20 = 0, flag24 = 0, vma = 0, lma = 0,
  _cooked_size = 320, _raw_size = 320, output_offset = 0,
  output_section = 0x6000000000007fd0, alignment_power = 6, relocation = 0x0,
  orelocation = 0x0, reloc_count = 1, filepos = 547231, rel_filepos = 758007,
  line_filepos = 0, userdata = 0x0, contents = 0x0, lineno = 0x0,
  lineno_count = 0, entsize = 0, comdat = 0x0,
  kept_section = 0x6000000000662708, moving_line_filepos = 0,
  target_index = 0, used_by_bfd = 0x60000000016fbba8, constructor_chain = 0x0,
  owner = 0x60000000016d6930, symbol = 0x60000000016fbb48,
  symbol_ptr_ptr = 0x60000000016d9868, link_order_head = 0x0,
  link_order_tail = 0x0}

They have different cooked size. This patch fixes the problem.


H.J.
----
bfd/

2003-06-23  H.J. Lu <hongjiu.lu@intel.com>

	* elflink.h (elf_link_input_bfd): Check raw size when using
	kept_section to preserve debug information discarded by
	linkonce.

--- bfd/elflink.h.debug	2003-06-23 13:43:06.000000000 -0700
+++ bfd/elflink.h	2003-06-23 15:58:33.000000000 -0700
@@ -5083,7 +5083,7 @@ elf_link_input_bfd (finfo, input_bfd)
 			      /* Try to preserve debug information.  */
 			      if ((o->flags & SEC_DEBUGGING) != 0
 				  && sec->kept_section != NULL
-				  && sec->_cooked_size == sec->kept_section->_cooked_size)
+				  && sec->_raw_size == sec->kept_section->_raw_size)
 				h->root.u.def.section
 				  = sec->kept_section;
 			      else
@@ -5112,7 +5112,7 @@ elf_link_input_bfd (finfo, input_bfd)
 			      /* Try to preserve debug information.  */
 			      if ((o->flags & SEC_DEBUGGING) != 0
 				  && sec->kept_section != NULL
-				  && sec->_cooked_size == sec->kept_section->_cooked_size)
+				  && sec->_raw_size == sec->kept_section->_raw_size)
 				finfo->sections[r_symndx]
 				  = sec->kept_section;
 			      else


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