Add support for non-contiguous memory regions
[deliverable/binutils-gdb.git] / bfd / elf64-ppc.c
index c804ab3d6af8c411c209acd0bc3b9b82d6a442fa..83eaadfb0d9559284d5842dcbb39357fe25f240b 100644 (file)
@@ -11362,6 +11362,31 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
   stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
   info = in_arg;
 
+  /* Fail if the target section could not be assigned to an output
+     section.  The user should fix his linker script.  */
+  if (stub_entry->target_section != NULL
+      && stub_entry->target_section->output_section == NULL
+      && info->non_contiguous_regions)
+    {
+      _bfd_error_handler (_("Could not assign '%pA' to an output section. "
+                           "Retry without --enable-non-contiguous-regions.\n"),
+                         stub_entry->target_section);
+      abort();
+    }
+
+  /* Same for the group.  */
+  if (stub_entry->group->stub_sec != NULL
+      && stub_entry->group->stub_sec->output_section == NULL
+      && info->non_contiguous_regions)
+    {
+      _bfd_error_handler (_("Could not assign group %pA target %pA to an "
+                           "output section. Retry without "
+                           "--enable-non-contiguous-regions.\n"),
+                         stub_entry->group->stub_sec,
+                         stub_entry->target_section);
+      abort();
+    }
+
   htab = ppc_hash_table (info);
   if (htab == NULL)
     return FALSE;
@@ -11887,6 +11912,31 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
   if (htab == NULL)
     return FALSE;
 
+  /* Fail if the target section could not be assigned to an output
+     section.  The user should fix his linker script.  */
+  if (stub_entry->target_section != NULL
+      && stub_entry->target_section->output_section == NULL
+      && info->non_contiguous_regions)
+    {
+      _bfd_error_handler (_("Could not assign %pA to an output section. "
+                           "Retry without --enable-non-contiguous-regions.\n"),
+                         stub_entry->target_section);
+      abort();
+    }
+
+  /* Same for the group.  */
+  if (stub_entry->group->stub_sec != NULL
+      && stub_entry->group->stub_sec->output_section == NULL
+      && info->non_contiguous_regions)
+    {
+      _bfd_error_handler (_("Could not assign group %pA target %pA to an "
+                           "output section. Retry without "
+                           "--enable-non-contiguous-regions.\n"),
+                         stub_entry->group->stub_sec,
+                         stub_entry->target_section);
+      abort();
+    }
+
   /* Make a note of the offset within the stubs for this entry.  */
   stub_entry->stub_offset = stub_entry->group->stub_sec->size;
 
This page took 0.025819 seconds and 4 git commands to generate.