bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .ctor section of shared libraries with PathScale compiler


From: Noah Misch
Subject: Re: .ctor section of shared libraries with PathScale compiler
Date: Wed, 25 Apr 2007 19:58:22 -0700
User-agent: Mutt/1.5.9i

On Wed, Apr 25, 2007 at 12:36:23PM -0400, Jeff Squyres wrote:
> I'm told that I can describe the patch in implementation-free terms  
> in the hope that someone else can implement it who either can setup  
> to transfer copyright to the FSF or already has such a transfer  
> agreement in place.
> 
> The patch is very simple.  It's a test that makes a shared library  
> containing a single instance of a class in the global scope.  The  
> class has a specific constructor that should be invoked before main()  
> (since the instance is in the global scope).  It is easy enough to  
> test whether the constructor has run before main(); if it has, the  
> test passes.  If it has not, the test fails.

Does the test this patch adds exercise the bug affecting your compiler?

2007-04-25  Noah Misch  <address@hidden>

        * tests/ctor.at: New file.
        * Makefile.am (TESTSUITE_AT): Add tests/ctor.at.

diff -NurpX dontdiff lt-bootstrap/Makefile.am lt-ctortest/Makefile.am
--- lt-bootstrap/Makefile.am    2007-04-24 16:46:17.000000000 -0400
+++ lt-ctortest/Makefile.am     2007-04-25 22:52:10.000000000 -0400
@@ -448,6 +448,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/nonrecursive.at \
                  tests/recursive.at \
                  tests/template.at \
+                 tests/ctor.at \
                  tests/early-libtool.at \
                  tests/deplibs-ident.at \
                  tests/stresstest.at \
diff -NurpX dontdiff lt-bootstrap/tests/ctor.at lt-ctortest/tests/ctor.at
--- lt-bootstrap/tests/ctor.at  1969-12-31 19:00:00.000000000 -0500
+++ lt-ctortest/tests/ctor.at   2007-04-25 22:54:19.000000000 -0400
@@ -0,0 +1,66 @@
+# ctor.at -- Test constructors via C++                        -*- Autotest -*-
+#
+#   Copyright (C) 2007 Free Software Foundation, Inc.
+#   Written by Noah Misch, 2007
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+AT_BANNER([Constructors.])
+
+AT_SETUP([C++ static constructors])
+LT_AT_TAG([CXX])
+AT_KEYWORDS([libtool])
+
+AT_DATA(class.h,
+[[class Foo {
+public:
+       Foo() { bar = 0xaabbccdd; }
+       unsigned bar;
+};
+
+extern Foo instance;
+]])
+
+AT_DATA(libctor.cpp,
+[[#include "class.h"
+Foo instance;
+]])
+
+AT_DATA(main.cpp,
+[[#include "class.h"
+
+int main(int argc, char **argv)
+{
+  return instance.bar != 0xaabbccdd;
+}
+]])
+
+AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
+         -c libctor.cpp -o libctor.lo], [0], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
+         -c main.cpp -o main.lo], [0], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
+         libctor.lo -o libctor.la -rpath /none], [0], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
+         main.lo libctor.la -o main], [0], [ignore], [ignore])
+
+LT_AT_EXEC_CHECK([./main], [0])
+
+AT_CLEANUP




reply via email to

[Prev in Thread] Current Thread [Next in Thread]