MIPS: don't use get_symbol_name() for section parsing. With s_change_section() later...
authorJan Beulich <jbeulich@suse.com>
Mon, 13 Sep 2021 10:02:48 +0000 (11:02 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 13 Sep 2021 10:02:48 +0000 (11:02 +0100)
gas * config/tc-mips.c (s_change_section): Use obj_elf_section_name to
parse the section name.

gas/ChangeLog
gas/config/tc-mips.c

index 9d6ecf3ce4d1e748d946afb08acb450702cf4c04..a19515a82d683b22a3a3bd9793d044da4be91ed3 100644 (file)
@@ -2,6 +2,7 @@
 
        * config/tc-ia64.c (cross_section): Use obj_elf_section_name to
        parse the section name.
+       * config/tc-mips.c (s_change_section): Likewise.
 
 2021-09-02  Nick Clifton  <nickc@redhat.com>
 
index 0201f8168147a2985b06a5ee9542b35307719b7e..dfe84c1fb8ae131213e03749430d76fc02cff890 100644 (file)
@@ -16371,33 +16371,29 @@ void
 s_change_section (int ignore ATTRIBUTE_UNUSED)
 {
   char *saved_ilp;
-  char *section_name;
-  char c, endc;
-  char next_c = 0;
+  const char *section_name;
+  char c, next_c = 0;
   int section_type;
   int section_flag;
   int section_entry_size;
   int section_alignment;
 
   saved_ilp = input_line_pointer;
-  endc = get_symbol_name (&section_name);
-  c = (endc == '"' ? input_line_pointer[1] : endc);
+  section_name = obj_elf_section_name ();
+  if (section_name == NULL)
+    return;
+  c = input_line_pointer[0];
   if (c)
-    next_c = input_line_pointer [(endc == '"' ? 2 : 1)];
+    next_c = input_line_pointer[1];
 
   /* Do we have .section Name<,"flags">?  */
   if (c != ',' || (c == ',' && next_c == '"'))
     {
-      /* Just after name is now '\0'.  */
-      (void) restore_line_pointer (endc);
       input_line_pointer = saved_ilp;
       obj_elf_section (ignore);
       return;
     }
 
-  section_name = xstrdup (section_name);
-  c = restore_line_pointer (endc);
-
   input_line_pointer++;
 
   /* Do we have .section Name<,type><,flag><,entry_size><,alignment>  */
@@ -16442,9 +16438,6 @@ s_change_section (int ignore ATTRIBUTE_UNUSED)
 
   obj_elf_change_section (section_name, section_type, section_flag,
                          section_entry_size, 0, 0, 0);
-
-  if (now_seg->name != section_name)
-    free (section_name);
 }
 
 void