/* Sign extension to bfd_signed_vma. */
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
-#define EIGHT_GAZILLION ((BFD_HOST_64_BIT) 1 << 63)
+#define EIGHT_GAZILLION ((bfd_int64_t) 1 << 63)
#define COERCE64(x) \
- (((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
+ (((bfd_int64_t) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
bfd_vma
bfd_getb16 (const void *p)
return COERCE32 (v);
}
-bfd_vma
+bfd_uint64_t
bfd_getb64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
+#ifdef BFD_HOST_64_BIT
const bfd_byte *addr = p;
- bfd_vma v;
+ bfd_uint64_t v;
v = addr[0]; v <<= 8;
v |= addr[1]; v <<= 8;
#endif
}
-bfd_vma
+bfd_uint64_t
bfd_getl64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
+#ifdef BFD_HOST_64_BIT
const bfd_byte *addr = p;
- bfd_vma v;
+ bfd_uint64_t v;
v = addr[7]; v <<= 8;
v |= addr[6]; v <<= 8;
}
-bfd_signed_vma
+bfd_int64_t
bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
+#ifdef BFD_HOST_64_BIT
const bfd_byte *addr = p;
- bfd_vma v;
+ bfd_uint64_t v;
v = addr[0]; v <<= 8;
v |= addr[1]; v <<= 8;
#endif
}
-bfd_signed_vma
+bfd_int64_t
bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
+#ifdef BFD_HOST_64_BIT
const bfd_byte *addr = p;
- bfd_vma v;
+ bfd_uint64_t v;
v = addr[7]; v <<= 8;
v |= addr[6]; v <<= 8;
}
void
-bfd_putb64 (bfd_vma data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
+bfd_putb64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
+#ifdef BFD_HOST_64_BIT
bfd_byte *addr = p;
addr[0] = (data >> (7*8)) & 0xff;
addr[1] = (data >> (6*8)) & 0xff;
}
void
-bfd_putl64 (bfd_vma data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
+bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
+#ifdef BFD_HOST_64_BIT
bfd_byte *addr = p;
addr[7] = (data >> (7*8)) & 0xff;
addr[6] = (data >> (6*8)) & 0xff;
}
void
-bfd_put_bits (bfd_vma data, void *p, int bits, bfd_boolean big_p)
+bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
{
bfd_byte *addr = p;
int i;
}
}
-bfd_vma
+bfd_uint64_t
bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
{
const bfd_byte *addr = p;
- bfd_vma data;
+ bfd_uint64_t data;
int i;
int bytes;
file_ptr offset,
bfd_size_type count)
{
+ bfd_size_type sz;
if (count == 0)
return TRUE;
- if (offset + count > section->_raw_size)
+ sz = section->rawsize ? section->rawsize : section->size;
+ if (offset + count > sz)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
bfd_size_type count ATTRIBUTE_UNUSED)
{
#ifdef USE_MMAP
+ bfd_size_type sz;
+
if (count == 0)
return TRUE;
if (abfd->xvec->_bfd_get_section_contents
w->data = w->i->data;
return bfd_get_section_contents (abfd, section, w->data, offset, count);
}
- if (offset + count > section->_raw_size
+ sz = section->rawsize ? section->rawsize : section->size;
+ if (offset + count > sz
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
TRUE))
return FALSE;
const char *msg;
if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
+ msg = _("%B: compiled for a big endian system and target is little endian");
else
- msg = _("%s: compiled for a little endian system and target is big endian");
+ msg = _("%B: compiled for a little endian system and target is big endian");
- (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
+ (*_bfd_error_handler) (msg, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;