aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2008-11-12 03:09:31 +0000
committerHans-Peter Nilsson <hp@axis.com>2008-11-12 03:09:31 +0000
commitbfa1b75cccb82b0fe1dfb70783fcd4226e5ebcd3 (patch)
treee0b7026cb505bb8174c5d95a33b3547c04109ff1 /gas
parentcb26feec3e9fbf8991dc5b4fdef47dc38db92049 (diff)
downloadgdb-bfa1b75cccb82b0fe1dfb70783fcd4226e5ebcd3.zip
gdb-bfa1b75cccb82b0fe1dfb70783fcd4226e5ebcd3.tar.gz
gdb-bfa1b75cccb82b0fe1dfb70783fcd4226e5ebcd3.tar.bz2
* config/tc-cris.c (cris_number_to_imm): Except for
BFD_RELOC_NONE, always set contents. Where previously this was skipped, set contents to 0.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-cris.c46
2 files changed, 22 insertions, 28 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c873183..17cffcf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
2008-11-12 Hans-Peter Nilsson <hp@axis.com>
+ * config/tc-cris.c (cris_number_to_imm): Except for
+ BFD_RELOC_NONE, always set contents. Where previously this was
+ skipped, set contents to 0.
+
PR gas/7025
* input-scrub.c (input_scrub_include_sb): Make the position
after the input have defined contents, a 0 character.
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 8c2d87a..4b5ab3b 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -3613,10 +3613,12 @@ cris_number_to_imm (char *bufp, long val, int n, fixS *fixP, segT seg)
;
}
- /* Only do this for old-arch binaries. */
+ /* Only use the computed value for old-arch binaries. For all
+ others, where we're going to output a relocation, put 0 in the
+ code. */
if (cris_arch != arch_cris_any_v0_v10
&& (fixP->fx_addsy != NULL || fixP->fx_pcrel))
- return;
+ val = 0;
switch (fixP->fx_r_type)
{
@@ -3643,13 +3645,14 @@ cris_number_to_imm (char *bufp, long val, int n, fixS *fixP, segT seg)
case BFD_RELOC_CRIS_16_TPREL:
/* We don't want to put in any kind of non-zero bits in the data
being relocated for these. */
+ md_number_to_chars (bufp, 0, n);
break;
case BFD_RELOC_32_PCREL:
- /* If this one isn't fully resolved, we don't want to put anything
+ /* If this one isn't fully resolved, we don't want to put non-zero
in the object. */
if (fixP->fx_addsy != NULL || fixP->fx_pcrel)
- break;
+ val = 0;
/* Fall through. */
case BFD_RELOC_32:
@@ -3671,38 +3674,30 @@ cris_number_to_imm (char *bufp, long val, int n, fixS *fixP, segT seg)
if (val > 0xffff || val < -32768)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 16 bit range: %ld"), val);
- if (! fixP->fx_addsy)
- {
- bufp[1] = (val >> 8) & 0xFF;
- bufp[0] = val & 0xFF;
- }
+ bufp[1] = (val >> 8) & 0xFF;
+ bufp[0] = val & 0xFF;
break;
case BFD_RELOC_CRIS_SIGNED_16:
if (val > 32767 || val < -32768)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 16 bit signed range: %ld"), val);
- if (! fixP->fx_addsy)
- {
- bufp[1] = (val >> 8) & 0xFF;
- bufp[0] = val & 0xFF;
- }
+ bufp[1] = (val >> 8) & 0xFF;
+ bufp[0] = val & 0xFF;
break;
case BFD_RELOC_8:
case BFD_RELOC_8_PCREL:
if (val > 255 || val < -128)
as_bad_where (fixP->fx_file, fixP->fx_line, _("Value not in 8 bit range: %ld"), val);
- if (! fixP->fx_addsy)
- bufp[0] = val & 0xFF;
+ bufp[0] = val & 0xFF;
break;
case BFD_RELOC_CRIS_SIGNED_8:
if (val > 127 || val < -128)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 8 bit signed range: %ld"), val);
- if (! fixP->fx_addsy)
- bufp[0] = val & 0xFF;
+ bufp[0] = val & 0xFF;
break;
case BFD_RELOC_CRIS_LAPCQ_OFFSET:
@@ -3712,37 +3707,32 @@ cris_number_to_imm (char *bufp, long val, int n, fixS *fixP, segT seg)
if (val > 15 || val < 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 4 bit unsigned range: %ld"), val);
- if (! fixP->fx_addsy)
- bufp[0] |= val & 0x0F;
+ bufp[0] |= val & 0x0F;
break;
case BFD_RELOC_CRIS_UNSIGNED_5:
if (val > 31 || val < 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 5 bit unsigned range: %ld"), val);
- if (! fixP->fx_addsy)
- bufp[0] |= val & 0x1F;
+ bufp[0] |= val & 0x1F;
break;
case BFD_RELOC_CRIS_SIGNED_6:
if (val > 31 || val < -32)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 6 bit range: %ld"), val);
- if (! fixP->fx_addsy)
- bufp[0] |= val & 0x3F;
+ bufp[0] |= val & 0x3F;
break;
case BFD_RELOC_CRIS_UNSIGNED_6:
if (val > 63 || val < 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value not in 6 bit unsigned range: %ld"), val);
- if (! fixP->fx_addsy)
- bufp[0] |= val & 0x3F;
+ bufp[0] |= val & 0x3F;
break;
case BFD_RELOC_CRIS_BDISP8:
- if (! fixP->fx_addsy)
- bufp[0] = branch_disp (val);
+ bufp[0] = branch_disp (val);
break;
case BFD_RELOC_NONE: