This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 6/7] make xtensa_section_rename () take const char *

From: Trevor Saunders <>

Xtensa uses it in several macros passing it a literal string, so its convenient
for the argument type to be const char *.  However some of the code in
symbols.c seems to assume tc_canonicalize_symbol_name () will return a non
const pointer, and some other target's implementations even modify the
argument, so it seems best to return a char * which means casting away const on
the argument when we return it instead of another string.


2016-03-29  Trevor Saunders  <>

	* config/tc-xtensa.c (struct rename_section_struct): Make old_name
	(xtensa_section_rename): Make argument type const char *.
	* config/tc-xtensa.h (xtensa_section_rename): Adjust.
 gas/config/tc-xtensa.c | 6 +++---
 gas/config/tc-xtensa.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 3025d29..a74f689 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -13117,7 +13117,7 @@ copy_expr (expressionS *dst, const expressionS *src)
 struct rename_section_struct
-  char *old_name;
+  const char *old_name;
   char *new_name;
   struct rename_section_struct *next;
@@ -13190,7 +13190,7 @@ build_section_rename (const char *arg)
 char *
-xtensa_section_rename (char *name)
+xtensa_section_rename (const char *name)
   struct rename_section_struct *r = section_rename;
@@ -13200,5 +13200,5 @@ xtensa_section_rename (char *name)
 	return r->new_name;
-  return name;
+  return (char *) name;
diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h
index c8a5029..2c7b16e 100644
--- a/gas/config/tc-xtensa.h
+++ b/gas/config/tc-xtensa.h
@@ -333,7 +333,7 @@ extern void xtensa_elf_section_change_hook (void);
 extern int xtensa_unrecognized_line (int);
 extern bfd_boolean xtensa_check_inside_bundle (void);
 extern void xtensa_handle_align (fragS *);
-extern char *xtensa_section_rename (char *);
+extern char *xtensa_section_rename (const char *);
 #define TARGET_FORMAT			xtensa_target_format ()
 #define TARGET_ARCH			bfd_arch_xtensa

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]