Bug 15227 - test PR ld/12942(3) fails on multiple targets
Summary: test PR ld/12942(3) fails on multiple targets
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-05 00:12 UTC by Janis Johnson
Modified: 2013-04-03 23:31 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2013-03-05 00:12:44 UTC
Test PR ld/12942 (3) in ld-plugins fails because the test, in ld/testsuite/ld-plugins/lto.exp, expects output:

  pr12942a.h:7: undefined reference to `link_error()

but the actual output for i686-pc-linux-gnu, arm-none-eabi, arm-none-linux-gnueabi, and powerpc-linux-gnu is

  pr12942b.cc:(.text._Z4testv[_Z4testv]+0x14): undefined reference to `link_error()'

The expected message is output if file pr12942b.cc is named in the link line, but the actual output is given when pr12942.o is used in the link line.  Is this a bug in the linker or in the test?

In addition, the test fails to link for arm-none-eabi with an undefined reference to abort.  This can be fixed by replacing abort with __builtin_abort in the test source, as is done with other tests that are linked on bare-metal targets.

The test was added by H.J. Lu.
Comment 1 Alan Modra 2013-04-03 08:38:49 UTC
Janis, I'll bet the reason you're seeing these failures is that you're building binutils with non-standard CFLAGS, specifically that your CFLAGS does not include -g.  ld then doesn't have the info necessary to report the expected file and line number, and falls back to section/offset.  This is clearly a bug in the testsuite.
Comment 2 Alan Modra 2013-04-03 08:41:35 UTC
I guess since the test is C++, I should have said CXXFLAGS rather than CFLAGS.
Comment 3 Sourceware Commits 2013-04-03 11:44:43 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2013-04-03 11:44:41

Modified files:
	ld/testsuite   : ChangeLog 
	ld/testsuite/ld-plugin: lto.exp pr12942a.cc 

Log message:
	PR ld/15227
	* ld-plugin/lto.exp (PR ld/12942 (3)): Remove file name and
	line number from regexp.
	(PR ld/15146 (2)): Similarly.
	* ld-plugin/pr12942a.cc (main): Use __builtin_abort.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1704&r2=1.1705
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/lto.exp.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/pr12942a.cc.diff?cvsroot=src&r1=1.1&r2=1.2
Comment 4 Alan Modra 2013-04-03 23:31:15 UTC
Fixed, I believe.