mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 19:09:31 +08:00
* som.c (som_get_section_contents): New function. Do not try
to actually read data from a section that doesn't have either SEC_LOAD or SEC_DEBUGGING set (eg $BSS$) just return true.
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
Sat Mar 26 10:25:43 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
|
Sat Mar 26 10:25:43 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
|
||||||
|
|
||||||
|
* som.c (som_get_section_contents): New function. Do not try
|
||||||
|
to actually read data from a section that doesn't have either
|
||||||
|
SEC_LOAD or SEC_DEBUGGING set (eg $BSS$) just return true.
|
||||||
|
|
||||||
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
|
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
|
||||||
read. (bfd_error_system_call or bfd_error_file_truncated).
|
read. (bfd_error_system_call or bfd_error_file_truncated).
|
||||||
|
|
||||||
|
20
bfd/som.c
20
bfd/som.c
@ -158,6 +158,8 @@ static boolean som_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
|
|||||||
static boolean som_bfd_is_local_label PARAMS ((bfd *, asymbol *));
|
static boolean som_bfd_is_local_label PARAMS ((bfd *, asymbol *));
|
||||||
static boolean som_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
static boolean som_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
||||||
file_ptr, bfd_size_type));
|
file_ptr, bfd_size_type));
|
||||||
|
static boolean som_get_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
||||||
|
file_ptr, bfd_size_type));
|
||||||
static boolean som_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
|
static boolean som_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
|
||||||
unsigned long));
|
unsigned long));
|
||||||
static boolean som_find_nearest_line PARAMS ((bfd *, asection *,
|
static boolean som_find_nearest_line PARAMS ((bfd *, asection *,
|
||||||
@ -4441,6 +4443,23 @@ bfd_som_attach_aux_hdr (abfd, type, string)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
som_get_section_contents (abfd, section, location, offset, count)
|
||||||
|
bfd *abfd;
|
||||||
|
sec_ptr section;
|
||||||
|
PTR location;
|
||||||
|
file_ptr offset;
|
||||||
|
bfd_size_type count;
|
||||||
|
{
|
||||||
|
if (count == 0 || ((section->flags & (SEC_LOAD | SEC_DEBUGGING)) == 0))
|
||||||
|
return true;
|
||||||
|
if ((bfd_size_type)(offset+count) > section->_raw_size
|
||||||
|
|| bfd_seek (abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
|
||||||
|
|| bfd_read (location, (bfd_size_type)1, count, abfd) != count)
|
||||||
|
return (false); /* on error */
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
som_set_section_contents (abfd, section, location, offset, count)
|
som_set_section_contents (abfd, section, location, offset, count)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
@ -5427,7 +5446,6 @@ som_write_armap (abfd)
|
|||||||
|
|
||||||
#define som_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
|
#define som_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
|
||||||
#define som_close_and_cleanup bfd_generic_close_and_cleanup
|
#define som_close_and_cleanup bfd_generic_close_and_cleanup
|
||||||
#define som_get_section_contents bfd_generic_get_section_contents
|
|
||||||
|
|
||||||
#define som_bfd_get_relocated_section_contents \
|
#define som_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
|
Reference in New Issue
Block a user