aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Gang <gang.chen.5i5j@gmail.com>2014-06-13 16:07:21 +0100
committerNick Clifton <nickc@redhat.com>2014-06-13 16:07:21 +0100
commitf26c187e2933a0e99a9fbe1ccbcd97260c74b913 (patch)
treea5bcaaef8643bc173d7e0aa54046d5bf350a54a4
parent2132b4072fb1368afbc0405f909bdf67fcfee427 (diff)
downloadgdb-f26c187e2933a0e99a9fbe1ccbcd97260c74b913.zip
gdb-f26c187e2933a0e99a9fbe1ccbcd97260c74b913.tar.gz
gdb-f26c187e2933a0e99a9fbe1ccbcd97260c74b913.tar.bz2
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.
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-score.c8
-rw-r--r--gas/config/tc-score7.c4
3 files changed, 10 insertions, 6 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 265a272..31c6291 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 <amodra@gmail.com>
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index 6242b8c..e8c8b6d 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 4719680..7bf0ad6 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);