61cb3a6
--- binutils.orig/gold/fileread.cc	2019-08-06 14:22:08.669313110 +0100
61cb3a6
+++ binutils-2.32/gold/fileread.cc	2019-08-06 14:22:28.799177543 +0100
61cb3a6
@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_
61cb3a6
   ssize_t bytes;
61cb3a6
   if (this->whole_file_view_ != NULL)
61cb3a6
     {
61cb3a6
+      // See PR 23765 for an example of a testcase that triggers this error.
61cb3a6
+      if (((ssize_t) start) < 0)
61cb3a6
+	gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
61cb3a6
+		   this->filename().c_str(),
61cb3a6
+		   static_cast<long long>(start));
61cb3a6
+	
61cb3a6
       bytes = this->size_ - start;
61cb3a6
       if (static_cast<section_size_type>(bytes) >= size)
61cb3a6
 	{