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]

Re: compatibility of (mips ELF) .o files between binutils versions?


On Sun, Jul 14, 2002 at 11:13:23PM -0700, cgd@broadcom.com wrote:
> I note that 'strings' on the 2.11.2 .o file says the strings
> 
> 	.rela.data
> 	.rel.data
> 
> are in that object file.  they don't appear in an object file built
> with 2.12.1 tools, but those sections are not in the ELF section list
> for either object.

Sure they are.  objdump just isn't showing you.  readelf says:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0  4
  [ 2] .data             PROGBITS        00000000 000034 000004 00  WA  0   0  4
  [ 3] .rel.data         REL             00000000 0003c4 000008 08      9   2  4
  [ 4] .rela.data        RELA            00000000 0003cc 000000 0c      9   2  4
  [ 5] .bss              NOBITS          00000000 000038 000000 00  WA  0   0  1
  [ 6] .reginfo          MIPS_REGINFO    00000000 000038 000018 01      0   0  4
  [ 7] .mdebug           MIPS_DEBUG      00000000 000050 0000f0 01      0   0  4
  [ 8] .shstrtab         STRTAB          00000000 000140 000052 00      0   0  1
  [ 9] .symtab           SYMTAB          00000000 00034c 000070 10     10   6  4
  [10] .strtab           STRTAB          00000000 0003bc 000005 00      0   0  1

Good job you found this problem, as in the process of fixing it I
noticed a worse problem.

	* elflink.h (elf_link_input_bfd): Don't call reloc_emitter when
	reloc section size is zero.  Correct reloc output location.

Committing to mainline and branch.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.175
diff -u -p -r1.175 elflink.h
--- bfd/elflink.h	15 Jul 2002 02:23:26 -0000	1.175
+++ bfd/elflink.h	16 Jul 2002 08:53:19 -0000
@@ -6945,7 +6942,7 @@ elf_link_input_bfd (finfo, input_bfd)
 	      Elf_Internal_Rela *irela;
 	      Elf_Internal_Rela *irelaend;
 	      struct elf_link_hash_entry **rel_hash;
-	      Elf_Internal_Shdr *input_rel_hdr;
+	      Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
 	      unsigned int next_erel;
 	      boolean (*reloc_emitter) PARAMS ((bfd *, asection *,
 						Elf_Internal_Shdr *,
@@ -7115,16 +7112,17 @@ elf_link_input_bfd (finfo, input_bfd)
 	      else
 		reloc_emitter = elf_link_output_relocs;
 
-	      if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
-				      internal_relocs))
+	      if (input_rel_hdr->sh_size != 0
+		  && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
+					 internal_relocs))
 		return false;
 
-	      input_rel_hdr = elf_section_data (o)->rel_hdr2;
-	      if (input_rel_hdr)
+	      input_rel_hdr2 = elf_section_data (o)->rel_hdr2;
+	      if (input_rel_hdr2 && input_rel_hdr2->sh_size != 0)
 		{
 		  internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
 				      * bed->s->int_rels_per_ext_rel);
-		  if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
+		  if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2,
 					  internal_relocs))
 		    return false;
 		}


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