[uClibc 0000435]: Linker's Complain about Missing _init and _fini in crt1.o for arm Architecture

bugs at busybox.net bugs at busybox.net
Mon Oct 3 05:40:21 UTC 2005


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=435 
====================================================================== 
Reported By:                Charles
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   435
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             09-17-2005 00:53 PDT
Last Modified:              10-02-2005 22:40 PDT
====================================================================== 
Summary:                    Linker's Complain about Missing _init and _fini in
crt1.o for arm Architecture
Description: 
When building uClibc for arm architecture with a configuration of

# UCLIBC_CTOR_DTOR is not set

the resulting crt1.o will have _init and _fini undefined, and this causes
the linker (of GCC 3.4.4) to stop with an error of missing _init and _fini
when building applications. The output of 'nm crt1.o' is

00000000 D __data_start
00000000 W data_start
         U _fini
         U _init
         U main
00000000 T _start
         U __uClibc_main

Please confirm this issue and have it fixed.

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

---------------------------------------------------------------------- 
 vapier - 09-17-05 01:43  
---------------------------------------------------------------------- 
give the attached patch a spin ... it should work, but i just used a simple
gcc -c and readelf -s to test 

---------------------------------------------------------------------- 
 jocke - 09-17-05 02:44  
---------------------------------------------------------------------- 
You changed the order here:
+	.word main(GOT)
+# ifdef __UCLIBC_CTOR_DTOR__
 	.word _fini(GOT)
 	.word _init(GOT)
-	.word main(GOT)
+# endif
Don't think thats gonna work.

Just make _init & _fini weaks or if that doesn't work, try
a .word 0 instead of .word _fini(GOT) & .word _init(GOT) 

---------------------------------------------------------------------- 
 jocke - 09-18-05 07:07  
---------------------------------------------------------------------- 
How about this:

-       .type _start,#function
+       .type _start,%function
+       .type _init,%function
+       .type _fini,%function
+#ifndef __UCLIBC_CTOR_DTOR__
+       .weak _fini
+       .weak _init
+#endif
 _start:
        /* Clear the frame pointer and link register since this is the
outermost frame.  */
        mov fp, http://busybox.net/bugs/view.php?id=0
@@ -132,14 +138,6 @@
        .word _fini(GOT)
        .word _init(GOT)
        .word main(GOT)
-#else
-# ifdef __UCLIBC_CTOR_DTOR__
-       .type _init,%function
-       .type _fini,%function
-# else
-       .weak _fini
-       .weak _init
-# endif
 #endif 

---------------------------------------------------------------------- 
 psm - 09-29-05 15:44  
---------------------------------------------------------------------- 
The last version proposed is applied to svn with an additional correction
including features.h. Please report if it solved your problem 

---------------------------------------------------------------------- 
 Charles - 10-02-05 22:40  
---------------------------------------------------------------------- 
I have tested version 11699 of libc/sysdeps/linux/arm/crt1.S and it
resolves the issue reported. The output of 'nm crt1.o' for arm
architecture now looks like this:

00000000 D __data_start
00000000 W data_start
         w _fini
         w _init
         U main
00000000 T _start
         U __uClibc_main 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-17-05 00:53  Charles        New Issue                                    
09-17-05 00:53  Charles        Status                   new => assigned     
09-17-05 00:53  Charles        Assigned To               => uClibc          
09-17-05 00:55  Charles        Issue Monitored: Charles                     
09-17-05 01:42  vapier         File Added: uclibc-arm-init-fini-weak.patch      
             
09-17-05 01:43  vapier         Note Added: 0000540                          
09-17-05 02:44  jocke          Note Added: 0000541                          
09-18-05 07:07  jocke          Note Added: 0000547                          
09-29-05 15:44  psm            Note Added: 0000587                          
10-02-05 22:40  Charles        Note Added: 0000594                          
======================================================================




More information about the uClibc-cvs mailing list