This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11137] [3.3 Regression] Linux shared library constructors not called unless there's one global object
- From: "pinskia at physics dot uc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jun 2003 15:58:49 -0000
- Subject: [Bug c++/11137] [3.3 Regression] Linux shared library constructors not called unless there's one global object
- References: <20030609194942.11137.jcalcote@novell.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11137
------- Additional Comments From pinskia at physics dot uc dot edu 2003-06-29 15:58 -------
I forgot to put the testcase I used:
pr11137.cc:
extern "C" int printf(const char*,...);
void f() __attribute__((constructor));
void f()
{
printf("Hi\n");
}
pr11137.1.cc:
int main() {return 0;}
gcc -shared -o pr11137.so pr11137.cc
gcc pr11137.1.cc pr11137.so
env LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH} ./a.out
It should be print "Hi" but it does not on 3.3.1 (20030616) because gcc does not create a
function which calls f() but 3.4 does.