mirror of https://github.com/proxmox/mirror_qemu
microblaze: fix custom fprintf
Using GCC-4.2.4-1ubuntu4, there is a warning: microblaze-dis.c:792: warning: unused variable 'fprintf' Indeed, fprintf() is shadowed by a custom redefinition but is not used because of FORTIFY_SOURCE option which replace calls to fprintf() by fprintf_chk(). So, fprintf refers to the libc implementation instead of the qemu one. It's a bug. It is fixed by renaming the variable to something different of "fprintf". It prevents from hazardous shadowing. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>master
parent
14a6063a91
commit
aacf456387
|
@ -789,7 +789,7 @@ read_insn_microblaze (bfd_vma memaddr,
|
||||||
int
|
int
|
||||||
print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
||||||
{
|
{
|
||||||
fprintf_ftype fprintf = info->fprintf_func;
|
fprintf_ftype fprintf_func = info->fprintf_func;
|
||||||
void * stream = info->stream;
|
void * stream = info->stream;
|
||||||
unsigned long inst, prev_inst;
|
unsigned long inst, prev_inst;
|
||||||
struct op_code_struct * op, *pop;
|
struct op_code_struct * op, *pop;
|
||||||
|
@ -826,19 +826,19 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
||||||
prev_insn_vma = curr_insn_vma;
|
prev_insn_vma = curr_insn_vma;
|
||||||
|
|
||||||
if (op->name == 0) {
|
if (op->name == 0) {
|
||||||
fprintf (stream, ".short 0x%04lx", inst);
|
fprintf_func (stream, ".short 0x%04lx", inst);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf (stream, "%s", op->name);
|
fprintf_func (stream, "%s", op->name);
|
||||||
|
|
||||||
switch (op->inst_type)
|
switch (op->inst_type)
|
||||||
{
|
{
|
||||||
case INST_TYPE_RD_R1_R2:
|
case INST_TYPE_RD_R1_R2:
|
||||||
fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_r2(inst));
|
fprintf_func(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_r2(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_R1_IMM:
|
case INST_TYPE_RD_R1_IMM:
|
||||||
fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm(inst));
|
fprintf_func(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm(inst));
|
||||||
if (info->print_address_func && get_int_field_r1(inst) == 0 && info->symbol_at_address_func) {
|
if (info->print_address_func && get_int_field_r1(inst) == 0 && info->symbol_at_address_func) {
|
||||||
if (immfound)
|
if (immfound)
|
||||||
immval |= (get_int_field_imm(inst) & 0x0000ffff);
|
immval |= (get_int_field_imm(inst) & 0x0000ffff);
|
||||||
|
@ -848,34 +848,34 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
||||||
immval |= 0xFFFF0000;
|
immval |= 0xFFFF0000;
|
||||||
}
|
}
|
||||||
if (immval > 0 && info->symbol_at_address_func(immval, info)) {
|
if (immval > 0 && info->symbol_at_address_func(immval, info)) {
|
||||||
fprintf (stream, "\t// ");
|
fprintf_func (stream, "\t// ");
|
||||||
info->print_address_func (immval, info);
|
info->print_address_func (immval, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_R1_IMM5:
|
case INST_TYPE_RD_R1_IMM5:
|
||||||
fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm5(inst));
|
fprintf_func(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm5(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_RFSL:
|
case INST_TYPE_RD_RFSL:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_rfsl(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_rfsl(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_R1_RFSL:
|
case INST_TYPE_R1_RFSL:
|
||||||
fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_rfsl(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_r1(inst), get_field_rfsl(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_SPECIAL:
|
case INST_TYPE_RD_SPECIAL:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_special(inst, op));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_special(inst, op));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_SPECIAL_R1:
|
case INST_TYPE_SPECIAL_R1:
|
||||||
fprintf(stream, "\t%s, %s", get_field_special(inst, op), get_field_r1(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_special(inst, op), get_field_r1(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_R1:
|
case INST_TYPE_RD_R1:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r1(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_r1(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_R1_R2:
|
case INST_TYPE_R1_R2:
|
||||||
fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_r2(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_r1(inst), get_field_r2(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_R1_IMM:
|
case INST_TYPE_R1_IMM:
|
||||||
fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_imm(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_r1(inst), get_field_imm(inst));
|
||||||
/* The non-pc relative instructions are returns, which shouldn't
|
/* The non-pc relative instructions are returns, which shouldn't
|
||||||
have a label printed */
|
have a label printed */
|
||||||
if (info->print_address_func && op->inst_offset_type == INST_PC_OFFSET && info->symbol_at_address_func) {
|
if (info->print_address_func && op->inst_offset_type == INST_PC_OFFSET && info->symbol_at_address_func) {
|
||||||
|
@ -888,16 +888,16 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
||||||
}
|
}
|
||||||
immval += memaddr;
|
immval += memaddr;
|
||||||
if (immval > 0 && info->symbol_at_address_func(immval, info)) {
|
if (immval > 0 && info->symbol_at_address_func(immval, info)) {
|
||||||
fprintf (stream, "\t// ");
|
fprintf_func (stream, "\t// ");
|
||||||
info->print_address_func (immval, info);
|
info->print_address_func (immval, info);
|
||||||
} else {
|
} else {
|
||||||
fprintf (stream, "\t\t// ");
|
fprintf_func (stream, "\t\t// ");
|
||||||
fprintf (stream, "%x", immval);
|
fprintf_func (stream, "%x", immval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_IMM:
|
case INST_TYPE_RD_IMM:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_imm(inst));
|
||||||
if (info->print_address_func && info->symbol_at_address_func) {
|
if (info->print_address_func && info->symbol_at_address_func) {
|
||||||
if (immfound)
|
if (immfound)
|
||||||
immval |= (get_int_field_imm(inst) & 0x0000ffff);
|
immval |= (get_int_field_imm(inst) & 0x0000ffff);
|
||||||
|
@ -909,13 +909,13 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
||||||
if (op->inst_offset_type == INST_PC_OFFSET)
|
if (op->inst_offset_type == INST_PC_OFFSET)
|
||||||
immval += (int) memaddr;
|
immval += (int) memaddr;
|
||||||
if (info->symbol_at_address_func(immval, info)) {
|
if (info->symbol_at_address_func(immval, info)) {
|
||||||
fprintf (stream, "\t// ");
|
fprintf_func (stream, "\t// ");
|
||||||
info->print_address_func (immval, info);
|
info->print_address_func (immval, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_IMM:
|
case INST_TYPE_IMM:
|
||||||
fprintf(stream, "\t%s", get_field_imm(inst));
|
fprintf_func(stream, "\t%s", get_field_imm(inst));
|
||||||
if (info->print_address_func && info->symbol_at_address_func && op->instr != imm) {
|
if (info->print_address_func && info->symbol_at_address_func && op->instr != imm) {
|
||||||
if (immfound)
|
if (immfound)
|
||||||
immval |= (get_int_field_imm(inst) & 0x0000ffff);
|
immval |= (get_int_field_imm(inst) & 0x0000ffff);
|
||||||
|
@ -927,39 +927,39 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
|
||||||
if (op->inst_offset_type == INST_PC_OFFSET)
|
if (op->inst_offset_type == INST_PC_OFFSET)
|
||||||
immval += (int) memaddr;
|
immval += (int) memaddr;
|
||||||
if (immval > 0 && info->symbol_at_address_func(immval, info)) {
|
if (immval > 0 && info->symbol_at_address_func(immval, info)) {
|
||||||
fprintf (stream, "\t// ");
|
fprintf_func (stream, "\t// ");
|
||||||
info->print_address_func (immval, info);
|
info->print_address_func (immval, info);
|
||||||
} else if (op->inst_offset_type == INST_PC_OFFSET) {
|
} else if (op->inst_offset_type == INST_PC_OFFSET) {
|
||||||
fprintf (stream, "\t\t// ");
|
fprintf_func (stream, "\t\t// ");
|
||||||
fprintf (stream, "%x", immval);
|
fprintf_func (stream, "%x", immval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_R2:
|
case INST_TYPE_RD_R2:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_R2:
|
case INST_TYPE_R2:
|
||||||
fprintf(stream, "\t%s", get_field_r2(inst));
|
fprintf_func(stream, "\t%s", get_field_r2(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_R1:
|
case INST_TYPE_R1:
|
||||||
fprintf(stream, "\t%s", get_field_r1(inst));
|
fprintf_func(stream, "\t%s", get_field_r1(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_R1_SPECIAL:
|
case INST_TYPE_RD_R1_SPECIAL:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RD_IMM15:
|
case INST_TYPE_RD_IMM15:
|
||||||
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm15(inst));
|
fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_imm15(inst));
|
||||||
break;
|
break;
|
||||||
/* For tuqula instruction */
|
/* For tuqula instruction */
|
||||||
case INST_TYPE_RD:
|
case INST_TYPE_RD:
|
||||||
fprintf(stream, "\t%s", get_field_rd(inst));
|
fprintf_func(stream, "\t%s", get_field_rd(inst));
|
||||||
break;
|
break;
|
||||||
case INST_TYPE_RFSL:
|
case INST_TYPE_RFSL:
|
||||||
fprintf(stream, "\t%s", get_field_rfsl(inst));
|
fprintf_func(stream, "\t%s", get_field_rfsl(inst));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* if the disassembler lags the instruction set */
|
/* if the disassembler lags the instruction set */
|
||||||
fprintf (stream, "\tundecoded operands, inst is 0x%04lx", inst);
|
fprintf_func (stream, "\tundecoded operands, inst is 0x%04lx", inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue