Fix lx_hybrid_ctors test for Ubuntu 11.10
On Ubuntu 11.10 the host library created for the 'lx_hybrid_ctors' test doesn't get loaded, because the test object in the library is not being used by the application. This commit fixes the problem by having the application call a dummy function in the library. Fixes #120.
This commit is contained in:
parent
77a7207b42
commit
c29b5f7da3
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <base/printf.h>
|
#include <base/printf.h>
|
||||||
|
|
||||||
|
#include "testlib.h"
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,16 +25,27 @@ struct Testapp_testclass
|
||||||
{
|
{
|
||||||
Genode::printf("Global static constructor of Genode application called\n");
|
Genode::printf("Global static constructor of Genode application called\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dummy() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Testapp_testclass testapp_testclass;
|
extern Testlib_testclass testlib_testobject;
|
||||||
|
|
||||||
|
Testapp_testclass testapp_testobject;
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("--- lx_hybrid global static constructor test ---\n");
|
printf("--- lx_hybrid global static constructor test ---\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Call a dummy function on each test object to make sure that the
|
||||||
|
objects don't get optimized out.
|
||||||
|
*/
|
||||||
|
testlib_testobject.dummy();
|
||||||
|
testapp_testobject.dummy();
|
||||||
|
|
||||||
printf("--- returning from main ---\n");
|
printf("--- returning from main ---\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -13,12 +13,16 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
struct Testlib_testclass
|
#include "testlib.h"
|
||||||
{
|
|
||||||
Testlib_testclass()
|
|
||||||
{
|
|
||||||
printf("[init -> test-lx_hybrid_ctors] Global static constructor of host library called.\n");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Testlib_testclass testlib_testclass;
|
|
||||||
|
Testlib_testclass::Testlib_testclass()
|
||||||
|
{
|
||||||
|
printf("[init -> test-lx_hybrid_ctors] Global static constructor of host library called.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Testlib_testclass::dummy() { }
|
||||||
|
|
||||||
|
|
||||||
|
Testlib_testclass testlib_testobject;
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* \brief Test if global static constructors in host shared libs get called
|
||||||
|
* \author Christian Prochaska
|
||||||
|
* \date 2011-11-24
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2011-2012 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct Testlib_testclass
|
||||||
|
{
|
||||||
|
Testlib_testclass();
|
||||||
|
void dummy();
|
||||||
|
};
|
Loading…
Reference in New Issue