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]

save wasting a little bfd memory


There's been no need to allocate tdata in the backend elf object_p
functions since my 2003-07-08 change to elfcode.h:elf_object_p.

bfd/ChangeLog
	* elf32-i386.c (elf_i386_object_p): Delete.
	(elf_backend_object_p): Don't define.
	* elf32-s390.c (elf_s390_object_p): No need to alloc tdata here.
	* elf32-sh.c (sh_elf_object_p): Likewise.
	* elf32-sparc.c (elf32_sparc_object_p): Likewise.
	* elf64-alpha.c (elf64_alpha_object_p): Likewise.
	* elf64-s390.c (elf_s390_object_p): Likewise.
	* elf64-x86-64.c (elf64_x86_64_elf_object_p): Likewise.

Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.115
diff -u -p -r1.115 elf32-i386.c
--- bfd/elf32-i386.c	22 Nov 2003 10:45:44 -0000	1.115
+++ bfd/elf32-i386.c	4 Dec 2003 02:36:11 -0000
@@ -546,20 +546,6 @@ elf_i386_mkobject (bfd *abfd)
   return TRUE;
 }
 
-static bfd_boolean
-elf_i386_object_p (bfd *abfd)
-{
-  /* Allocate our special target data.  */
-  struct elf_i386_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
-  return TRUE;
-}
-
 /* i386 ELF linker hash table.  */
 
 struct elf_i386_link_hash_table
@@ -3253,7 +3239,6 @@ elf_i386_finish_dynamic_sections (bfd *o
 #define elf_info_to_howto_rel		      elf_i386_info_to_howto_rel
 
 #define bfd_elf32_mkobject		      elf_i386_mkobject
-#define elf_backend_object_p		      elf_i386_object_p
 
 #define bfd_elf32_bfd_is_local_label_name     elf_i386_is_local_label_name
 #define bfd_elf32_bfd_link_hash_table_create  elf_i386_link_hash_table_create
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.55
diff -u -p -r1.55 elf32-s390.c
--- bfd/elf32-s390.c	27 Nov 2003 18:49:38 -0000	1.55
+++ bfd/elf32-s390.c	4 Dec 2003 02:36:18 -0000
@@ -685,14 +685,6 @@ static bfd_boolean
 elf_s390_object_p (abfd)
      bfd *abfd;
 {
-  /* Allocate our special target data.  */
-  struct elf_s390_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
   /* Set the right machine number for an s390 elf32 file.  */
   return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31);
 }
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.99
diff -u -p -r1.99 elf32-sh.c
--- bfd/elf32-sh.c	27 Nov 2003 18:49:38 -0000	1.99
+++ bfd/elf32-sh.c	4 Dec 2003 02:36:23 -0000
@@ -6960,19 +6960,7 @@ sh_elf_merge_private_data (bfd *ibfd, bf
 static bfd_boolean
 sh_elf_object_p (bfd *abfd)
 {
-  struct sh_elf_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
-
-  if (!sh_elf_set_mach_from_flags (abfd))
-    return FALSE;
-
-  /* Allocate our special target data.  */
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
-  return TRUE;
+  return sh_elf_set_mach_from_flags (abfd);
 }
 
 /* Finish up dynamic symbol handling.  We set the contents of various
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.59
diff -u -p -r1.59 elf32-sparc.c
--- bfd/elf32-sparc.c	5 Nov 2003 13:17:09 -0000	1.59
+++ bfd/elf32-sparc.c	4 Dec 2003 02:36:25 -0000
@@ -3340,15 +3340,6 @@ static bfd_boolean
 elf32_sparc_object_p (abfd)
      bfd *abfd;
 {
-  /* Allocate our special target data.  */
-  struct elf32_sparc_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct elf32_sparc_obj_tdata);
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
-
   if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS)
     {
       if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.111
diff -u -p -r1.111 elf64-alpha.c
--- bfd/elf64-alpha.c	27 Nov 2003 18:49:38 -0000	1.111
+++ bfd/elf64-alpha.c	4 Dec 2003 02:36:28 -0000
@@ -393,15 +393,6 @@ static bfd_boolean
 elf64_alpha_object_p (abfd)
      bfd *abfd;
 {
-  /* Allocate our special target data.  */
-  struct alpha_elf_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
-
   /* Set the right machine number for an Alpha ELF file.  */
   return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0);
 }
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.55
diff -u -p -r1.55 elf64-s390.c
--- bfd/elf64-s390.c	20 Nov 2003 09:54:07 -0000	1.55
+++ bfd/elf64-s390.c	4 Dec 2003 02:36:31 -0000
@@ -638,14 +638,6 @@ static bfd_boolean
 elf_s390_object_p (abfd)
      bfd *abfd;
 {
-  /* Allocate our special target data.  */
-  struct elf_s390_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
   /* Set the right machine number for an s390 elf32 file.  */
   return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64);
 }
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.71
diff -u -p -r1.71 elf64-x86-64.c
--- bfd/elf64-x86-64.c	17 Nov 2003 21:31:11 -0000	1.71
+++ bfd/elf64-x86-64.c	4 Dec 2003 02:36:33 -0000
@@ -579,14 +579,6 @@ elf64_x86_64_mkobject (bfd *abfd)
 static bfd_boolean
 elf64_x86_64_elf_object_p (bfd *abfd)
 {
-  /* Allocate our special target data.  */
-  struct elf64_x86_64_obj_tdata *new_tdata;
-  bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
-  new_tdata = bfd_zalloc (abfd, amt);
-  if (new_tdata == NULL)
-    return FALSE;
-  new_tdata->root = *abfd->tdata.elf_obj_data;
-  abfd->tdata.any = new_tdata;
   /* Set the right machine number for an x86-64 elf64 file.  */
   bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
   return TRUE;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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