The following changes avoid polluting global namespace with the
[deliverable/binutils-gdb.git] / ld / ldlang.c
index 4512af6b4eaeabd4c7e2ec8e1489527c0bc69c98..3f3c1fe7ecd3e15fda85ea621fb3ded3f8813db5 100644 (file)
@@ -814,7 +814,7 @@ init_os (s)
     return;
 
   if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
-    einfo (_("%P%F: Illegal use of `%s' section"), DISCARD_SECTION_NAME);
+    einfo (_("%P%F: Illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
 
   new = ((section_userdata_type *)
         stat_alloc (sizeof (section_userdata_type)));
@@ -3521,8 +3521,15 @@ lang_check ()
                   bfd_printable_name (output_bfd));
        }
       else if (link_info.relocateable
-              && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd))
-       einfo (_("%P%F: Relocatable linking from format %s (%B) to format %s (%B) is not supported"),
+              /* In general it is not possible to perform a relocatable
+                 link between differing object formats when the input
+                 file has relocations, because the relocations in the
+                 input format may not have equivalent representations in
+                 the output format (and besides BFD does not translate
+                 relocs for other link purposes than a final link).  */
+              && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd)
+              && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0)
+       einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"),
               bfd_get_target (input_bfd), input_bfd,
               bfd_get_target (output_bfd), output_bfd);
       else if (bfd_count_sections (input_bfd))
@@ -4811,10 +4818,13 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
      const char *lma_memspec;
 {
   lang_memory_region_type *region;
+  lang_memory_region_type * default_region;
   lang_memory_region_type *lma_region;
   struct overlay_list *l;
   struct lang_nocrossref *nocrossref;
 
+  default_region = lang_memory_region_lookup ("*default*");
+
   if (memspec == NULL)
     region = NULL;
   else
@@ -4834,8 +4844,15 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
 
       if (fill != 0 && l->os->fill == 0)
        l->os->fill = fill;
-      if (region != NULL && l->os->region == NULL)
+
+      /* Assign a region to the sections, if one has been specified.
+        Override the assignment of the default section, but not
+        other sections.  */
+      if (region != NULL &&
+         (l->os->region == NULL ||
+          l->os->region == default_region))
        l->os->region = region;
+
       /* We only set lma_region for the first overlay section, as
         subsequent overlay sections will have load_base set relative
         to the first section.  Also, don't set lma_region if
@@ -4845,6 +4862,7 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
       if (lma_region != NULL && l->os->lma_region == NULL
          && l->next == NULL && l->os->load_base == NULL)
        l->os->lma_region = lma_region;
+
       if (phdrs != NULL && l->os->phdrs == NULL)
        l->os->phdrs = phdrs;
 
@@ -5103,7 +5121,7 @@ lang_do_version_exports_section ()
       len = bfd_section_size (is->the_bfd, sec);
       contents = xmalloc (len);
       if (!bfd_get_section_contents (is->the_bfd, sec, contents, 0, len))
-       einfo (_("%X%P: unable to read .exports section contents"), sec);
+       einfo (_("%X%P: unable to read .exports section contents\n"), sec);
 
       p = contents;
       while (p < contents + len)
This page took 0.024833 seconds and 4 git commands to generate.