Bug 10147 - building alsa-lib with gold results in internal error in make_view, at ../../gold/fileread.cc:356
Summary: building alsa-lib with gold results in internal error in make_view, at ../../...
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
Depends on:
Reported: 2009-05-12 01:24 UTC by Mike Frysinger
Modified: 2009-09-09 18:08 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Last reconfirmed:

control.o.bz2 (44.39 KB, application/octet-stream)
2009-05-12 01:24 UTC, Mike Frysinger

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2009-05-12 01:24:21 UTC
using the attached .o linux x86-64 object and put into an archive, a simple gold
invocation to create a shared library causes an internal error

this is with current cvs (~ Mon May 11 21:23:03 EDT 2009)

$ rm -f libfoo.a
$ ar rc libfoo.a control.o
$ ./gold/ld-new -shared -o libfoo.so --whole-archive libfoo.a
./gold/ld-new: internal error in make_view, at ../../gold/fileread.cc:356
Comment 1 Mike Frysinger 2009-05-12 01:24:49 UTC
Created attachment 3932 [details]
Comment 2 cvs-commit@gcc.gnu.org 2009-06-23 07:19:53 UTC
Subject: Bug 10147

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2009-06-23 07:19:35

Modified files:
	gold           : ChangeLog object.cc 

Log message:
	PR 10147
	* object.cc (Object::section_contents): Don't try to get a view if
	the section has length zero.
	(Object::handle_gnu_warning_section): If the section is empty, use
	the name of the section as the warning.


Comment 3 Ian Lance Taylor 2009-06-23 07:21:59 UTC
Thanks for the bug report.  The problem was an unexpected empty .gnu.warning
section.  I committed a patch to fix this in the development sources.

The link still fails, but now it gets a plausible error message:

ld: error: symbol snd_ctl_elem_info_get_dimensions has undefined version ALSA_0.9.3

This implies that you need to provide a version script if you want to create a
shared library.
Comment 4 Mike Frysinger 2009-06-23 11:35:27 UTC
this was a reduced test case.  the original one was using a version script. 
perhaps i reduced it too much and instead triggered a different bug ? ;)  i was
going by the internal error message being the same.

i686-pc-linux-gnu-gcc -shared  .libs/conf.o .libs/confmisc.o .libs/input.o
.libs/output.o .libs/async.o .libs/error.o .libs/dlmisc.o .libs/socket.o
.libs/shmarea.o .libs/userfile.o .libs/names.o -Wl,--whole-archive
control/.libs/libcontrol.a mixer/.libs/libmixer.a pcm/.libs/libpcm.a
timer/.libs/libtimer.a rawmidi/.libs/librawmidi.a hwdep/.libs/libhwdep.a
seq/.libs/libseq.a compat/.libs/libcompat.a -Wl,--no-whole-archive
-Wl,--as-needed -lm -ldl -lpthread -lrt  -march=native -Wl,-O1
-Wl,--version-script=Versions -Wl,-soname -Wl,libasound.so.2 -o
Comment 5 Ian Lance Taylor 2009-06-23 13:20:34 UTC
Reopening since not fixed.
Comment 6 Mike Frysinger 2009-06-23 14:36:04 UTC
do you need me to put together a new test case ?  you should be able to
reproduce by downloading the latest alsa-lib and a normal configure && make ...
Comment 7 Ian Lance Taylor 2009-06-24 21:05:05 UTC
I downloaded alsa-lib 1.0.20 and built it with the current development version
of gold without any trouble.

So, I guess I do need you to give me a test case.  It is also conceivable that
the problem was fixed by the burst of patches I committed in the last couple of
Comment 8 Mike Frysinger 2009-09-09 18:08:38 UTC
binutils- seems to work for people, thanks !