Add support for non-contiguous memory regions
[deliverable/binutils-gdb.git] / ld / emultempl / xtensaelf.em
index b88f5f1a3c8bb42d42e14032d7e29537fdeba722..74bd11c6b00092ce08e0f626b358c5928bf60c7d 100644 (file)
@@ -1,5 +1,5 @@
 # This shell script emits a C file. -*- C -*-
-#   Copyright (C) 2003-2018 Free Software Foundation, Inc.
+#   Copyright (C) 2003-2020 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -19,7 +19,7 @@
 # MA 02110-1301, USA.
 #
 
-# This file is sourced from elf32.em, and defines extra xtensa-elf
+# This file is sourced from elf.em, and defines extra xtensa-elf
 # specific routines.
 #
 fragment <<EOF
@@ -127,9 +127,9 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
   /* Create a property table section for it.  */
   prop_sec_name = strdup (prop_sec_name);
   prop_sec = bfd_make_section_with_flags
-    (abfd, prop_sec_name, bfd_get_section_flags (abfd, insn_sec));
+    (abfd, prop_sec_name, bfd_section_flags (insn_sec));
   if (prop_sec == NULL
-      || ! bfd_set_section_alignment (abfd, prop_sec, 2))
+      || !bfd_set_section_alignment (prop_sec, 2))
     {
       *error_message = _("could not create new section");
       goto cleanup;
@@ -247,7 +247,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec)
   char *owned_prop_sec_name = NULL;
   const char *sec_name;
 
-  sec_name = bfd_get_section_name (abfd, sec);
+  sec_name = bfd_section_name (sec);
   if (strcmp (sec_name, INSN_SEC_BASE_NAME) == 0)
     {
       insn_sec_name = INSN_SEC_BASE_NAME;
@@ -384,7 +384,7 @@ check_xtensa_info (bfd *abfd, asection *info_sec)
 
   data = xmalloc (info_sec->size);
   if (! bfd_get_section_contents (abfd, info_sec, data, 0, info_sec->size))
-    einfo (_("%F%P:%pB: cannot read contents of section %pA\n"), abfd, info_sec);
+    einfo (_("%F%P: %pB: cannot read contents of section %pA\n"), abfd, info_sec);
 
   if (info_sec->size > 24
       && info_sec->size >= 24 + bfd_get_32 (abfd, data + 4)
@@ -395,11 +395,11 @@ check_xtensa_info (bfd *abfd, asection *info_sec)
                                          &mismatch, &errmsg))
     {
       if (mismatch)
-       einfo (_("%P:%pB: warning: incompatible Xtensa configuration (%s)\n"),
+       einfo (_("%P: %pB: warning: incompatible Xtensa configuration (%s)\n"),
               abfd, errmsg);
     }
   else
-    einfo (_("%P:%pB: warning: cannot parse .xtensa.info section\n"), abfd);
+    einfo (_("%P: %pB: warning: cannot parse .xtensa.info section\n"), abfd);
 
   free (data);
 }
@@ -596,8 +596,12 @@ xtensa_get_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
   /* We have a separate function for this so that
      we could in the future keep a completely independent
      structure that maps a section to its dependence edges.
-     For now, we place these in the sec->userdata field.  */
-  reloc_deps_section *sec_deps = sec->userdata;
+     For now, we place these in the sec->userdata field.
+     This doesn't clash with ldlang.c use of userdata for output
+     sections, and during map output for input sections, since the
+     xtensa use is only for input sections and only extant in
+     before_allocation.  */
+  reloc_deps_section *sec_deps = bfd_section_userdata (sec);
   return sec_deps;
 }
 
@@ -606,7 +610,7 @@ xtensa_set_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
                         asection *sec,
                         reloc_deps_section *deps_section)
 {
-  sec->userdata = deps_section;
+  bfd_set_section_userdata (sec, deps_section);
 }
 
 
@@ -1220,6 +1224,12 @@ ld_build_required_section_dependence (lang_statement_union_type *s)
     {
       lang_statement_union_type *l = iter_stack_current (&stack);
 
+      if (l == NULL && link_info.non_contiguous_regions)
+       {
+         einfo (_("Relaxation not supported with --enable-non-contiguous-regions.\n"));
+         abort();
+       }
+
       if (l->header.type == lang_input_section_enum)
        {
          lang_input_section_type *input;
@@ -1293,10 +1303,10 @@ static bfd_boolean
 is_inconsistent_linkonce_section (asection *sec)
 {
   bfd *abfd = sec->owner;
-  const char *sec_name = bfd_get_section_name (abfd, sec);
+  const char *sec_name = bfd_section_name (sec);
   const char *name;
 
-  if ((bfd_get_section_flags (abfd, sec) & SEC_LINK_ONCE) == 0
+  if ((bfd_section_flags (sec) & SEC_LINK_ONCE) == 0
       || strncmp (sec_name, ".gnu.linkonce.", linkonce_len) != 0)
     return FALSE;
 
This page took 0.026462 seconds and 4 git commands to generate.