md_apply_fix3 bug on arm-linux
Richard Earnshaw
rearnsha@arm.com
Wed Apr 14 17:54:00 GMT 2004
> A user reports that "mov r0, #UNDEFINED_SYMBOL" assembles to "mov r0,
> #0" without emitting any relocation or diagnostic, which clearly isn't
> right.
>
> Also, this code:
>
> .word 0
> foo:
> mov r0, #foo
>
> assembles to "mov r0, #4", again with no relocation, which also seems
> fairly bogus.
>
> A patch like the one below seems to clear it up. Does this look right?
> I guess I should also generate some cases for the testsuite.
>
> Thanks
>
> p.
>
>
> 2004-04-05 Philip Blundell <philb@gnu.org>
>
> * config/tc-arm.c (md_apply_fix3): Decline to handle IMMEDIATE
> relocs involving symbols.
Argh!! md_apply_fix3 makes my brain hurt...
After a long stare at the code I wonder whether the bug is that the
BFD_RELOC_ARM_IMMEDIATE case unconditionally sets fixP->fx_done; but I
think for all the cases that matter the earlier code
if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
fixP->fx_done = 1;
will have already done this.
>
> --- gas/config/tc-arm.c 2004-04-05 19:40:42.000000000 +0100
> +++ gas/config/tc-arm.c 2004-04-05 19:40:36.000000000 +0100
> @@ -12190,6 +12167,10 @@
> switch (fixP->fx_r_type)
> {
> case BFD_RELOC_ARM_IMMEDIATE:
> + /* If a symbol is involved, we must leave this to the linker. */
> + if (fixP->fx_addsy)
> + return;
> +
> newimm = validate_immediate (value);
> temp = md_chars_to_number (buf, INSN_SIZE);
>
>
More information about the Binutils
mailing list