Re: ld.gold: internal error in make_view, at fileread.cc:458

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: ld.gold: internal error in make_view, at fileread.cc:458

Ian Lance Taylor-3
Arkadiusz Miskiewicz <[hidden email]> writes:

> uClibc does one test and checks exit status. For gold it causes internal
> error.
>
> binutils 2.21.51.0.9 on x86_64 linux.
>
> $ ld.gold --hash-style=gnu -o /dev/null -b binary /dev/null
> ld.gold: internal error in make_view, at fileread.cc:458
> zsh: exit 1     ld.gold --hash-style=gnu -o /dev/null -b binary /dev/null
>
> $ ld.bfd --hash-style=gnu -o /dev/null -b binary /dev/null
> ld.bfd: warning: cannot find entry symbol _start; not setting start address
Thanks for the bug report.  Fixed with this patch, committed to both
mainline and the 2.21 branch.

Ian


2011-05-29  Ian Lance Taylor  <[hidden email]>

        * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
        binary input file is empty.



Index: binary.cc
===================================================================
RCS file: /cvs/src/src/gold/binary.cc,v
retrieving revision 1.4
diff -p -u -r1.4 binary.cc
--- binary.cc 7 Feb 2009 01:03:32 -0000 1.4
+++ binary.cc 29 May 2011 17:08:52 -0000
@@ -132,7 +132,11 @@ Binary_to_elf::sized_convert(const Task*
     }
 
   section_size_type filesize = convert_to_section_size_type(f.filesize());
-  const unsigned char* fileview = f.get_view(0, 0, filesize, false, false);
+  const unsigned char* fileview;
+  if (filesize == 0)
+    fileview = NULL;
+  else
+    fileview = f.get_view(0, 0, filesize, false, false);
 
   unsigned int align;
   if (size == 32)
@@ -223,10 +227,13 @@ Binary_to_elf::sized_convert(const Task*
        shstrtab.get_strtab_size(),
        0, 0, 1, 0, &pout);
 
-  memcpy(pout, fileview, filesize);
-  pout += filesize;
-  memset(pout, 0, aligned_filesize - filesize);
-  pout += aligned_filesize - filesize;
+  if (filesize > 0)
+    {
+      memcpy(pout, fileview, filesize);
+      pout += filesize;
+      memset(pout, 0, aligned_filesize - filesize);
+      pout += aligned_filesize - filesize;
+    }
 
   this->write_symbol<size, big_endian>("", &strtab, 0, 0, &pout);
   this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, 1,
Reply | Threaded
Open this post in threaded view
|

Re: ld.gold: internal error in make_view, at fileread.cc:458

Witold Baryluk
On 05-29 10:18, Ian Lance Taylor wrote:

> Arkadiusz Miskiewicz <[hidden email]> writes:
>
> > uClibc does one test and checks exit status. For gold it causes internal
> > error.
> >
> > binutils 2.21.51.0.9 on x86_64 linux.
> >
> > $ ld.gold --hash-style=gnu -o /dev/null -b binary /dev/null
> > ld.gold: internal error in make_view, at fileread.cc:458
> > zsh: exit 1     ld.gold --hash-style=gnu -o /dev/null -b binary /dev/null
> >
> > $ ld.bfd --hash-style=gnu -o /dev/null -b binary /dev/null
> > ld.bfd: warning: cannot find entry symbol _start; not setting start address
>
> Thanks for the bug report.  Fixed with this patch, committed to both
> mainline and the 2.21 branch.
>
> Ian
Hello.

Hmm, maybe this Bug have something with common with my gold report?
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620176


Regards,
Witek

--
Witold Baryluk

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ld.gold: internal error in make_view, at fileread.cc:458

Ian Lance Taylor
"Witold Baryluk" <[hidden email]> writes:

> Hmm, maybe this Bug have something with common with my gold report?
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620176

Unlikely.  However, I just tried to recreate your bug with current
mainline, and failed.  It may have been fixed by some other change.

Ian