Bug 17537 - [3.4 Regression] g++ not passing -lstdc++ to linker when -l is only supplied
Summary: [3.4 Regression] g++ not passing -lstdc++ to linker when -l is only supplied
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.3
Assignee: Not yet assigned to anyone
URL:
Keywords: patch
: 17694 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-17 18:23 UTC by Devang Patel
Modified: 2004-09-29 02:34 UTC (History)
2 users (show)

See Also:
Host: powerpc-darwin
Target:
Build:
Known to work: 3.3.3 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2004-09-17 18:38:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devang Patel 2004-09-17 18:23:11 UTC
Steps to reproduce.
$ cat > main.cpp
int main() {
        char *foo = new char[10];
        delete foo;
}

$ g++ -c main.cpp

$ g++ -o main1 main.o

$ ar cr libmain.a main.o

$ ranlib libmain.a 

$ g++ -o main2 libmain.a

$ g++ -o main3 -L. -lmain   
ld: warning prebinding disabled because of undefined symbols
ld: Undefined symbols:
operator delete(void*)
operator new[](unsigned long)
___gxx_personality_v0
Comment 1 Andrew Pinski 2004-09-17 18:38:12 UTC
Confirmed, correcting the summary as it is only true for -l.
Also this is a regression from 3.3.3.
Comment 2 Andrew Pinski 2004-09-25 15:20:06 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02651.html>.
Comment 3 Paolo Carlini 2004-09-27 15:44:48 UTC
*** Bug 17694 has been marked as a duplicate of this bug. ***
Comment 4 CVS Commits 2004-09-28 22:43:27 UTC
Subject: Bug 17537

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-09-28 22:43:12

Modified files:
	gcc/cp         : ChangeLog g++spec.c 

Log message:
	PR driver/17537
	* g++spec.c (lang_specific_driver): Unrecognized libraries, other
	than -lc and -lm, may require linking against libstc++.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4393&r2=1.4394
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/g++spec.c.diff?cvsroot=gcc&r1=1.46&r2=1.47

Comment 5 Andrew Pinski 2004-09-28 22:53:21 UTC
Now only a 3.4 regression.
Comment 6 CVS Commits 2004-09-29 02:19:12 UTC
Subject: Bug 17537

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	sayle@gcc.gnu.org	2004-09-29 02:18:58

Modified files:
	gcc/cp         : ChangeLog g++spec.c 

Log message:
	PR driver/17537
	* g++spec.c (lang_specific_driver): Unrecognized libraries, other
	than -lc and -lm, may require linking against libstc++.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.161&r2=1.3892.2.162
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/g++spec.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.41&r2=1.41.4.1

Comment 7 Andrew Pinski 2004-09-29 02:34:46 UTC
Fixed.