aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-xtensa.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-02-24 11:30:02 +1030
committerAlan Modra <amodra@gmail.com>2024-02-24 14:58:55 +1030
commitbc45bfd25984a709dec4236daf412c58a127633a (patch)
treeb7924f8492641c071ec0f1f8bc3aa0cef05ed683 /gas/config/tc-xtensa.c
parent9c697157b823b052c6044f676d90a87aea6d173f (diff)
downloadbinutils-bc45bfd25984a709dec4236daf412c58a127633a.zip
binutils-bc45bfd25984a709dec4236daf412c58a127633a.tar.gz
binutils-bc45bfd25984a709dec4236daf412c58a127633a.tar.bz2
xtensa: move xtensa_make_property_section from bfd to gas
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.
Diffstat (limited to 'gas/config/tc-xtensa.c')
-rw-r--r--gas/config/tc-xtensa.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index c6e6881..188715d 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -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,