From 168495916d891806c847de908d2641d37c4bc21a Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 13 Sep 2021 11:02:48 +0100 Subject: [PATCH] MIPS: don't use get_symbol_name() for section parsing. With s_change_section() later calling obj_elf_section(), it seems better to pre-parse the section name by the same function that will be used there. This way no differences in what is accepted will result. gas * config/tc-mips.c (s_change_section): Use obj_elf_section_name to parse the section name. --- gas/ChangeLog | 1 + gas/config/tc-mips.c | 21 +++++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9d6ecf3ce4d..a19515a82d6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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 diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 0201f816814..dfe84c1fb8a 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -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 (§ion_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 -- 2.30.2