* write.c (fixup_segment): Only perform the subtraction of an
authorNick Clifton <nickc@redhat.com>
Mon, 2 Jul 2012 07:35:06 +0000 (07:35 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 2 Jul 2012 07:35:06 +0000 (07:35 +0000)
fx_subsy symbol if MD_APPLY_SYM_VALUE allows it and the symbol is
properly defined.
* config/tc-msp430.h (MD_APPLY_SYM_VALUE): Define.

gas/ChangeLog
gas/config/tc-msp430.h
gas/write.c

index 57a6bcbc741a05ed0f9c2bc2709f5bad69d6ee41..b1a544666e53855ef2f210dbc9e7ec9d2b41855d 100644 (file)
@@ -1,3 +1,10 @@
+2012-07-02  Nick Clifton  <nickc@redhat.com>
+
+       * write.c (fixup_segment): Only perform the subtraction of an
+       fx_subsy symbol if MD_APPLY_SYM_VALUE allows it and the symbol is
+       properly defined.
+       * config/tc-msp430.h (MD_APPLY_SYM_VALUE): Define.
+
 2012-06-30  Alan Modra  <amodra@gmail.com>
 
        PR gas/14315
index 2f7aea254abadf54885d5a47a6b2c7e412fc751b..118b46d3f9d1ed68d315474ba7074d0b94bd1907 100644 (file)
@@ -73,6 +73,8 @@
      and define `md_create_long_jump' to create a long jump.  */
 
 #define MD_APPLY_FIX3
+/* Values passed to md_apply_fix don't include symbol values.  */
+#define MD_APPLY_SYM_VALUE(FIX) 0
 
 #define TC_HANDLES_FX_DONE
 
index 7fb2e8bb3b97683152c9a70903a1aed1fd907271..a4671475af608ea281caccf8832799caef5c13f7 100644 (file)
@@ -1004,12 +1004,7 @@ fixup_segment (fixS *fixP, segT this_segment)
              fixP->fx_subsy = NULL;
              fixP->fx_pcrel = 1;
            }
-         else if (TC_VALIDATE_FIX_SUB (fixP, add_symbol_segment))
-           /* If the fix is valid, subtract fx_subsy here.  The addition of
-              fx_addsy will be performed below.  Doing this prevents bogus
-              warnings from the range check below.  */
-             add_number -= S_GET_VALUE (fixP->fx_subsy);
-         else
+         else if (!TC_VALIDATE_FIX_SUB (fixP, add_symbol_segment))
            {
              if (!md_register_arithmetic
                  && (add_symbol_segment == reg_section
@@ -1024,6 +1019,10 @@ fixup_segment (fixS *fixP, segT this_segment)
                              S_GET_NAME (fixP->fx_subsy),
                              segment_name (sub_symbol_segment));
            }
+         else if (sub_symbol_segment != undefined_section
+                  && ! bfd_is_com_section (sub_symbol_segment)
+                  && MD_APPLY_SYM_VALUE (fixP))
+           add_number -= S_GET_VALUE (fixP->fx_subsy);
        }
 
       if (fixP->fx_addsy)