* bfd-in.h (STRING_AND_COMMA): New macro. Takes one constant string as its
[external/binutils.git] / bfd / elf64-alpha.c
index 60deadb..f37a317 100644 (file)
@@ -1,6 +1,6 @@
 /* Alpha specific support for 64-bit ELF
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+   2006 Free Software Foundation, Inc.
    Contributed by Richard Henderson <rth@tamu.edu>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -273,8 +273,9 @@ elf64_alpha_bfd_link_hash_table_create (bfd *abfd)
   if (ret == (struct alpha_elf_link_hash_table *) NULL)
     return NULL;
 
-  if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
-                                      elf64_alpha_link_hash_newfunc))
+  if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+                                     elf64_alpha_link_hash_newfunc,
+                                     sizeof (struct alpha_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
@@ -320,11 +321,14 @@ struct alpha_elf_obj_tdata
 static bfd_boolean
 elf64_alpha_mkobject (bfd *abfd)
 {
-  bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
-  abfd->tdata.any = bfd_zalloc (abfd, amt);
   if (abfd->tdata.any == NULL)
-    return FALSE;
-  return TRUE;
+    {
+      bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
+      abfd->tdata.any = bfd_zalloc (abfd, amt);
+      if (abfd->tdata.any == NULL)
+       return FALSE;
+    }
+  return bfd_elf_mkobject (abfd);
 }
 
 static bfd_boolean
@@ -1897,7 +1901,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
              if (rel_sec_name == NULL)
                return FALSE;
 
-             BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0
+             BFD_ASSERT (CONST_STRNEQ (rel_sec_name, ".rela")
                          && strcmp (bfd_get_section_name (abfd, sec),
                                     rel_sec_name+5) == 0);
            }
@@ -2757,7 +2761,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
         of the dynobj section names depend upon the input files.  */
       name = bfd_get_section_name (dynobj, s);
 
-      if (strncmp (name, ".rela", 5) == 0)
+      if (CONST_STRNEQ (name, ".rela"))
        {
          if (s->size != 0)
            {
@@ -2769,7 +2773,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
              s->reloc_count = 0;
            }
        }
-      else if (strncmp (name, ".got", 4) != 0
+      else if (! CONST_STRNEQ (name, ".got")
               && strcmp (name, ".plt") != 0
               && strcmp (name, ".dynbss") != 0)
        {
@@ -5144,9 +5148,9 @@ elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela)
 \f
 static const struct bfd_elf_special_section elf64_alpha_special_sections[] =
 {
-  { ".sbss",  5, -2, SHT_NOBITS,   SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
-  { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
-  { NULL,     0,  0, 0,            0 }
+  { STRING_COMMA_LEN (".sbss"),  -2, SHT_NOBITS,   SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+  { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+  { NULL,                     0,  0, 0,            0 }
 };
 
 /* ECOFF swapping routines.  These are used when dealing with the
@@ -5230,6 +5234,7 @@ static const struct elf_size_info alpha_elf_size_info =
 #define ELF_ARCH               bfd_arch_alpha
 #define ELF_MACHINE_CODE       EM_ALPHA
 #define ELF_MAXPAGESIZE        0x10000
+#define ELF_COMMONPAGESIZE     0x2000
 
 #define bfd_elf64_bfd_link_hash_table_create \
   elf64_alpha_bfd_link_hash_table_create