[uClibc 0000867]: Undefined references to _dl_app_fini_array and _dl_app_init_array when trying to link statically with uclibc

bugs at busybox.net bugs at busybox.net
Mon May 8 12:31:05 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=867 
====================================================================== 
Reported By:                blurgk
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   867
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             05-05-2006 02:15 PDT
Last Modified:              05-08-2006 05:31 PDT
====================================================================== 
Summary:                    Undefined references to _dl_app_fini_array and
_dl_app_init_array when trying to link statically with uclibc
Description: 
I get undefined references when I try to link a program statically to
uclibc:

$ cat test.c 
#include <stdio.h>

int main (void)
{
        printf ("Hello\n");
        return 0;
}

$ arm-linux-gcc test.c -o test -static
/usr/src/buildroot-20060308/build_arm/staging_dir/lib/gcc/arm-linux-uclibc/3.4.5/../../../../arm-linux-uclibc/lib/libc.a(__uClibc_main.os):
In function `__GI___uClibc_fini':
__uClibc_main.c:(.text+0x13c): undefined reference to
`_dl_app_fini_array'
/usr/src/buildroot-20060308/build_arm/staging_dir/lib/gcc/arm-linux-uclibc/3.4.5/../../../../arm-linux-uclibc/lib/libc.a(__uClibc_main.os):
In function `__uClibc_main':
__uClibc_main.c:(.text+0x2e0): undefined reference to
`_dl_app_init_array'
collect2: ld returned 1 exit status

====================================================================== 

---------------------------------------------------------------------- 
 psm - 05-05-06 03:59  
---------------------------------------------------------------------- 
run gcc w/ -v and provide that output, your toolchain seems to work
incorrectly
_dl_app_*_array does not have to be in libc.a (only in libc.so) and
shouldn't
be used for static linking. readelf -s libc.a | more, search for
__uClibc_main
and see if _dl_app_*_array appear there (and see if __uClibc_main.os or
.oS was
added to the archive) 

---------------------------------------------------------------------- 
 blurgk - 05-08-06 05:03  
---------------------------------------------------------------------- 
Thanks for your help.

$ arm-linux-gcc -v
Reading specs from
/usr/src/buildroot-20060308/build_arm/staging_dir/lib/gcc/arm-linux-uclibc/3.4.5/specs
Configured with:
/usr/src/buildroot-20060308/toolchain_build_arm/gcc-3.4.5/configure
--prefix=/usr/src/buildroot-20060308/build_arm/staging_dir
--build=i386-pc-cygwin --host=i386-pc-cygwin --target=arm-linux-uclibc
--enable-languages=c,c++ --enable-shared --disable-__cxa_atexit
--enable-target-optspace --with-gnu-ld --disable-nls --disable-threads
--enable-multilib
Thread model: single
gcc version 3.4.5

Readelf tells me that _dl_app_init_array and _dl_app_fini_array are in
libc.a, and yes __uClibc_main.os was added the archive. 

---------------------------------------------------------------------- 
 psm - 05-08-06 05:31  
---------------------------------------------------------------------- 
those shouldn't be in __uClibc_main.os (only in __uClibc_main.oS and it
can
happen only if that file was compiled w/ -DSHARED (that is incorrect,
probably
your toolchain -cygwin? added that?) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
05-05-06 02:15  blurgk         New Issue                                    
05-05-06 02:15  blurgk         Status                   new => assigned     
05-05-06 02:15  blurgk         Assigned To               => uClibc          
05-05-06 03:59  psm            Note Added: 0001346                          
05-08-06 05:03  blurgk         Note Added: 0001355                          
05-08-06 05:31  psm            Note Added: 0001356                          
======================================================================




More information about the uClibc-cvs mailing list