Bug 12277 - Linker error: "final link failed: Nonrepresentable section on output"
Summary: Linker error: "final link failed: Nonrepresentable section on output"
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL: http://sourceware.org/ml/binutils/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-01 17:01 UTC by Dmitry Gorbachev
Modified: 2012-12-07 20:05 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Last reconfirmed:


Attachments
Testcase (312 bytes, text/plain)
2010-12-01 17:01 UTC, Dmitry Gorbachev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Gorbachev 2010-12-01 17:01:45 UTC
Created attachment 5141 [details]
Testcase

GNU ld (GNU Binutils) 2.21.51.20101123

/usr/local/bin/ld: prog: protected symbol `bar' isn't defined
/usr/local/bin/ld: final link failed: Nonrepresentable section on output
Comment 1 Sourceware Commits 2010-12-04 04:42:11 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2010-12-04 04:42:07

Modified files:
	bfd            : ChangeLog elflink.c 

Log message:
	PR ld/12277
	* elflink.c (elf_link_output_extsym): Set bfd_error on symbol
	and section errors.  Allow better translation of error messages.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5202&r2=1.5203
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.388&r2=1.389
Comment 2 Alan Modra 2010-12-04 04:43:47 UTC
Fixed mainline.
Comment 3 Dmitry Gorbachev 2010-12-04 18:45:35 UTC
There are still two problems...

1. The "<visibility> symbol `bar' isn't defined" messages are misleading: "hidden" in the sources gives "protected", "protected" gives "internal", and "internal" gives "hidden". It also depends on whether bar() is __const__ or not.

2. Why ld.bfd should fail when ld.gold works fine?
Comment 4 H.J. Lu 2010-12-06 00:03:53 UTC
(In reply to comment #3)
> There are still two problems...
> 
> 1. The "<visibility> symbol `bar' isn't defined" messages are misleading:
> "hidden" in the sources gives "protected", "protected" gives "internal", and
> "internal" gives "hidden". It also depends on whether bar() is __const__ or
> not.

It is fixed by

http://sourceware.org/ml/binutils/2010-12/msg00202.html

> 2. Why ld.bfd should fail when ld.gold works fine?

It will be fixed by

http://sourceware.org/ml/binutils/2010-12/msg00197.html
Comment 5 Sourceware Commits 2010-12-06 00:51:19 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2010-12-06 00:51:16

Modified files:
	ld             : ChangeLog 

Log message:
	Mention PR ld/12277 in ChangeLog.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2243&r2=1.2244
Comment 6 H.J. Lu 2010-12-06 05:42:43 UTC
The patch is posted at

http://sourceware.org/ml/binutils/2010-12/msg00207.html
Comment 7 Dmitry Gorbachev 2011-02-01 12:49:53 UTC
Failed with ld.dk.
Comment 8 H.J. Lu 2011-02-01 20:39:32 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2011-02/msg00010.html
Comment 9 Dmitry Gorbachev 2011-03-13 17:43:21 UTC
(In reply to comment #7)

Recent ld.dk seems to work.
Comment 10 H.J. Lu 2012-12-07 20:05:51 UTC
Works in 2.23.  Tracked by "LTO 8" test in ld-plugin.