[patch] Minor improvements to *_gc_sweep_hook().

Kazu Hirata kazu@cs.umass.edu
Sun Jan 11 07:46:00 GMT 2004


Hi,

Attached is a patch to make the same changes as I made in

http://sources.redhat.com/ml/binutils/2004-01/msg00121.html

Built cris-elf and vax-netbsdelf.  Committed as obvious.

Kazu Hirata

2004-01-11  Kazu Hirata  <kazu@cs.umass.edu>

	* elf32-cris.c (cris_elf_gc_sweep_hook): Return early if no
	dynamic object is present.  Declare r_symndx and h in an inner
	scope.
	* elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.

Index: elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.46
diff -u -r1.46 elf32-cris.c
--- elf32-cris.c	11 Nov 2003 13:32:37 -0000	1.46
+++ elf32-cris.c	11 Jan 2004 07:32:16 -0000
@@ -1770,26 +1770,27 @@
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  struct elf_link_hash_entry *h;
   bfd *dynobj;
   asection *sgot;
   asection *srelgot;
 
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (abfd);
-  local_got_refcounts = elf_local_got_refcounts (abfd);
-
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj == NULL)
     return TRUE;
 
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
   sgot = bfd_get_section_by_name (dynobj, ".got");
   srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
     {
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+
       switch (ELF32_R_TYPE (rel->r_info))
 	{
 	case R_CRIS_16_GOT:
Index: elf32-vax.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-vax.c,v
retrieving revision 1.17
diff -u -r1.17 elf32-vax.c
--- elf32-vax.c	1 Dec 2003 06:33:01 -0000	1.17
+++ elf32-vax.c	11 Jan 2004 07:32:16 -0000
@@ -892,20 +892,21 @@
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  struct elf_link_hash_entry *h;
   bfd *dynobj;
 
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (abfd);
-
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj == NULL)
     return TRUE;
 
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
     {
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+
       switch (ELF32_R_TYPE (rel->r_info))
 	{
 	case R_VAX_GOT32:



More information about the Binutils mailing list