From f26c187e2933a0e99a9fbe1ccbcd97260c74b913 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Fri, 13 Jun 2014 16:07:21 +0100 Subject: [PATCH] Fix seg-faults when fetching the frags of local symbols. * 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 | 4 ++++ gas/config/tc-score.c | 8 ++++---- gas/config/tc-score7.c | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 265a2722742..31c6291bc56 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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 diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 6242b8c5b8e..e8c8b6ddb77 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -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); diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index 4719680e0c7..7bf0ad6ff1a 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -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); -- 2.30.2