Don't change the default symbol for relocatable link
[deliverable/binutils-gdb.git] / bfd / elflink.c
index fc1fd087bb7258ab46380fe09a99dedf71aa68d5..846f35e88797b0df6c17333930ca4c9eda5c3f5e 100644 (file)
@@ -1655,12 +1655,17 @@ _bfd_elf_add_default_symbol (bfd *abfd,
 
   if (! override)
     {
-      bh = &hi->root;
-      if (! (_bfd_generic_link_add_one_symbol
-            (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
-             0, name, FALSE, collect, &bh)))
-       return FALSE;
-      hi = (struct elf_link_hash_entry *) bh;
+      /* Add the default symbol if not performing a relocatable link.  */
+      if (! info->relocatable)
+       {
+         bh = &hi->root;
+         if (! (_bfd_generic_link_add_one_symbol
+                (info, abfd, shortname, BSF_INDIRECT,
+                 bfd_ind_section_ptr,
+                 0, name, FALSE, collect, &bh)))
+           return FALSE;
+         hi = (struct elf_link_hash_entry *) bh;
+       }
     }
   else
     {
@@ -4609,9 +4614,10 @@ error_free_dyn:
       old_tab = NULL;
     }
 
-  /* Now that all the symbols from this input file are created, handle
-     .symver foo, foo@BAR such that any relocs against foo become foo@BAR.  */
-  if (nondeflt_vers != NULL)
+  /* Now that all the symbols from this input file are created, if
+     not performing a relocatable link, handle .symver foo, foo@BAR
+     such that any relocs against foo become foo@BAR.  */
+  if (!info->relocatable && nondeflt_vers != NULL)
     {
       bfd_size_type cnt, symidx;
 
This page took 0.027029 seconds and 4 git commands to generate.