Fix seg-faults when fetching the frags of local symbols.
authorChen Gang <gang.chen.5i5j@gmail.com>
Fri, 13 Jun 2014 15:07:21 +0000 (16:07 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 13 Jun 2014 15:07:21 +0000 (16:07 +0100)
* config/tc-score7.c: (s7_b32_relax_to_b16): Use symbol_get_frag() to access a symbol's frag.
* config/tc-score.c (s3_relax_branch_inst16): Likewise.
(s3_relax_cmpbranch_inst32): Likewise.

gas/ChangeLog
gas/config/tc-score.c
gas/config/tc-score7.c

index 265a272274207ba94818576a20b9c5dea3bdc99c..31c6291bc56c7525dbc6e23c67ca1965f430ebac 100644 (file)
@@ -2,6 +2,10 @@
 
        * config/tc-score7.c: Replace sprintf with strcpy where
        appropriate.
+       (s7_b32_relax_to_b16): Use symbol_get_frag() to access a symbol's
+       frag.
+       * config/tc-score.c (s3_relax_branch_inst16): Likewise.
+       (s3_relax_cmpbranch_inst32): Likewise.
 
 2014-06-07  Alan Modra  <amodra@gmail.com>
 
index 6242b8c5b8eb76712beffb118f554c551283d848..e8c8b6ddb77048414275968427003a3b1c6e1672 100644 (file)
@@ -6854,8 +6854,8 @@ s3_relax_branch_inst16 (fragS * fragp)
     frag_addr = 0;
   else
     {
-      if (s->bsym != 0)
-        symbol_address = (addressT) s->sy_frag->fr_address;
+      if (s->bsym != NULL)
+        symbol_address = (addressT) symbol_get_frag (s)->fr_address;
     }
 
   inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE);
@@ -6901,8 +6901,8 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
     frag_addr = 0;
   else
     {
-      if (s->bsym != 0)
-        symbol_address = (addressT) s->sy_frag->fr_address;
+      if (s->bsym != NULL)
+       symbol_address = (addressT) symbol_get_frag (s)->fr_address;
     }
 
   inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE);
index 4719680e0c7e1cd1dbc84c07d1b398fa98a02155..7bf0ad6ff1a2b5c63b48e3ba80fbeca1554383ad 100644 (file)
@@ -5263,8 +5263,8 @@ s7_b32_relax_to_b16 (fragS * fragp)
     frag_addr = 0;
   else
     {
-      if (s->bsym != 0)
-       symbol_address = (addressT) s->sy_frag->fr_address;
+      if (s->bsym != NULL)
+       symbol_address = (addressT) symbol_get_frag (s)->fr_address;
     }
 
   value = s7_md_chars_to_number (fragp->fr_literal, s7_INSN_SIZE);