section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
"section. Retry without "
"--enable-non-contiguous-regions.\n"),
hsh->target_section);
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign %pA to an output "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
"section. Retry without "
"--enable-non-contiguous-regions.\n"),
hsh->target_section);
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign %pA to an output "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
"section. Retry without "
"--enable-non-contiguous-regions.\n"),
hsh->target_section);
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
hsh->target_section);
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
hsh->target_section);
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)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
-
- /* Same for the group. */
- if (stub_entry->group->stub_sec != NULL
- && stub_entry->group->stub_sec->output_section == NULL
- && info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: 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);
-
htab = ppc_hash_table (info);
if (htab == NULL)
return false;
if (stub_entry->target_section != NULL
&& stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign %pA to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
if (stub_entry->group->stub_sec != NULL
&& stub_entry->group->stub_sec->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: 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);
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->group->stub_sec);
/* Make a note of the offset within the stubs for this entry. */
stub_offset = stub_entry->group->stub_sec->size;
/* If this symbol is defined in a section which we are
discarding, we don't need to keep it. */
- if (isym->st_shndx != SHN_UNDEF
- && isym->st_shndx < SHN_LORESERVE
- && isec->output_section == NULL
- && flinfo->info->non_contiguous_regions)
- {
- if (flinfo->info->non_contiguous_regions_warnings)
- _bfd_error_handler (_("warning: --enable-non-contiguous-regions "
- "discards section `%s' from '%s'\n"),
- isec->name, bfd_get_filename (isec->owner));
- continue;
- }
-
- if (isym->st_shndx != SHN_UNDEF
- && isym->st_shndx < SHN_LORESERVE
- && bfd_section_removed_from_list (output_bfd,
- isec->output_section))
+ if (isym->st_shndx < SHN_LORESERVE
+ && (isec->output_section == NULL
+ || bfd_section_removed_from_list (output_bfd,
+ isec->output_section)))
continue;
/* Get the name of the symbol. */
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without "
"--enable-non-contiguous-regions.\n"),
stub_entry->target_section);
if (hstub->target_section != NULL
&& hstub->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
hstub->target_section);
}
else if (link_info.non_contiguous_regions_warnings)
einfo (_("%P:%pS: warning: --enable-non-contiguous-regions makes "
- "section `%pA' from '%pB' match /DISCARD/ clause.\n"),
+ "section `%pA' from `%pB' match /DISCARD/ clause.\n"),
NULL, section, section->owner);
return;
if (link_info.non_contiguous_regions_warnings && output->bfd_section)
einfo (_("%P:%pS: warning: --enable-non-contiguous-regions may "
- "change behaviour for section `%pA' from '%pB' (assigned to "
+ "change behaviour for section `%pA' from `%pB' (assigned to "
"%pA, but additional match: %pA)\n"),
NULL, section, section->owner, section->output_section,
output->bfd_section);
if (dot + TO_ADDR (i->size) > end)
{
if (i->flags & SEC_LINKER_CREATED)
- einfo (_("%F%P: Output section '%s' not large enough for the "
- "linker-created stubs section '%s'.\n"),
- i->output_section->name, i->name);
+ einfo (_("%F%P: Output section `%pA' not large enough for "
+ "the linker-created stubs section `%pA'.\n"),
+ i->output_section, i);
if (i->rawsize && i->rawsize != i->size)
einfo (_("%F%P: Relaxation not supported with "
- "--enable-non-contiguous-regions (section '%s' "
- "would overflow '%s' after it changed size).\n"),
- i->name, i->output_section->name);
+ "--enable-non-contiguous-regions (section `%pA' "
+ "would overflow `%pA' after it changed size).\n"),
+ i, i->output_section);
*removed = 1;
dot = end;
}
}
+static void
+warn_non_contiguous_discards (void)
+{
+ LANG_FOR_EACH_INPUT_STATEMENT (file)
+ {
+ if ((file->the_bfd->flags & (BFD_LINKER_CREATED | DYNAMIC)) != 0
+ || file->flags.just_syms)
+ continue;
+
+ for (asection *s = file->the_bfd->sections; s != NULL; s = s->next)
+ if (s->output_section == NULL
+ && (s->flags & SEC_LINKER_CREATED) == 0)
+ einfo (_("%P: warning: --enable-non-contiguous-regions "
+ "discards section `%pA' from `%pB'\n"),
+ s, file->the_bfd);
+ }
+}
+
static void
reset_one_wild (lang_statement_union_type *statement)
{
if (command_line.check_section_addresses)
lang_check_section_addresses ();
+ if (link_info.non_contiguous_regions
+ && link_info.non_contiguous_regions_warnings)
+ warn_non_contiguous_discards ();
+
/* Check any required symbols are known. */
ldlang_check_require_defined_symbols ();
#name: non-contiguous-arm
#source: non-contiguous-arm.s
#ld: --enable-non-contiguous-regions -T non-contiguous-arm.ld
-# error: \A.*Could not assign '.code.4' to an output section. Retry without --enable-non-contiguous-regions.*\Z
+# error: .*Could not assign .?\.code\.4.? to an output section. Retry without --enable-non-contiguous-regions\.
#name: non-contiguous-arm4
#source: non-contiguous-arm.s
#ld: --enable-non-contiguous-regions -T non-contiguous-arm4.ld
-# error: \A.*Output section '.ramu' not large enough for the linker-created stubs section '.code.3.__stub'.*\Z
+# error: .*Output section .?\.ramu.? not large enough for the linker-created stubs section .?\.code\.3\.__stub.\.?
#name: non-contiguous-arm7
#source: non-contiguous-arm7.s
-#ld: --enable-non-contiguous-regions -T non-contiguous-arm7.ld
-#error: \A.*unresolvable R_ARM_ABS32 relocation against symbol .MY_BUF..*\Z
+#ld: --enable-non-contiguous-regions --enable-non-contiguous-regions-warnings -T non-contiguous-arm7.ld
+#error_output: non-contiguous-arm7.err
--- /dev/null
+.* may change behaviour for section .?\.bss.? from .*
+.* may change behaviour for section .?\.bss\.MY_BUF.? from .*
+.* discards section .?\.bss\.MY_BUF.? from .*
+.* unresolvable R_ARM_ABS32 relocation against symbol .?MY_BUF.?
#name: non-contiguous-powerpc
#source: non-contiguous-powerpc.s
#ld: --enable-non-contiguous-regions -T non-contiguous-powerpc.ld
-#error: \A.*Relaxation not supported with --enable-non-contiguous-regions.*
+#error: .*Relaxation not supported with --enable-non-contiguous-regions.*
#skip: powerpc64*-*
#source: non-contiguous-powerpc.s
#as: -a64
#ld: -melf64ppc --enable-non-contiguous-regions -T non-contiguous-powerpc.ld
-#error: .*Could not assign group.*
+#error: .*Could not assign .?\.text\.one\.stub.? to an output section\. Retry without --enable-non-contiguous-regions\.