]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
xtensa: move xtensa_make_property_section from bfd to gas
authorAlan Modra <amodra@gmail.com>
Sat, 24 Feb 2024 01:00:02 +0000 (11:30 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 24 Feb 2024 04:28:55 +0000 (14:58 +1030)
This function is only used by gas, so move it there.  Necessary for
gas to keep track of group sections as they are created.

PR 25333
bfd/
* elf32-xtensa.c (xtensa_make_property_section): Delete.
(xtensa_property_section_name): Make public.
include/
* elf/xtensa.h (xtensa_make_property_section): Delete.
(xtensa_property_section_name): Declare
gas/
* config/tc-xtensa.c (xtensa_make_property_section): New,
moved from elf32-xtensa.c.

bfd/elf32-xtensa.c
gas/config/tc-xtensa.c
include/elf/xtensa.h

index 4061341d38f419e5a0f7c17080443174a3ccbadb..e73f96a7dcc4d482a46ef52254d7472ea3b517aa 100644 (file)
@@ -11253,7 +11253,7 @@ xtensa_add_names (const char *base, const char *suffix)
 
 static int linkonce_len = sizeof (".gnu.linkonce.") - 1;
 
-static char *
+char *
 xtensa_property_section_name (asection *sec, const char *base_name,
                              bool separate_sections)
 {
@@ -11335,38 +11335,6 @@ xtensa_get_property_section (asection *sec, const char *base_name)
 }
 
 
-asection *
-xtensa_make_property_section (asection *sec, const char *base_name)
-{
-  char *prop_sec_name;
-  asection *prop_sec;
-
-  /* Check if the section already exists.  */
-  prop_sec_name = xtensa_property_section_name (sec, base_name,
-                                               elf32xtensa_separate_props);
-  prop_sec = bfd_get_section_by_name_if (sec->owner, prop_sec_name,
-                                        match_section_group,
-                                        (void *) elf_group_name (sec));
-  /* If not, create it.  */
-  if (! prop_sec)
-    {
-      flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY);
-      flags |= (bfd_section_flags (sec)
-               & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES));
-
-      prop_sec = bfd_make_section_anyway_with_flags
-       (sec->owner, strdup (prop_sec_name), flags);
-      if (! prop_sec)
-       return 0;
-
-      elf_group_name (prop_sec) = elf_group_name (sec);
-    }
-
-  free (prop_sec_name);
-  return prop_sec;
-}
-
-
 flagword
 xtensa_get_property_predef_flags (asection *sec)
 {
index c6e6881ae687bbdc1575f99b9da23562e97d5f58..188715d9619ee759d2910bf13d9ef52464e5136d 100644 (file)
@@ -11789,6 +11789,36 @@ get_frag_is_literal (const fragS *fragP)
   return fragP->tc_frag_data.is_literal;
 }
 
+static asection *
+xtensa_make_property_section (asection *sec, const char *base_name)
+{
+  char *prop_sec_name;
+  asection *prop_sec;
+
+  /* Check if the section already exists.  */
+  prop_sec_name = xtensa_property_section_name (sec, base_name,
+                                               elf32xtensa_separate_props);
+  prop_sec = bfd_get_section_by_name_if (sec->owner, prop_sec_name,
+                                        match_section_group,
+                                        (void *) elf_group_name (sec));
+  /* If not, create it.  */
+  if (! prop_sec)
+    {
+      flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY);
+      flags |= (bfd_section_flags (sec)
+               & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES));
+
+      prop_sec = bfd_make_section_anyway_with_flags
+       (sec->owner, strdup (prop_sec_name), flags);
+      if (! prop_sec)
+       return 0;
+
+      elf_group_name (prop_sec) = elf_group_name (sec);
+    }
+
+  free (prop_sec_name);
+  return prop_sec;
+}
 
 static void
 xtensa_create_property_segments (frag_predicate property_function,
index 402d9ad54656a81b0a143b1ba827ae4e3d9f9c58..523855e7e8128b05de9b881ea03b7ea55c310cea 100644 (file)
@@ -215,7 +215,7 @@ typedef struct property_table_entry_t
 
 #define XTENSA_PROP_INSN_ABSLIT        0x00020000
 
-extern asection *xtensa_make_property_section (asection *, const char *);
+extern char *xtensa_property_section_name (asection *, const char *, bool);
 extern int
 xtensa_read_table_entries (bfd *abfd,
                           asection *section,