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