* elf-bfd.h (struct elf_backend_data): New member got_elt_size.
[deliverable/binutils-gdb.git] / bfd / elfxx-ia64.c
index d08abbe36fccbae1561ab3184294235af21bf4ba..d662c7498cc0cf2bf507e10e0eec2eadad20927e 100644 (file)
@@ -1467,10 +1467,13 @@ elfNN_ia64_final_write_processing (bfd *abfd,
    file.  We use it to put .comm items in .sbss, and not .bss.  */
 
 static bfd_boolean
-elfNN_ia64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
+elfNN_ia64_add_symbol_hook (bfd *abfd,
+                           struct bfd_link_info *info,
                            Elf_Internal_Sym *sym,
-                           const char **namep, flagword *flagsp,
-                           asection **secp, bfd_vma *valp)
+                           const char **namep ATTRIBUTE_UNUSED,
+                           flagword *flagsp ATTRIBUTE_UNUSED,
+                           asection **secp,
+                           bfd_vma *valp)
 {
   if (sym->st_shndx == SHN_COMMON
       && !info->relocatable
@@ -4185,8 +4188,6 @@ static bfd_vma
 elfNN_ia64_tprel_base (struct bfd_link_info *info)
 {
   asection *tls_sec = elf_hash_table (info)->tls_sec;
-
-  BFD_ASSERT (tls_sec != NULL);
   return tls_sec->vma - align_power ((bfd_vma) ARCH_SIZE / 4,
                                     tls_sec->alignment_power);
 }
@@ -4198,7 +4199,6 @@ elfNN_ia64_tprel_base (struct bfd_link_info *info)
 static bfd_vma
 elfNN_ia64_dtprel_base (struct bfd_link_info *info)
 {
-  BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
   return elf_hash_table (info)->tls_sec->vma;
 }
 
@@ -4891,24 +4891,11 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
        case R_IA64_SEGREL64MSB:
        case R_IA64_SEGREL64LSB:
            {
-             struct elf_segment_map *m;
-             Elf_Internal_Phdr *p;
-
              /* Find the segment that contains the output_section.  */
-             for (m = elf_tdata (output_bfd)->segment_map,
-                    p = elf_tdata (output_bfd)->phdr;
-                  m != NULL;
-                  m = m->next, p++)
-               {
-                 int i;
-                 for (i = m->count - 1; i >= 0; i--)
-                   if (m->sections[i] == input_section->output_section)
-                     break;
-                 if (i >= 0)
-                   break;
-               }
+             Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section
+               (output_bfd, input_section->output_section);
 
-             if (m == NULL)
+             if (p == NULL)
                {
                  r = bfd_reloc_notsupported;
                }
@@ -4981,6 +4968,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
        case R_IA64_TPREL14:
        case R_IA64_TPREL22:
        case R_IA64_TPREL64I:
+         if (elf_hash_table (info)->tls_sec == NULL)
+           goto missing_tls_sec;
          value -= elfNN_ia64_tprel_base (info);
          r = elfNN_ia64_install_value (hit_addr, value, r_type);
          break;
@@ -4992,6 +4981,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
        case R_IA64_DTPREL32MSB:
        case R_IA64_DTPREL64LSB:
        case R_IA64_DTPREL64MSB:
+         if (elf_hash_table (info)->tls_sec == NULL)
+           goto missing_tls_sec;
          value -= elfNN_ia64_dtprel_base (info);
          r = elfNN_ia64_install_value (hit_addr, value, r_type);
          break;
@@ -5010,6 +5001,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
              case R_IA64_LTOFF_TPREL22:
                if (!dynamic_symbol_p)
                  {
+                   if (elf_hash_table (info)->tls_sec == NULL)
+                     goto missing_tls_sec;
                    if (!info->shared)
                      value -= elfNN_ia64_tprel_base (info);
                    else
@@ -5027,7 +5020,11 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
                break;
              case R_IA64_LTOFF_DTPREL22:
                if (!dynamic_symbol_p)
-                 value -= elfNN_ia64_dtprel_base (info);
+                 {
+                   if (elf_hash_table (info)->tls_sec == NULL)
+                     goto missing_tls_sec;
+                   value -= elfNN_ia64_dtprel_base (info);
+                 }
                got_r_type = R_IA64_DTPRELNNLSB;
                break;
              }
@@ -5078,6 +5075,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
        case bfd_reloc_outofrange:
        case bfd_reloc_overflow:
        default:
+missing_tls_sec:
          {
            const char *name;
 
@@ -5089,6 +5087,25 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 
            switch (r_type)
              {
+             case R_IA64_TPREL14:
+             case R_IA64_TPREL22:
+             case R_IA64_TPREL64I:
+             case R_IA64_DTPREL14:
+             case R_IA64_DTPREL22:
+             case R_IA64_DTPREL64I:
+             case R_IA64_DTPREL32LSB:
+             case R_IA64_DTPREL32MSB:
+             case R_IA64_DTPREL64LSB:
+             case R_IA64_DTPREL64MSB:
+             case R_IA64_LTOFF_TPREL22:
+             case R_IA64_LTOFF_DTPMOD22:
+             case R_IA64_LTOFF_DTPREL22:
+               (*_bfd_error_handler)
+                 (_("%B: missing TLS section for relocation %s against `%s' at 0x%lx in section `%A'."),
+                  input_bfd, input_section, howto->name, name,
+                  rel->r_offset);
+               break;
+
              case R_IA64_PCREL21B:
              case R_IA64_PCREL21BI:
              case R_IA64_PCREL21M:
@@ -5712,8 +5729,6 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
 #undef  elf_backend_want_p_paddr_set_to_zero
 #define elf_backend_want_p_paddr_set_to_zero 1
 
-#undef  ELF_MAXPAGESIZE
-#define ELF_MAXPAGESIZE                 0x1000  /* 4K */
 #undef ELF_COMMONPAGESIZE
 #undef ELF_OSABI
 #define ELF_OSABI                      ELFOSABI_HPUX
This page took 0.028756 seconds and 4 git commands to generate.