[PATCH]: msp430: bugfix for pcrel jump

Dmitry dmitryd@astrosoft.ru
Thu Dec 23 14:16:00 GMT 2004


Fellows,
Here is a patch which fixes a fixup for pc relative jump to global symbol.

Cheers,
Dmitry




2004-12-23  Dmitry Diky  <diwil@spec.ru>
 * config/tc-msp430.c (md_apply_fix3): Fix offset calculation for global label



Index: config/tc-msp430.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-msp430.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 tc-msp430.c
*** config/tc-msp430.c  19 Nov 2004 12:28:03 -0000      1.12
--- config/tc-msp430.c  23 Dec 2004 14:14:59 -0000
*************** md_apply_fix3 (fixS * fixp, valueT * val
*** 1851,1857 ****

        if (fixp->fx_addsy && (s == seg || s == absolute_section))
        {
!         value = S_GET_VALUE (fixp->fx_addsy) + *valuep;
          fixp->fx_done = 1;
        }
        else
--- 1851,1871 ----

        if (fixp->fx_addsy && (s == seg || s == absolute_section))
        {
!         /* FIXME: we can appear here only in case if we perform a pc
!            relative jump to the label which is i) global, ii) locally
!            defined or this is a jump to an absolute symbol.
!            If this is an absolute symbol -- everything is Ok.
!            If this is a global label, we've got a symbol value defined
!            twice:
!              1. S_GET_VALUE (fixp->fx_addsy) will contain a symbol offset
!                 from this section start
!              2. *valuep will contain the real offset from jump insn to the
!                 label
!            So, the result of S_GET_VALUE (fixp->fx_addsy) +  *valuep;
!            will be incorrect. Therefore remove s_get_value.
!
!          */
!         value = /* S_GET_VALUE (fixp->fx_addsy) + */ *valuep;
          fixp->fx_done = 1;
        }
        else



More information about the Binutils mailing list