66b412
--- binutils.orig/gold/fileread.cc	2019-11-08 10:33:58.911577903 +0000
66b412
+++ binutils-2.30/gold/fileread.cc	2019-11-08 10:34:13.001470092 +0000
66b412
@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_
66b412
   ssize_t bytes;
66b412
   if (this->whole_file_view_ != NULL)
66b412
     {
66b412
+      // See PR 23765 for an example of a testcase that triggers this error.
66b412
+      if (((ssize_t) start) < 0)
66b412
+	gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
66b412
+		   this->filename().c_str(),
66b412
+		   static_cast<long long>(start));
66b412
+	
66b412
       bytes = this->size_ - start;
66b412
       if (static_cast<section_size_type>(bytes) >= size)
66b412
 	{