This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ARM] gas miscompiles ADR statement


Hi Alan,

> I'm guilty.  The problem was introduced with my gas reloc rewrite.
> The following should fix it, but I'd like one of the ARM maintainers
> to OK it before I commit.
> 
> 	* config/tc-arm.c (arm_force_relocation): Return 0 for IMMEDIATE
> 	and ADRL_IMMEDIATE.

Approved - but ...

> +  /* Resolve immediate relocations even if the symbol is extern or weak.  */
> +  if (fixp->fx_r_type == BFD_RELOC_ARM_IMMEDIATE
> +      || fixp->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE)
> +    return 0;
> +
>    return S_FORCE_RELOC (fixp->fx_addsy);

I think that the comment is probably too general.  There are quite a
lot of other immediate relocations supported by the ARM:

  BFD_RELOC_ARM_OFFSET_IMM
  BFD_RELOC_ARM_SHIFT_IMM
  BFD_RELOC_ARM_SWI
  BFD_RELOC_ARM_CP_OFF_IMM
  BFD_RELOC_ARM_ADR_IMM
  BFD_RELOC_ARM_LDR_IMM
  BFD_RELOC_ARM_LITERAL
  BFD_RELOC_ARM_OFFSET_IMM8
  BFD_RELOC_ARM_HWLITERAL
  BFD_RELOC_ARM_THUMB_IMM

Plus - I think that it would be a very good idea to include Enrico's
little test program in the ARM GAS testsuite, so that this bug does
not resurface in the future.

Cheers
        Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]