mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 20:49:43 +00:00
* ihex.c (ihex_scan): Removed unnecessary extbase variable.
(ihex_write_object_contents): Remove extbase; always use segbase instead.
This commit is contained in:
parent
5132850605
commit
492cfc71b8
@ -1,3 +1,9 @@
|
|||||||
|
Fri Aug 30 11:49:19 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* ihex.c (ihex_scan): Removed unnecessary extbase variable.
|
||||||
|
(ihex_write_object_contents): Remove extbase; always use segbase
|
||||||
|
instead.
|
||||||
|
|
||||||
Thu Aug 29 16:52:17 1996 Michael Meissner <meissner@tiktok.cygnus.com>
|
Thu Aug 29 16:52:17 1996 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||||
|
|
||||||
* configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
|
* configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
|
||||||
|
63
bfd/ihex.c
63
bfd/ihex.c
@ -104,6 +104,18 @@ Another document reports these additional types:
|
|||||||
10..13 Upper 16 bits of start address
|
10..13 Upper 16 bits of start address
|
||||||
14..15 Checksum in hex notation
|
14..15 Checksum in hex notation
|
||||||
16..17 Carriage return, line feed
|
16..17 Carriage return, line feed
|
||||||
|
|
||||||
|
The MRI compiler uses this, which is a repeat of type 5:
|
||||||
|
|
||||||
|
EXTENDED START RECORD
|
||||||
|
Byte 1 Header = colon (:)
|
||||||
|
2..3 The byte count, must be "04"
|
||||||
|
4..7 Load address, must be "0000"
|
||||||
|
8..9 Record type, must be "05"
|
||||||
|
10..13 Upper 16 bits of start address
|
||||||
|
14..17 Lower 16 bits of start address
|
||||||
|
18..19 Checksum in hex notation
|
||||||
|
20..21 Carriage return, line feed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
@ -257,7 +269,6 @@ ihex_scan (abfd)
|
|||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
bfd_vma segbase;
|
bfd_vma segbase;
|
||||||
bfd_vma extbase;
|
|
||||||
asection *sec;
|
asection *sec;
|
||||||
int lineno;
|
int lineno;
|
||||||
boolean error;
|
boolean error;
|
||||||
@ -270,7 +281,6 @@ ihex_scan (abfd)
|
|||||||
|
|
||||||
abfd->start_address = 0;
|
abfd->start_address = 0;
|
||||||
|
|
||||||
extbase = 0;
|
|
||||||
segbase = 0;
|
segbase = 0;
|
||||||
sec = NULL;
|
sec = NULL;
|
||||||
lineno = 1;
|
lineno = 1;
|
||||||
@ -366,7 +376,7 @@ ihex_scan (abfd)
|
|||||||
case 0:
|
case 0:
|
||||||
/* This is a data record. */
|
/* This is a data record. */
|
||||||
if (sec != NULL
|
if (sec != NULL
|
||||||
&& sec->vma + sec->_raw_size == extbase + segbase + addr)
|
&& sec->vma + sec->_raw_size == segbase + addr)
|
||||||
{
|
{
|
||||||
/* This data goes at the end of the section we are
|
/* This data goes at the end of the section we are
|
||||||
currently building. */
|
currently building. */
|
||||||
@ -386,8 +396,8 @@ ihex_scan (abfd)
|
|||||||
if (sec == NULL)
|
if (sec == NULL)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
|
sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
|
||||||
sec->vma = extbase + segbase + addr;
|
sec->vma = segbase + addr;
|
||||||
sec->lma = extbase + segbase + addr;
|
sec->lma = segbase + addr;
|
||||||
sec->_raw_size = len;
|
sec->_raw_size = len;
|
||||||
sec->filepos = pos;
|
sec->filepos = pos;
|
||||||
}
|
}
|
||||||
@ -454,7 +464,7 @@ ihex_scan (abfd)
|
|||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
/* An extended linear start address record. */
|
/* An extended linear start address record. */
|
||||||
if (len != 2)
|
if (len != 2 && len != 4)
|
||||||
{
|
{
|
||||||
(*_bfd_error_handler)
|
(*_bfd_error_handler)
|
||||||
("%s:%d: bad extended linear start address length in Intel Hex file",
|
("%s:%d: bad extended linear start address length in Intel Hex file",
|
||||||
@ -463,7 +473,10 @@ ihex_scan (abfd)
|
|||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (len == 2)
|
||||||
abfd->start_address += HEX4 (buf) << 16;
|
abfd->start_address += HEX4 (buf) << 16;
|
||||||
|
else
|
||||||
|
abfd->start_address = (HEX4 (buf) << 16) + HEX4 (buf + 4);
|
||||||
|
|
||||||
sec = NULL;
|
sec = NULL;
|
||||||
|
|
||||||
@ -778,11 +791,9 @@ static boolean
|
|||||||
ihex_write_object_contents (abfd)
|
ihex_write_object_contents (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
bfd_vma extbase;
|
|
||||||
bfd_vma segbase;
|
bfd_vma segbase;
|
||||||
struct ihex_data_list *l;
|
struct ihex_data_list *l;
|
||||||
|
|
||||||
extbase = 0;
|
|
||||||
segbase = 0;
|
segbase = 0;
|
||||||
for (l = abfd->tdata.ihex_data->head; l != NULL; l = l->next)
|
for (l = abfd->tdata.ihex_data->head; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
@ -801,7 +812,7 @@ ihex_write_object_contents (abfd)
|
|||||||
if (now > CHUNK)
|
if (now > CHUNK)
|
||||||
now = CHUNK;
|
now = CHUNK;
|
||||||
|
|
||||||
if (where > extbase + segbase + 0xffff)
|
if (where > segbase + 0xffff)
|
||||||
{
|
{
|
||||||
bfd_byte addr[2];
|
bfd_byte addr[2];
|
||||||
|
|
||||||
@ -816,8 +827,8 @@ ihex_write_object_contents (abfd)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
extbase = where & 0xffff0000;
|
segbase = where & 0xffff0000;
|
||||||
if (where > extbase + 0xffff)
|
if (where > segbase + 0xffff)
|
||||||
{
|
{
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
@ -828,15 +839,14 @@ ihex_write_object_contents (abfd)
|
|||||||
bfd_set_error (bfd_error_bad_value);
|
bfd_set_error (bfd_error_bad_value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
addr[0] = (extbase >> 24) & 0xff;
|
addr[0] = (segbase >> 24) & 0xff;
|
||||||
addr[1] = (extbase >> 16) & 0xff;
|
addr[1] = (segbase >> 16) & 0xff;
|
||||||
if (! ihex_write_record (abfd, 2, 0, 4, addr))
|
if (! ihex_write_record (abfd, 2, 0, 4, addr))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ihex_write_record (abfd, now, where - (extbase + segbase),
|
if (! ihex_write_record (abfd, now, where - segbase, 0, p))
|
||||||
0, p))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
where += now;
|
where += now;
|
||||||
@ -852,15 +862,8 @@ ihex_write_object_contents (abfd)
|
|||||||
|
|
||||||
start = abfd->start_address;
|
start = abfd->start_address;
|
||||||
|
|
||||||
if (start > 0xfffff)
|
if (start <= 0xfffff)
|
||||||
{
|
{
|
||||||
startbuf[0] = (start >> 24) & 0xff;
|
|
||||||
startbuf[1] = (start >> 16) & 0xff;
|
|
||||||
if (! ihex_write_record (abfd, 2, 0, 5, startbuf))
|
|
||||||
return false;
|
|
||||||
start &= 0xffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
startbuf[0] = ((start & 0xf0000) >> 12) & 0xff;
|
startbuf[0] = ((start & 0xf0000) >> 12) & 0xff;
|
||||||
startbuf[1] = 0;
|
startbuf[1] = 0;
|
||||||
startbuf[2] = (start >> 8) & 0xff;
|
startbuf[2] = (start >> 8) & 0xff;
|
||||||
@ -868,6 +871,16 @@ ihex_write_object_contents (abfd)
|
|||||||
if (! ihex_write_record (abfd, 4, 0, 3, startbuf))
|
if (! ihex_write_record (abfd, 4, 0, 3, startbuf))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
startbuf[0] = (start >> 24) & 0xff;
|
||||||
|
startbuf[1] = (start >> 16) & 0xff;
|
||||||
|
startbuf[2] = (start >> 8) & 0xff;
|
||||||
|
startbuf[3] = start & 0xff;
|
||||||
|
if (! ihex_write_record (abfd, 4, 0, 5, startbuf))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! ihex_write_record (abfd, 0, 0, 1, NULL))
|
if (! ihex_write_record (abfd, 0, 0, 1, NULL))
|
||||||
return false;
|
return false;
|
||||||
@ -958,8 +971,8 @@ const bfd_target ihex_vec =
|
|||||||
{
|
{
|
||||||
"ihex", /* name */
|
"ihex", /* name */
|
||||||
bfd_target_ihex_flavour,
|
bfd_target_ihex_flavour,
|
||||||
true, /* target byte order */
|
BFD_ENDIAN_UNKNOWN, /* target byte order */
|
||||||
true, /* target headers byte order */
|
BFD_ENDIAN_UNKNOWN, /* target headers byte order */
|
||||||
0, /* object flags */
|
0, /* object flags */
|
||||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */
|
||||||
0, /* leading underscore */
|
0, /* leading underscore */
|
||||||
|
Loading…
Reference in New Issue
Block a user