This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11137] [3.3 Regression] Linux shared library constructors not called unless there's one global object


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]