+2013-04-24  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+       * emulparams/aarch64elf.sh: Define ELFSIZE=64.
+       * emulparams/aarch64linux.sh: Ditto.
+       * emultempl/aarch64elf.em (aarch64_elf_before_allocation):
+       Replace elf64 with elf${ELFSIZE}.
+       (elf64_aarch64_add_stub_section): Likewise.
+       (build_section_lists): Likewise.
+       (gld${EMULATION_NAME}_after_allocation): Likewise.
+       (gld${EMULATION_NAME}_finish): Likewise.
+       (aarch64_elf_create_output_section_statements): Likewise.
+
 2013-04-24  Nick Clifton  <nickc@redhat.com>
 
        PR ld/15389
 
       LANG_FOR_EACH_INPUT_STATEMENT (is)
        {
           /* Initialise mapping tables for code/data.  */
-          bfd_elf64_aarch64_init_maps (is->the_bfd);
+          bfd_elf${ELFSIZE}_aarch64_init_maps (is->the_bfd);
        }
     }
 
 }
 
 
-/* Call-back for elf64_aarch64_size_stubs.  */
+/* Call-back for elf${ELFSIZE}_aarch64_size_stubs.  */
 
 /* Create a new stub section, and arrange for it to be linked
    immediately after INPUT_SECTION.  */
 
 static asection *
-elf64_aarch64_add_stub_section (const char *stub_sec_name,
+elf${ELFSIZE}_aarch64_add_stub_section (const char *stub_sec_name,
                                asection *input_section)
 {
   asection *stub_sec;
   return NULL;
 }
 
-/* Another call-back for elf_arm_size_stubs.  */
+/* Another call-back for elf${ELFSIZE}_aarch64_size_stubs.  */
 
 static void
 gldaarch64_layout_sections_again (void)
          && (i->flags & SEC_EXCLUDE) == 0
          && i->output_section != NULL
          && i->output_section->owner == link_info.output_bfd)
-       elf64_aarch64_next_input_section (& link_info, i);
+       elf${ELFSIZE}_aarch64_next_input_section (& link_info, i);
     }
 }
 
      have to examine the relocs.  */
   if (stub_file != NULL && !link_info.relocatable)
     {
-      int ret = elf64_aarch64_setup_section_lists (link_info.output_bfd,
+      int ret = elf${ELFSIZE}_aarch64_setup_section_lists (link_info.output_bfd,
                                                   & link_info);
 
       if (ret != 0)
          lang_for_each_statement (build_section_lists);
 
          /* Call into the BFD backend to do the real work.  */
-         if (! elf64_aarch64_size_stubs (link_info.output_bfd,
+         if (! elf${ELFSIZE}_aarch64_size_stubs (link_info.output_bfd,
                                          stub_file->the_bfd,
                                          & link_info,
                                          group_size,
-                                         & elf64_aarch64_add_stub_section,
+                                         & elf${ELFSIZE}_aarch64_add_stub_section,
                                          & gldaarch64_layout_sections_again))
            {
              einfo ("%X%P: cannot size stub section: %E\n");
       /* Now build the linker stubs.  */
       if (stub_file->the_bfd->sections != NULL)
        {
-         if (! elf64_aarch64_build_stubs (& link_info))
+         if (! elf${ELFSIZE}_aarch64_build_stubs (& link_info))
            einfo ("%X%P: can not build stubs: %E\n");
        }
     }
       return;
     }
 
-  bfd_elf64_aarch64_set_options (link_info.output_bfd, &link_info,
+  bfd_elf${ELFSIZE}_aarch64_set_options (link_info.output_bfd, &link_info,
                                 no_enum_size_warning,
                                 no_wchar_size_warning,
                                 pic_veneer);