bughunt: build testcase statically linked

...but still dynamically linking against the core lib
But the actual template instantiations happen now within the two
compilation units, which are linked statically.

When looking into the symbol table, we can see that the static
field is emitted two times

readelf -W target/clang-static-init -s | c++filt |less
This commit is contained in:
Fischlurch 2013-09-30 00:42:27 +02:00
parent cec78fdc58
commit 10a511d29c
4 changed files with 21 additions and 30 deletions

View file

@ -9,10 +9,12 @@ Import('env core support_lib')
envR = env.Clone() envR = env.Clone()
envR.Append(CPPPATH='research')
# envR.Append(CCFLAGS=' -O3 ') # envR.Append(CCFLAGS=' -O3 ')
# build additional test and administrative tools.... # build additional test and administrative tools....
experiments = [ envR.Program('try', ['try.cpp'] + support_lib) #### to try out some feature... experiments = [ envR.Program('try', ['try.cpp'] + support_lib) #### to try out some feature...
, envR.Program('clang-static-init', ['clang-static-init-1.cpp', 'clang-static-init-2.cpp'] + core)
] ]
# #

View file

@ -1,7 +1,7 @@
#include "lib/test/run.hpp" #include "lib/test/run.hpp"
#include "proc/hh.hpp"
#include "proc/config-resolver.hpp" #include "proc/config-resolver.hpp"
#include "clang-static-init.hpp"
#include <iostream> #include <iostream>
@ -12,27 +12,19 @@ using std::cout;
using std::endl; using std::endl;
namespace proc { int
namespace test { main (int, char**)
{
cout << "\n.gulp.\n";
ConfigResolver& ref1 = ConfigResolver::instance();
ConfigResolver& sub2 = test::fabricate();
cout << "sub1="<< &ref1 << " sub2="<< &sub2 <<"\n";
return 0;
}
class StaticInstance_test : public Test
{
virtual void
run (Arg)
{
ConfigResolver& ref1 = ConfigResolver::instance();
ConfigResolver& sub2 = fabricate();
cout << "sub1="<< &ref1 << " sub2="<< &sub2 <<"\n";
}
};
/** Register this test class... */
LAUNCHER (StaticInstance_test, "unit bug");
}} // namespace proc::test

View file

@ -1,5 +1,5 @@
#include "proc/hh.hpp" #include "clang-static-init.hpp"
#include <iostream> #include <iostream>
@ -8,7 +8,6 @@ using std::cout;
using std::endl; using std::endl;
namespace proc {
namespace test { namespace test {
@ -33,4 +32,4 @@ namespace test {
} }
}} // namespace proc::test } // namespace test

View file

@ -3,7 +3,6 @@
#include "proc/config-resolver.hpp" #include "proc/config-resolver.hpp"
namespace proc {
namespace test { namespace test {
template<typename T> template<typename T>
@ -40,5 +39,4 @@ namespace test {
}} // namespace proc::test } // namespace test