bfd/elfcode.h change for size of entries in .hash section

Jim Wilson wilson@cygnus.com
Thu Jun 29 16:37:00 GMT 2000


The ELF standard says that entries in the hash section are 4 bytes.  The
BFD default is ARCH_SIZE / 8, which makes it 8 bytes for 64-bit targets.
We've recently discovered that the IA-64 linux linker was accidentally using
8 byte entries which makes it incompatible with other ia64/elf systems.
This is about the 5th time that this problem has been run into (mips/sparc/
alpha/hppa/ia64).  Rather than override the default in elf64-ia64.c, I think
we should fix the default.  There is one system (alpha-linux) that relies on
the incorrect value of 8 and wants to continue using that value, so I've
added an override to elf64-alpha.c.  I believe no other target will be
affected.

This change should make the overrides in elf64-mips.c, elf64-sparc.c,
elf64-hppa.c unnecessary, but I haven't tried to remove them.
	
2000-06-29  Jim Wilson  <wilson@cygnus.com>

	* elf64-alpha.c (alpha_elf_size_info): New.
	(elf_backend_size_info): Define to alpha_elf_size_info.
	* elfcode.h (elf_size_info): Change hash bucket size to 4.

Index: elf64-alpha.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf64-alpha.c,v
retrieving revision 1.52
diff -p -r1.52 elf64-alpha.c
*** elf64-alpha.c	2000/05/29 16:46:01	1.52
--- elf64-alpha.c	2000/06/29 19:44:58
*************** elf64_alpha_merge_private_bfd_data (ibfd
*** 4682,4687 ****
--- 4682,4718 ----
    return true;
  }
  /* end-sanitize-cygnus */
+ 
+ /* Use a non-standard hash bucket size of 8.  */
+ 
+ const struct elf_size_info alpha_elf_size_info =
+ {
+   sizeof (Elf64_External_Ehdr),
+   sizeof (Elf64_External_Phdr),
+   sizeof (Elf64_External_Shdr),
+   sizeof (Elf64_External_Rel),
+   sizeof (Elf64_External_Rela),
+   sizeof (Elf64_External_Sym),
+   sizeof (Elf64_External_Dyn),
+   sizeof (Elf_External_Note),
+   8,
+   1,
+   64, 8,
+   ELFCLASS64, EV_CURRENT,
+   bfd_elf64_write_out_phdrs,
+   bfd_elf64_write_shdrs_and_ehdr,
+   bfd_elf64_write_relocs,
+   bfd_elf64_swap_symbol_out,
+   bfd_elf64_slurp_reloc_table,
+   bfd_elf64_slurp_symbol_table,
+   bfd_elf64_swap_dyn_in,
+   bfd_elf64_swap_dyn_out,
+   NULL,
+   NULL,
+   NULL,
+   NULL
+ };
+ 
  #define TARGET_LITTLE_SYM	bfd_elf64_alpha_vec
  #define TARGET_LITTLE_NAME	"elf64-alpha"
  #define ELF_ARCH		bfd_arch_alpha
*************** elf64_alpha_merge_private_bfd_data (ibfd
*** 4742,4747 ****
--- 4773,4781 ----
  
  #define elf_backend_ecoff_debug_swap \
    &elf64_alpha_ecoff_debug_swap
+ 
+ #define elf_backend_size_info \
+   alpha_elf_size_info
  
  /*
   * A few constants that determine how the .plt section is set up.
Index: elfcode.h
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elfcode.h,v
retrieving revision 1.241
diff -p -r1.241 elfcode.h
*** elfcode.h	2000/04/28 13:37:45	1.241
--- elfcode.h	2000/06/29 19:44:58
*************** const struct elf_size_info NAME(_bfd_elf
*** 1525,1531 ****
    sizeof (Elf_External_Sym),
    sizeof (Elf_External_Dyn),
    sizeof (Elf_External_Note),
!   ARCH_SIZE / 8,
    1,
    ARCH_SIZE, FILE_ALIGN,
    ELFCLASS, EV_CURRENT,
--- 1525,1531 ----
    sizeof (Elf_External_Sym),
    sizeof (Elf_External_Dyn),
    sizeof (Elf_External_Note),
!   4,
    1,
    ARCH_SIZE, FILE_ALIGN,
    ELFCLASS, EV_CURRENT,


More information about the Binutils mailing list