"multiply defined" ___CTOR_LIST___ under FreeBSD 2.2.6
Gerald Pfeifer
pfeifer@dbai.tuwien.ac.at
Sat May 16 06:14:00 GMT 1998
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/
More information about the Gcc-bugs
mailing list