FW: Problem with shared library

Khem Raj raj.khem at gmail.com
Thu Nov 24 06:18:24 UTC 2011


On Fri, Nov 4, 2011 at 5:28 AM, Naveen H. S <Naveen.S at kpitcummins.com> wrote:
> Hi,
>
> We are implementing uclibc port for CR16 target with shared library
> support. However, there was an issue observed during testing the port
> with shared library.

and what changes did you make how do we know ?

>
> The following link was referred to compile the applications with static
> and shared libraries:-
> http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
>
> The application contains a main.c file which calls lib_func function
> in lib.c file.
> =======================================================================
> static int val = 1 ;
> static void init( void )
> {
>        val = 13 ;
> }
> int lib_func( const char* s )
> {
> printf( "\tEntering %s, called from %s\n\n", __FUNCTION__, s ) ;
>        return val ;
> }
> =======================================================================
>
> The application with static library generates correct output "13" by
> calling init function init(). However, with shared library; it does
> not seem to call init() and generates wrong output "1" as follows:-
> ==================================================
> Starting ./test.out...
>        Entering lib_func, called from ./test.out
> lib_func() returned 1
> ==================================================
>
> Please find attached the command file "command" which shows exact
> commands used for application and library compilation. On investigation,
> the problem seem to be due to the incorrect calling of initialization
> routines in crt files. It was observed that the shared library calls
> "shared_flat_add_library" in crt1.S file. The same routine is used in
> bfin and m68k code. Please find attached the initialization files
> crt1.S file present in uClibc/libc/sysdeps/linux/cr16 folder.
>
> Please let us know if anything else should be done for the proper
> functioning of initialization code in shared libraries.
>
> Thanks & Regards,
> Naveen
>
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
>


More information about the uClibc mailing list