From 487b24d8c244263ee99ed7c6a307161b1328decc Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 7 Dec 2015 13:14:35 +1030 Subject: [PATCH] tc-ppc.c md_apply_fix tidy * config/tc-ppc.c (md_apply_fix): Localize variables. Reduce casts. --- gas/ChangeLog | 4 ++++ gas/config/tc-ppc.c | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index a676b7116cb..8a50708d67c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2015-12-07 Alan Modra + + * config/tc-ppc.c (md_apply_fix): Localize variables. Reduce casts. + 2015-12-04 Nick Clifton PR gas/19276 diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 03eaa92eea8..5232b009f67 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -6468,7 +6468,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) { valueT value = * valP; offsetT fieldval; - unsigned long insn = 0; const struct powerpc_operand *operand; #ifdef OBJ_ELF @@ -6636,8 +6635,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) if (operand != NULL) { /* Handle relocs in an insn. */ - char *where; - switch (fixP->fx_r_type) { #ifdef OBJ_ELF @@ -6798,22 +6795,25 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) #endif if ((fieldval != 0 && APPLY_RELOC) || operand->insert != NULL) { + unsigned long insn; + unsigned char *where; + /* Fetch the instruction, insert the fully resolved operand value, and stuff the instruction back again. */ - where = fixP->fx_frag->fr_literal + fixP->fx_where; + where = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where; if (target_big_endian) { if (fixP->fx_size == 4) - insn = bfd_getb32 ((unsigned char *) where); + insn = bfd_getb32 (where); else - insn = bfd_getb16 ((unsigned char *) where); + insn = bfd_getb16 (where); } else { if (fixP->fx_size == 4) - insn = bfd_getl32 ((unsigned char *) where); + insn = bfd_getl32 (where); else - insn = bfd_getl16 ((unsigned char *) where); + insn = bfd_getl16 (where); } insn = ppc_insert_operand (insn, operand, fieldval, fixP->tc_fix_data.ppc_cpu, @@ -6821,16 +6821,16 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) if (target_big_endian) { if (fixP->fx_size == 4) - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 (insn, where); else - bfd_putb16 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb16 (insn, where); } else { if (fixP->fx_size == 4) - bfd_putl32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putl32 (insn, where); else - bfd_putl16 ((bfd_vma) insn, (unsigned char *) where); + bfd_putl16 (insn, where); } } -- 2.30.2