Bug 42982 - regression in gcc.dg/profile-generate-3.c
Summary: regression in gcc.dg/profile-generate-3.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-06 03:21 UTC by Jack Howarth
Modified: 2010-03-10 03:23 UTC (History)
1 user (show)

See Also:
Host: *-apple-darwin*
Target: *-apple-darwin*
Build: *-apple-darwin*
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Howarth 2010-02-06 03:21:57 UTC
The gcc.dg/profile-generate-3.c test case no longer compiles on *-apple-darwin*. On x86_64-apple-darwin10 the test case produces the error...

Executing on host: /sw/src/fink.build/gcc45-4.4.999-20100205/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc45-4.4.999-20100205/darwin_objdir/gcc/ /sw/src/fink.build/gcc45-4.4.999-20100205/gcc-4.5-20100205/gcc/testsuite/gcc.dg/profile-generate-3.c   -fprofile-generate=.  -lm   -o profile-generate-3.exe    (timeout = 300)
Undefined symbols:
  "___gcov_merge_add", referenced from:
      __data@0 in cc6Pfi4X.o
  "___gcov_indirect_call_profiler", referenced from:
      _main in cc6Pfi4X.o
      global constructors keyed to 65535_0_profile_generate_3.c in cc6Pfi4X.o
  "___gcov_init", referenced from:
      global constructors keyed to 65535_0_profile_generate_3.c in cc6Pfi4X.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
compiler exited with status 1
output is:
Undefined symbols:
  "___gcov_merge_add", referenced from:
      __data@0 in cc6Pfi4X.o
  "___gcov_indirect_call_profiler", referenced from:
      _main in cc6Pfi4X.o
      global constructors keyed to 65535_0_profile_generate_3.c in cc6Pfi4X.o
  "___gcov_init", referenced from:
      global constructors keyed to 65535_0_profile_generate_3.c in cc6Pfi4X.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

FAIL: gcc.dg/profile-generate-3.c (test for excess errors)
Excess errors:
Undefined symbols:
  "___gcov_merge_add", referenced from:
      __data@0 in cc6Pfi4X.o
  "___gcov_indirect_call_profiler", referenced from:
      _main in cc6Pfi4X.o
      global constructors keyed to 65535_0_profile_generate_3.c in cc6Pfi4X.o
  "___gcov_init", referenced from:
      global constructors keyed to 65535_0_profile_generate_3.c in cc6Pfi4X.o
ld: symbol(s) not found

Last reported revision that worked was r155525 and first reported revision that failed was r155604.
Comment 1 Jack Howarth 2010-02-06 03:46:34 UTC
Could this be a side-effect of r155534...

2009-12-31  Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk>

	PR target/41605
	* config/darwin.h (LINK_COMMAND_SPEC): Resolve fopenmp specifically
	for target.
	(LINK_SPEC): Replace dynamic libraries by static equivalents where
	necessary.
	* config/darwin9.h (LINK_COMMAND_SPEC): Resolve fopenmp specifically
	for target.

I find that if I explicitly add -lgcov to the linkage then gcc.dg/profile-generate-3.c links fine.
Comment 2 Jack Howarth 2010-02-06 03:49:09 UTC
Is this a typo in the committed patch?

-    %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \

to

+    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \

Notice that the * after fprofile-generate has been dropped after the patch.
Comment 3 Jack Howarth 2010-02-06 05:34:18 UTC
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 156530)
+++ gcc/config/darwin.h	(working copy)
@@ -272,7 +272,7 @@
     %{A} %{e*} %{m} %{r} %{x} \
     %{o*}%{!o:-o a.out} \
     %{!A:%{!nostdlib:%{!nostartfiles:%S}}} \
-    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
+    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
     %{fopenmp|ftree-parallelize-loops=*: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
     %{!nostdlib:%{!nodefaultlibs: %(link_ssp) %G %L }} \
Index: gcc/config/darwin9.h
===================================================================
--- gcc/config/darwin9.h	(revision 156530)
+++ gcc/config/darwin9.h	(working copy)
@@ -31,7 +31,7 @@
     %{A} %{e*} %{m} %{r} %{x} \
     %{o*}%{!o:-o a.out} \
     %{!A:%{!nostdlib:%{!nostartfiles:%S}}} \
-    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
+    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
     %{fopenmp|ftree-parallelize-loops=*: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
     %{!nostdlib:%{!nodefaultlibs:  %(link_ssp) %G %L }} \

eliminates the failure of gcc.dg/profile-generate-3.c as expected on x86_64-apple-darwin10.
Comment 4 Dave Korn 2010-02-12 17:35:31 UTC
Subject: Bug 42982

Author: davek
Date: Fri Feb 12 17:35:18 2010
New Revision: 156736

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156736
Log:
2010-02-12  Dave Korn  <dave.korn.cygwin@gmail.com>
	    Jack Howarth  <howarth@bromo.med.uc.edu>
	    Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk>

	PR target/42982
	Partial revert of unintended change in fix for PR41605.
	* gcc/config/darwin.h: Fix typo.
	* gcc/config/darwin9.h: Same.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/darwin.h
    trunk/gcc/config/darwin9.h

Comment 5 Jack Howarth 2010-03-10 03:23:42 UTC
Fixed with r156736.