aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-09-13 11:02:48 +0100
committerNick Clifton <nickc@redhat.com>2021-09-13 11:02:48 +0100
commit168495916d891806c847de908d2641d37c4bc21a (patch)
treeb9810953df0281239e3f28dda3292e08864abc6c
parent5a2947cf171a3e5fbadfe6f9ea94c26fb44d39e2 (diff)
downloadfsf-binutils-gdb-168495916d891806c847de908d2641d37c4bc21a.zip
fsf-binutils-gdb-168495916d891806c847de908d2641d37c4bc21a.tar.gz
fsf-binutils-gdb-168495916d891806c847de908d2641d37c4bc21a.tar.bz2
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.
-rw-r--r--gas/ChangeLog1
-rw-r--r--gas/config/tc-mips.c21
2 files changed, 8 insertions, 14 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 9d6ecf3..a19515a 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 <nickc@redhat.com>
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 0201f81..dfe84c1 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 (&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