Define '__dso_handle' in shared libraries.

The '__dso_handle' symbol is needed when building with GCC 4.7.

Fixes #437.
This commit is contained in:
Christian Prochaska 2012-10-24 20:10:30 +02:00 committed by Norman Feske
parent 9d08c2b675
commit 5a88e106df
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,13 @@ typedef void (*ld_hook)(void);
static ld_hook _lctors_start[1] SECTION("_mark_ctors_start") = BEG;
static ld_hook _lctors_end[1] SECTION("_mark_ctors_end") = END;
/*
* '__dso_handle' needs to be defined in the main program and in each shared
* object. Because ld.lib.so is both of them, '__dso_handle' is weak here.
*/
void *__dso_handle __attribute__((__visibility__("hidden")))
__attribute__((weak)) = &__dso_handle;
/* called by dynamic linker on library startup (ld-genode.so) */
extern "C" {
void _init(void) __attribute__((used,section(".init")));