aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1994-03-26 20:25:48 +0000
committerJeff Law <law@redhat.com>1994-03-26 20:25:48 +0000
commitf977e865cbf5fad99f476ab9d2d8068db943ac33 (patch)
tree6a6518c1385a7ef18a738cf2c644e45d4a3c725a /bfd
parent9336e47ee24aa8c51cb286f2cb13ee014db19e3d (diff)
downloadgdb-f977e865cbf5fad99f476ab9d2d8068db943ac33.zip
gdb-f977e865cbf5fad99f476ab9d2d8068db943ac33.tar.gz
gdb-f977e865cbf5fad99f476ab9d2d8068db943ac33.tar.bz2
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/som.c20
2 files changed, 23 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1896682..1a404f8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,9 @@
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
read. (bfd_error_system_call or bfd_error_file_truncated).
diff --git a/bfd/som.c b/bfd/som.c
index 62812f5..6fa3f8b 100644
--- a/bfd/som.c
+++ b/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_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
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,
unsigned long));
static boolean som_find_nearest_line PARAMS ((bfd *, asection *,
@@ -4442,6 +4444,23 @@ bfd_som_attach_aux_hdr (abfd, type, string)
}
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
som_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
@@ -5427,7 +5446,6 @@ som_write_armap (abfd)
#define som_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
#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 \
bfd_generic_get_relocated_section_contents