Add --hash-size switch to the linker
[deliverable/binutils-gdb.git] / bfd / elfxx-ia64.c
index 878511bb828c3f14baadb4e89ea52faa09014a39..20d90831f124e538444e432fc8f7c84bb9e29c40 100644 (file)
@@ -1,5 +1,6 @@
 /* IA-64 support for 64-bit ELF
-   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -185,13 +186,13 @@ static bfd_boolean is_unwind_section_name
 static bfd_boolean elfNN_ia64_section_from_shdr
   PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
 static bfd_boolean elfNN_ia64_section_flags
-  PARAMS ((flagword *, Elf_Internal_Shdr *));
+  PARAMS ((flagword *, const Elf_Internal_Shdr *));
 static bfd_boolean elfNN_ia64_fake_sections
   PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec));
 static void elfNN_ia64_final_write_processing
   PARAMS ((bfd *abfd, bfd_boolean linker));
 static bfd_boolean elfNN_ia64_add_symbol_hook
-  PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
+  PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym,
           const char **namep, flagword *flagsp, asection **secp,
           bfd_vma *valp));
 static int elfNN_ia64_additional_program_headers
@@ -635,7 +636,7 @@ static const bfd_byte plt_min_entry[PLT_MIN_ENTRY_SIZE] =
 static const bfd_byte plt_full_entry[PLT_FULL_ENTRY_SIZE] =
 {
   0x0b, 0x78, 0x00, 0x02, 0x00, 0x24,  /*   [MMI]       addl r15=0,r1;;    */
-  0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0,  /*               ld8 r16=[r15],8    */
+  0x00, 0x41, 0x3c, 0x70, 0x29, 0xc0,  /*               ld8.acq r16=[r15],8*/
   0x01, 0x08, 0x00, 0x84,              /*               mov r14=r1;;       */
   0x11, 0x08, 0x00, 0x1e, 0x18, 0x10,  /*   [MIB]       ld8 r1=[r15]       */
   0x60, 0x80, 0x04, 0x80, 0x03, 0x00,  /*               mov b6=r16         */
@@ -1270,7 +1271,7 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
 static bfd_boolean
 elfNN_ia64_section_flags (flags, hdr)
      flagword *flags;
-     Elf_Internal_Shdr *hdr;
+     const Elf_Internal_Shdr *hdr;
 {
   if (hdr->sh_flags & SHF_IA_64_SHORT)
     *flags |= SEC_SMALL_DATA;
@@ -1429,7 +1430,7 @@ static bfd_boolean
 elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *abfd;
      struct bfd_link_info *info;
-     const Elf_Internal_Sym *sym;
+     Elf_Internal_Sym *sym;
      const char **namep ATTRIBUTE_UNUSED;
      flagword *flagsp ATTRIBUTE_UNUSED;
      asection **secp;
@@ -2458,7 +2459,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
             dynamic symbol table.  */
          if (!h && info->shared)
            {
-             if (! (_bfd_elfNN_link_record_local_dynamic_symbol
+             if (! (bfd_elf_link_record_local_dynamic_symbol
                     (info, abfd, (long) r_symndx)))
                return FALSE;
            }
@@ -2630,7 +2631,7 @@ allocate_fptr (dyn_i, data)
              BFD_ASSERT ((h->root.type == bfd_link_hash_defined)
                          || (h->root.type == bfd_link_hash_defweak));
 
-             if (!_bfd_elfNN_link_record_local_dynamic_symbol
+             if (!bfd_elf_link_record_local_dynamic_symbol
                    (x->info, h->root.u.def.section->owner,
                     global_sym_index (h)))
                return FALSE;
@@ -2940,8 +2941,12 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
   data.ofs = (data.ofs + 31) & (bfd_vma) -32;
 
   elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data);
-  if (data.ofs != 0)
+  if (data.ofs != 0 || ia64_info->root.dynamic_sections_created)
     {
+      /* FIXME: we always reserve the memory for dynamic linker even if
+        there are no PLT entries since dynamic linker may assume the
+        reserved memory always exists.  */
+
       BFD_ASSERT (ia64_info->root.dynamic_sections_created);
 
       ia64_info->plt_sec->_raw_size = data.ofs;
@@ -3082,7 +3087,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
          /* The DT_DEBUG entry is filled in by the dynamic linker and used
             by the debugger.  */
 #define add_dynamic_entry(TAG, VAL) \
-  bfd_elfNN_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+  _bfd_elf_add_dynamic_entry (info, TAG, VAL)
 
          if (!add_dynamic_entry (DT_DEBUG, 0))
            return FALSE;
@@ -3837,7 +3842,7 @@ elfNN_ia64_final_link (abfd, info)
     }
 
   /* Invoke the regular ELF backend linker to do all the work.  */
-  if (!bfd_elfNN_bfd_final_link (abfd, info))
+  if (!bfd_elf_final_link (abfd, info))
     return FALSE;
 
   if (unwind_output_sec)
@@ -3974,12 +3979,12 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          bfd_boolean unresolved_reloc;
          bfd_boolean warned;
+         struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
-         RELOC_FOR_GLOBAL_SYMBOL (h, elf_sym_hashes (input_bfd),
-                                  r_symndx,
-                                  symtab_hdr, value, sym_sec,
-                                  unresolved_reloc, info,
-                                  warned);
+         RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+                                  r_symndx, symtab_hdr, sym_hashes,
+                                  h, sym_sec, value,
+                                  unresolved_reloc, warned);
 
          if (h->root.type == bfd_link_hash_undefweak)
            undef_weak_ref = TRUE;
@@ -4595,7 +4600,7 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
          /* Mark the symbol as undefined, rather than as defined in the
             plt section.  Leave the value alone.  */
          /* ??? We didn't redefine it in adjust_dynamic_symbol in the
-            first place.  But perhaps elflink.h did some for us.  */
+            first place.  But perhaps elflink.c did some for us.  */
          if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
            sym->st_shndx = SHN_UNDEF;
        }
This page took 0.026181 seconds and 4 git commands to generate.