Subject: bfd/elfcode.h change for size of entries in .hash section (forwarded)
To: None <tech-toolchain@netbsd.org, port-alpha@netbsd.org>
From: matthew green <mrg@cygnus.com>
List: tech-toolchain
Date: 06/30/2000 13:05:19
------- Forwarded Message

Delivery-Date: Fri Jun 30 09:35:54 2000
	by crocodile-dances.eterna.com.au (Postfix) with ESMTP id 33A763B2C
	for <mrg@crocodile-dances.eterna.com.au>; Fri, 30 Jun 2000 09:35:51 +1000 (EST)
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with SMTP id QAA29627
	for <mrg@cygnus.com>; Thu, 29 Jun 2000 16:37:12 -0700 (PDT)
Mailing-List: contact binutils-help@sourceware.cygnus.com; run by ezmlm
List-Unsubscribe: <mailto:binutils-unsubscribe-mrg=cygnus.com@sourceware.cygnus.com>
List-Subscribe: <mailto:binutils-subscribe@sourceware.cygnus.com>
List-Archive: <http://sourceware.cygnus.com/ml/binutils/>
List-Post: <mailto:binutils@sourceware.cygnus.com>
List-Help: <mailto:binutils-help@sourceware.cygnus.com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: binutils-owner@sourceware.cygnus.com
  by sourceware.cygnus.com with SMTP; 29 Jun 2000 23:37:02 -0000
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id QAA29572;
	Thu, 29 Jun 2000 16:37:01 -0700 (PDT)
Message-Id: <200006292337.QAA16641@wilson.cygnus.com>
To: binutils@sourceware.cygnus.com
Cc: rth@cygnus.com
Subject: bfd/elfcode.h change for size of entries in .hash section
Date: Thu, 29 Jun 2000 16:37:01 -0700
From: Jim Wilson <wilson@cygnus.com>

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,

------- End of Forwarded Message