summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-01 22:20:11 (UTC)
committer sandman <sandman>2002-12-01 22:20:11 (UTC)
commit5a550802680d32ccb0ea0d596f514de7e13c45dc (patch) (unidiff)
treeec5d1d11630ea94cde1547c8525b522d743e871d
parent90e100450625fc121523e67413b2da7f57f6d650 (diff)
downloadopie-5a550802680d32ccb0ea0d596f514de7e13c45dc.zip
opie-5a550802680d32ccb0ea0d596f514de7e13c45dc.tar.gz
opie-5a550802680d32ccb0ea0d596f514de7e13c45dc.tar.bz2
Added a fix for programs that have been compiled with old toolchains and
are used together with shared libs produced by newer toolchains .. they might not have the __gmon_start__ symbol defined (e.g. neocal or hancom on a glibc 2.3.1 iPAQ with the latest libjpeg62)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/libpreload/preload.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/launcher/libpreload/preload.cpp b/core/launcher/libpreload/preload.cpp
index 10d8313..cc1baac 100644
--- a/core/launcher/libpreload/preload.cpp
+++ b/core/launcher/libpreload/preload.cpp
@@ -1,79 +1,85 @@
1 1
2#define _GNU_SOURCE 2#define _GNU_SOURCE
3//#define private public 3//#define private public
4//#define protected public 4//#define protected public
5 5
6#include <qwsdecoration_qws.h> 6#include <qwsdecoration_qws.h>
7#include <qcommonstyle.h> 7#include <qcommonstyle.h>
8 8
9//#include <qapplication.h> 9//#include <qapplication.h>
10//#include <qfont.h> 10//#include <qfont.h>
11 11
12//class QStyle; 12//class QStyle;
13class QApplication; 13class QApplication;
14class QFont; 14class QFont;
15//class QWSDecoration; 15//class QWSDecoration;
16 16
17#include <dlfcn.h> 17#include <dlfcn.h>
18#include <unistd.h> 18#include <unistd.h>
19#include <stdio.h> 19#include <stdio.h>
20#include <stdlib.h> 20#include <stdlib.h>
21 21
22 22
23typedef void ( *qapp_setstyle_t ) ( QStyle * ); 23typedef void ( *qapp_setstyle_t ) ( QStyle * );
24typedef void ( *qapp_setdeco_t ) ( QWSDecoration * ); 24typedef void ( *qapp_setdeco_t ) ( QWSDecoration * );
25typedef void ( *qapp_setfont_t ) ( const QFont &, bool, const char * ); 25typedef void ( *qapp_setfont_t ) ( const QFont &, bool, const char * );
26 26
27 27
28static int *opie_block_style_p = 0; 28static int *opie_block_style_p = 0;
29 29
30extern "C" { 30extern "C" {
31 31
32extern void __gmon_start ( ) __attribute(( weak ));
33
34extern void __gmon_start__ ( )
35{
36}
37
32static void *resolve_symbol ( const char *sym ) 38static void *resolve_symbol ( const char *sym )
33{ 39{
34 void *adr = ::dlsym ( RTLD_NEXT, sym ); 40 void *adr = ::dlsym ( RTLD_NEXT, sym );
35 41
36 if ( !adr ) 42 if ( !adr )
37 ::fprintf ( stderr, "PANIC: Could not resolve symbol \"%s\"\n", sym ); 43 ::fprintf ( stderr, "PANIC: Could not resolve symbol \"%s\"\n", sym );
38 44
39 return adr; 45 return adr;
40} 46}
41 47
42extern void setStyle__12QApplicationP6QStyle ( QStyle *style ) 48extern void setStyle__12QApplicationP6QStyle ( QStyle *style )
43{ 49{
44 static qapp_setstyle_t qsetstyle = 0; 50 static qapp_setstyle_t qsetstyle = 0;
45 51
46 if ( !qsetstyle ) 52 if ( !qsetstyle )
47 qsetstyle = (qapp_setstyle_t) resolve_symbol ( "setStyle__12QApplicationP6QStyle" ); 53 qsetstyle = (qapp_setstyle_t) resolve_symbol ( "setStyle__12QApplicationP6QStyle" );
48 54
49 if ( !opie_block_style_p ) 55 if ( !opie_block_style_p )
50 opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); 56 opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" );
51 57
52 if ( !qsetstyle || ( opie_block_style_p && ( *opie_block_style_p & 0x01 ))) 58 if ( !qsetstyle || ( opie_block_style_p && ( *opie_block_style_p & 0x01 )))
53 delete style; 59 delete style;
54 else 60 else
55 ( *qsetstyle ) ( style ); 61 ( *qsetstyle ) ( style );
56} 62}
57 63
58extern void setFont__12QApplicationRC5QFontbPCc ( const QFont &fnt, bool informWidgets, const char * className ) 64extern void setFont__12QApplicationRC5QFontbPCc ( const QFont &fnt, bool informWidgets, const char * className )
59{ 65{
60 static qapp_setfont_t qsetfont = 0; 66 static qapp_setfont_t qsetfont = 0;
61 67
62 if ( !qsetfont ) 68 if ( !qsetfont )
63 qsetfont = (qapp_setfont_t) resolve_symbol ( "setFont__12QApplicationRC5QFontbPCc" ); 69 qsetfont = (qapp_setfont_t) resolve_symbol ( "setFont__12QApplicationRC5QFontbPCc" );
64 70
65 if ( !opie_block_style_p ) 71 if ( !opie_block_style_p )
66 opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); 72 opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" );
67 73
68 if ( qsetfont && !( opie_block_style_p && ( *opie_block_style_p & 0x02 ))) 74 if ( qsetfont && !( opie_block_style_p && ( *opie_block_style_p & 0x02 )))
69 ( *qsetfont ) ( fnt, informWidgets, className ); 75 ( *qsetfont ) ( fnt, informWidgets, className );
70} 76}
71 77
72 78
73extern void qwsSetDecoration__12QApplicationP13QWSDecoration ( QWSDecoration *deco ) 79extern void qwsSetDecoration__12QApplicationP13QWSDecoration ( QWSDecoration *deco )
74{ 80{
75 static qapp_setdeco_t qsetdeco = 0; 81 static qapp_setdeco_t qsetdeco = 0;
76 82
77 if ( !qsetdeco ) 83 if ( !qsetdeco )
78 qsetdeco = (qapp_setdeco_t) resolve_symbol ( "qwsSetDecoration__12QApplicationP13QWSDecoration" ); 84 qsetdeco = (qapp_setdeco_t) resolve_symbol ( "qwsSetDecoration__12QApplicationP13QWSDecoration" );
79 85