public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: ld.gold: internal error in make_view, at fileread.cc:458
       [not found] <201105272232.18025.arekm@maven.pl>
@ 2011-05-30  0:39 ` Ian Lance Taylor
  2011-05-30 10:33   ` Witold Baryluk
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2011-05-30  0:39 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: bug-binutils, binutils

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

Arkadiusz Miskiewicz <arekm@maven.pl> 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  <iant@google.com>

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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1300 bytes --]

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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ld.gold: internal error in make_view, at fileread.cc:458
  2011-05-30  0:39 ` ld.gold: internal error in make_view, at fileread.cc:458 Ian Lance Taylor
@ 2011-05-30 10:33   ` Witold Baryluk
  2011-05-31  6:44     ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Witold Baryluk @ 2011-05-30 10:33 UTC (permalink / raw)
  To: bug-binutils, binutils, arekm

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

On 05-29 10:18, Ian Lance Taylor wrote:
> Arkadiusz Miskiewicz <arekm@maven.pl> 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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ld.gold: internal error in make_view, at fileread.cc:458
  2011-05-30 10:33   ` Witold Baryluk
@ 2011-05-31  6:44     ` Ian Lance Taylor
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2011-05-31  6:44 UTC (permalink / raw)
  To: Witold Baryluk; +Cc: bug-binutils, binutils, arekm

"Witold Baryluk" <baryluk@smp.if.uj.edu.pl> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-31  0:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201105272232.18025.arekm@maven.pl>
2011-05-30  0:39 ` ld.gold: internal error in make_view, at fileread.cc:458 Ian Lance Taylor
2011-05-30 10:33   ` Witold Baryluk
2011-05-31  6:44     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).