This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: "multiply defined" ___CTOR_LIST___ under FreeBSD 2.2.6
- To: egcs-bugs at cygnus dot com
- Subject: Re: "multiply defined" ___CTOR_LIST___ under FreeBSD 2.2.6
- From: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Date: Sat, 16 May 1998 15:14:22 +0200 (MET DST)
- cc: "David O'Brien" <obrien at NUXI dot com>
As none seems to have cared about my prevous reports :-(, I have
performed some further analysis and destilled a really small test case.
Please add that to the test suite.
-------- x.cc
#include "x.h"
C x;
main() { }
-------- y.cc
#include "x.h"
C y;
-------- x.h
class C {
int i;
public:
C(int j=0) : i(j) {}
};
------------------------------------------------------- invokation
% gcc -O3 x.cc y.cc
---------------------------------------------------- example trace
~ gcc -v
Reading specs from
/sw/swtest/egcs/BSD/lib/gcc-lib/i386-unknown-freebsd2.2.6/egcs-2.91.27/specs
gcc version egcs-2.91.27 19980502 (gcc2 ss-980502 experimental)
~ gcc x.cc y.cc
~ gcc x.cc y.cc -O3 -fno-inline
~ gcc x.cc y.cc -O3
/var/tmp/ccl153901.o: Definition of symbol `___CTOR_LIST__' (multiply
defined)
/var/tmp/ccl153902.o: Definition of symbol `___CTOR_LIST__' (multiply
defined)
collect2: ld returned 1 exit status
Short analysis: The problem occurs only when inlining is performed, i.e.,
with -O3 as long as -fno-inline is not specified. The linker in use is
default ld from FreeBSD 2.2.6.
Gerald
--
Gerald Pfeifer (Jerry) Vienna University of Technology
pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/