forked from Imagelibrary/binutils-gdb
tekhex object file output fixes
writevalue didn't handle 64-bit values, dropping the high 32 bits, and also wrote any value in the range [0,15] as 0. * tekhex.c (first_phase): Handle *ABS* symbols. (writevalue): Rewrite.
This commit is contained in:
25
bfd/tekhex.c
25
bfd/tekhex.c
@@ -395,7 +395,7 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
|
|||||||
if (!n)
|
if (!n)
|
||||||
return false;
|
return false;
|
||||||
memcpy (n, sym, len + 1);
|
memcpy (n, sym, len + 1);
|
||||||
section = bfd_make_section (abfd, n);
|
section = bfd_make_section_old_way (abfd, n);
|
||||||
if (section == NULL)
|
if (section == NULL)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -719,24 +719,13 @@ writevalue (char **dst, bfd_vma value)
|
|||||||
int len;
|
int len;
|
||||||
int shift;
|
int shift;
|
||||||
|
|
||||||
for (len = 8, shift = 28; shift; shift -= 4, len--)
|
for (len = BFD_ARCH_SIZE / 4, shift = len * 4 - 4; len > 1; shift -= 4, len--)
|
||||||
{
|
if ((value >> shift) & 0xf)
|
||||||
if ((value >> shift) & 0xf)
|
break;
|
||||||
{
|
|
||||||
*p++ = len + '0';
|
|
||||||
while (len)
|
|
||||||
{
|
|
||||||
*p++ = digs[(value >> shift) & 0xf];
|
|
||||||
shift -= 4;
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
*dst = p;
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
*p++ = digs[len & 0xf];
|
||||||
}
|
for (; len; shift -= 4, len--)
|
||||||
*p++ = '1';
|
*p++ = digs[(value >> shift) & 0xf];
|
||||||
*p++ = '0';
|
|
||||||
*dst = p;
|
*dst = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user