Multi-arch bug in gas - tc_fix_adjustable

Nick Kelsey nickk@ubicom.com
Tue Dec 17 14:47:00 GMT 2002


Hi,

I have just added a tc_fix_adjustable function to the ip2k port and I think
there is a problem...

Cgen generated archs use a temporary number (BFD_RELOC_UNUSED +
operand->type) in fix->fx_r_type to describe the type, which then gets
converted into the propper BFD type by gas_cgen_md_apply_fix3.

The problem is that gas write.c calls the arch dependant tc_fix_adjustable
function before fix->fx_r_type, and most cgen based archs that I have
checked have an if or switch statement based on fix->fx_r_type that compares
it with BFD types.

For example:

tc-arm.c:

bfd_boolean
arm_fix_adjustable (fixP)
   fixS * fixP;
{
  if (fixP->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE)
    return 1;
  return 0;
}

This compare will always fail as 'BFD_RELOC_UNUSED + operand->type' will
never match any BFD_RELOC define.

I check a few other cgen based ports and they all have this style of code.

To make the ip2k implementation work I am using fixP->fx_cgen.opinfo, not
fixP->fx_r_type.

Nick




More information about the Binutils mailing list