[uClibc] Re: Use GCC option -fPIC for shared objects

Peter S. Mazinger ps.m at gmx.net
Thu Apr 29 18:41:21 UTC 2004


> My program is dynamically opening librairies via dlopen()
> and report my the following error à lib's load :
> 
> ~ # extractVar
> Can't modify /usr/lib/mini_httpd/plugins/cpu.so's text section. Use GCC 
> option -fPIC for shared objects, please.
> 
> Nevertheless, the cpu.so lib is compiled using the following flags :
> -fPIC 
> -Wl,-shared,-Bsymbolic,--dynamic-linker,/lib/ld-uClibc.so.0,-soname,cpu.so

Check your file w/ readelf -d cpu.so | grep TEXTREL, if you have TEXTREL, 
that is the problem, it is not enough to use -fPIC for cpu.so only, you 
have to build all the objects included into cpu.so w/ -fPIC, than TEXTREL  
should dissapear, if not then some code is not PIC aware, (for ex.  
assembler code), some older code needs -DPIC too, check code for #ifdef 
PIC and change it to __PIC__)

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2


____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu



More information about the uClibc mailing list