2001-06-07 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / bfd / elflink.c
index c593e496f95ccc27391737d7f26c3047d24a6830..b971311d155f747be3bd3232c3a8e64ce9eefa0f 100644 (file)
@@ -1,5 +1,6 @@
 /* ELF linking support for BFD.
-   Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -41,9 +42,17 @@ _bfd_elf_create_got_section (abfd, info)
 
   switch (bed->s->arch_size)
     {
-    case 32: ptralign = 2; break;
-    case 64: ptralign = 3; break;
-    default: abort();
+    case 32:
+      ptralign = 2;
+      break;
+
+    case 64:
+      ptralign = 3;
+      break;
+
+    default:
+      bfd_set_error (bfd_error_bad_value);
+      return false;
     }
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -89,7 +98,6 @@ _bfd_elf_create_got_section (abfd, info)
   return true;
 }
 \f
-
 /* Create dynamic sections when linking against a dynamic object.  */
 
 boolean
@@ -100,13 +108,21 @@ _bfd_elf_create_dynamic_sections (abfd, info)
   flagword flags, pltflags;
   register asection *s;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  int ptralign = 0;
+  int ptralign;
 
   switch (bed->s->arch_size)
     {
-    case 32: ptralign = 2; break;
-    case 64: ptralign = 3; break;
-    default: abort();
+    case 32:
+      ptralign = 2;
+      break;
+
+    case 64:
+      ptralign = 3;
+      break;
+
+    default:
+      bfd_set_error (bfd_error_bad_value);
+      return false;
     }
 
   /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
@@ -147,7 +163,7 @@ _bfd_elf_create_dynamic_sections (abfd, info)
        return false;
     }
 
-  s = bfd_make_section (abfd, 
+  s = bfd_make_section (abfd,
                        bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
@@ -183,9 +199,9 @@ _bfd_elf_create_dynamic_sections (abfd, info)
      copy relocs.  */
       if (! info->shared)
        {
-         s = bfd_make_section (abfd, 
-                               (bed->default_use_rela_p 
-                                ? ".rela.bss" : ".rel.bss")); 
+         s = bfd_make_section (abfd,
+                               (bed->default_use_rela_p
+                                ? ".rela.bss" : ".rel.bss"));
          if (s == NULL
              || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
              || ! bfd_set_section_alignment (abfd, s, ptralign))
@@ -196,7 +212,6 @@ _bfd_elf_create_dynamic_sections (abfd, info)
   return true;
 }
 \f
-
 /* Record a new dynamic symbol.  We record the dynamic symbols as we
    read the input files, since we need to have a list of all of them
    before we can determine the final sizes of the output sections.
@@ -226,21 +241,8 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
        {
        case STV_INTERNAL:
        case STV_HIDDEN:
-         /* This symbol must be defined in the shared object or
-            executable.  */
-         if (h->root.type == bfd_link_hash_undefined)
-           {
-             bfd * abfd = h->root.u.undef.abfd;
-             const char * name = h->root.root.string;
-             
-             (*info->callbacks->undefined_symbol)
-               (info, name, abfd, bfd_und_section_ptr, 0, true);
-
-             /* We have flaged a fatal error. We now treat this as
-                a normal symbol to avoid further error messages. */
-             h->other ^= ELF_ST_VISIBILITY (h->other);
-           }
-         else if (h->root.type != bfd_link_hash_undefweak)
+         if (h->root.type != bfd_link_hash_undefined
+             && h->root.type != bfd_link_hash_undefweak)
            {
              h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
              return true;
@@ -331,7 +333,7 @@ elf_link_renumber_hash_table_dynsyms (h, data)
   return true;
 }
 
-/* Assign dynsym indicies.  In a shared library we generate a section
+/* Assign dynsym indices.  In a shared library we generate a section
    symbol for each output section, which come first.  Next come all of
    the back-end allocated local dynamic syms, followed by the rest of
    the global symbols.  */
@@ -495,7 +497,6 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
 
   return lsect;
 }
-
 \f
 /* Find a linker generated pointer with a given addend and type.  */
 
@@ -513,7 +514,6 @@ _bfd_elf_find_pointer_linker_section (linker_pointers, addend, which)
 
   return (elf_linker_section_pointers_t *)0;
 }
-
 \f
 /* Make the .rela section corresponding to the generated linker section.  */
 
This page took 0.024984 seconds and 4 git commands to generate.