diff options
author | M R Swami Reddy <MR.Swami.Reddy@nsc.com> | 2009-07-27 07:05:25 +0000 |
---|---|---|
committer | M R Swami Reddy <MR.Swami.Reddy@nsc.com> | 2009-07-27 07:05:25 +0000 |
commit | 7859b21da558a842c9d35c3cae480e38204d9892 (patch) | |
tree | 30f00d5baafe6e333a4b880b97f88a2e8cfb1fc1 /gas | |
parent | 86514226a5438800f5ad6df6959d530395e8e5df (diff) | |
download | gdb-7859b21da558a842c9d35c3cae480e38204d9892.zip gdb-7859b21da558a842c9d35c3cae480e38204d9892.tar.gz gdb-7859b21da558a842c9d35c3cae480e38204d9892.tar.bz2 |
2009-07-27 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* config/tc-cr16.c (md_apply_fix): Put the addend value alone in to
object file without symbol values.
(tc_gen_reloc): For local symbols resolved or its absolute symbol,
then set the relocation type as NULL.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-cr16.c | 72 |
2 files changed, 53 insertions, 26 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 3aec588..ffeb31c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2009-07-27 M R Swami Reddy <MR.Swami.Reddy@nsc.com> + + * config/tc-cr16.c (md_apply_fix): Put the addend value alone in to + object file without symbol values. + (tc_gen_reloc): For local symbols resolved or its absolute symbol, + then set the relocation type as NULL. + 2009-07-25 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (cpu_arch): Add l1om. diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index 1955775..da0799e 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -523,6 +523,13 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP) arelent * reloc; bfd_reloc_code_real_type code; + /* If symbols are local and resolved, then no relocation needed. */ + if ( ((fixP->fx_addsy) + && (S_GET_SEGMENT (fixP->fx_addsy) == absolute_section)) + || ((fixP->fx_subsy) + && (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section))) + return NULL; + reloc = xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); @@ -728,39 +735,52 @@ void md_apply_fix (fixS *fixP, valueT *valP, segT seg) { valueT val = * valP; - char *buf = fixP->fx_frag->fr_literal + fixP->fx_where; - fixP->fx_offset = 0; - - switch (fixP->fx_r_type) - { - case BFD_RELOC_CR16_NUM8: - bfd_put_8 (stdoutput, (unsigned char) val, buf); - break; - case BFD_RELOC_CR16_NUM16: - bfd_put_16 (stdoutput, val, buf); - break; - case BFD_RELOC_CR16_NUM32: - bfd_put_32 (stdoutput, val, buf); - break; - case BFD_RELOC_CR16_NUM32a: - bfd_put_32 (stdoutput, val, buf); - break; - default: - /* We shouldn't ever get here because linkrelax is nonzero. */ - abort (); - break; - } - - fixP->fx_done = 0; if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) fixP->fx_done = 1; - - if (fixP->fx_pcrel == 1 + else if (fixP->fx_pcrel == 1 && fixP->fx_addsy != NULL && S_GET_SEGMENT (fixP->fx_addsy) == seg) fixP->fx_done = 1; + else + fixP->fx_done = 0; + + if (fixP->fx_addsy != NULL && !fixP->fx_pcrel) + { + val = fixP->fx_offset; + fixP->fx_done = 1; + } + + if (fixP->fx_done) + { + char *buf = fixP->fx_frag->fr_literal + fixP->fx_where; + + fixP->fx_offset = 0; + + switch (fixP->fx_r_type) + { + case BFD_RELOC_CR16_NUM8: + bfd_put_8 (stdoutput, (unsigned char) val, buf); + break; + case BFD_RELOC_CR16_NUM16: + bfd_put_16 (stdoutput, val, buf); + break; + case BFD_RELOC_CR16_NUM32: + bfd_put_32 (stdoutput, val, buf); + break; + case BFD_RELOC_CR16_NUM32a: + bfd_put_32 (stdoutput, val, buf); + break; + default: + /* We shouldn't ever get here because linkrelax is nonzero. */ + abort (); + break; + } + fixP->fx_done = 0; + } + else + fixP->fx_offset = * valP; } /* The location from which a PC relative jump should be calculated, |