aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-03-19 21:48:07 -0400
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-03-24 08:00:44 -0400
commite742e119e1a37c642240195d6b942d624120df82 (patch)
tree0c909db79bcafb05e69de1e56e977f47c09cacda
parenteda6e9a4a274e5b9d551d6251e55c5d2e88af643 (diff)
downloadgdb-e742e119e1a37c642240195d6b942d624120df82.zip
gdb-e742e119e1a37c642240195d6b942d624120df82.tar.gz
gdb-e742e119e1a37c642240195d6b942d624120df82.tar.bz2
make microblaze build with -Wwrite-strings
frag_var () assigns its last argument to frag::fr_opcode, and it turns out some targets modify the string that points to. However it appears niether the generic code or the microblaze code modifies what fr_opcode points to, so this code should be safe. So we unfortunately need to cast to char * when passing an argument to frag_var () but otherwise microblaze can itself point to these strings with const char *. gas/ChangeLog: 2016-03-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-microblaze.c (md_assemble): Cast opc to char * when calling frag_var ().
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-microblaze.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 29ec3ec..f1f588e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2016-03-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+ * config/tc-microblaze.c (md_assemble): Cast opc to char * when calling
+ frag_var ().
+
+2016-03-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
* config/tc-visium.c (md_atof): Localize the string returned on
failure.
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 70ceb21..0895ae9 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -840,8 +840,8 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
machine dependent instruction. This function is supposed to emit
the frags/bytes it assembles to. */
-static char * str_microblaze_ro_anchor = "RO";
-static char * str_microblaze_rw_anchor = "RW";
+static const char * str_microblaze_ro_anchor = "RO";
+static const char * str_microblaze_rw_anchor = "RW";
static bfd_boolean
check_spl_reg (unsigned * reg)
@@ -1014,7 +1014,7 @@ md_assemble (char * str)
if (exp.X_op != O_constant)
{
- char *opc;
+ const char *opc;
relax_substateT subtype;
if (streq (name, "lmi"))
@@ -1039,7 +1039,7 @@ md_assemble (char * str)
subtype, /* PC-relative or not. */
exp.X_add_symbol,
exp.X_add_number,
- opc);
+ (char *) opc);
immed = 0;
}
else