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]

fix for



GCC's gcc.dg/special/gcsec-1.c testcase, on x86-linux, has a section
with SEC_MERGE set which is subsequently removed by garbage
collection.  When this happens, _bfd_merge_sections will clear the
sec_info field of the section (noticing that SEC_EXCLUDE is set) but
elf_link_add_object_symbols will already have set sec_info_type to
ELF_INFO_TYPE_MERGE and elf_link_input_bfd expects that if
sec_info_type is ELF_INFO_TYPE_MERGE then sec_info is valid.

Later on in elf_link_input_bfd, the code bails out anyway in this
circumstance; so I just made elf_link_input_bfd not try to determine
the symbol's value if it will be excluded from the final link.

The patch was tested by running the ld, gcc, and g++ testsuites on
x86-linux.

OK to commit?

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>

===File ~/patches/cygnus/ld-mergeddeletedsymbol.patch=======
2002-01-07  Geoffrey Keating  <geoffk@redhat.com>

	* elflink.h (elf_link_input_bfd): Don't ask for the merged offset
	of a symbol in a section that will be deleted.

Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.137
diff -p -u -p -r1.137 elflink.h
--- elflink.h	2001/12/31 11:49:09	1.137
+++ elflink.h	2002/01/07 08:11:51
@@ -6375,6 +6375,8 @@ elf_link_input_bfd (finfo, input_bfd)
 	  isec = section_from_elf_index (input_bfd, isym->st_shndx);
 	  if (isec
 	      && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
+	      && (finfo->info->relocateable
+		  || ! (isec->flags & SEC_EXCLUDE))
 	      && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
 	    isym->st_value =
 	      _bfd_merged_section_offset (output_bfd, &isec,
============================================================


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