make xtensa_section_rename () take const char *
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Sun, 20 Mar 2016 05:37:55 +0000 (01:37 -0400)
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Thu, 31 Mar 2016 11:30:41 +0000 (07:30 -0400)
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.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-xtensa.c (struct rename_section_struct): Make old_name
const.
(xtensa_section_rename): Make argument type const char *.
* config/tc-xtensa.h (xtensa_section_rename): Adjust.

gas/ChangeLog
gas/config/tc-xtensa.c
gas/config/tc-xtensa.h

index 90ed4aee8c2f75da1adf21c4631d7313e6f4d2f2..3294a8ff959b6dcb4888397a671e792d47be6a1f 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
+       * config/tc-xtensa.c (struct rename_section_struct): Make old_name
+       const.
+       (xtensa_section_rename): Make argument type const char *.
+       * config/tc-xtensa.h (xtensa_section_rename): Adjust.
+
 2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
        * config/tc-i960.c (parse_ldconst): Cast to char * when assigning to
index abefdd2429ad0cd6e04e16ed023a2ef1353edede..fe16659fbbb19918bd895e549edc3d841d787a89 100644 (file)
@@ -13104,7 +13104,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;
 };
@@ -13177,7 +13177,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;
 
@@ -13187,5 +13187,5 @@ xtensa_section_rename (char *name)
        return r->new_name;
     }
 
-  return name;
+  return (char *) name;
 }
index c8a5029bce4c924feebc6bce0fe1292876473277..2c7b16e554363260d356832a887dcd142c3c7cca 100644 (file)
@@ -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
This page took 0.034257 seconds and 4 git commands to generate.