BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000435 [uClibc] Architecture Specific minor always 09-17-05 00:53 10-02-05 23:19
Reporter Charles View Status public  
Assigned To uClibc
Priority normal Resolution fixed  
Status closed   Product Version 0.9.28
Summary 0000435: 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.
Additional Information When building uClibc for i386 architecture with the same configuration, the output of 'nm crt1.o' becomes

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

It seems that libc/sysdeps/linux/i386/crt1.S handles this cleverly by making both _init and _fini weak symbols. It is suggested that libc/sysdeps/linux/arm/crt1.S does the same thing to prevent the linker from complaining.
Attached Files  uclibc-arm-init-fini-weak.patch [^] (684 bytes) 09-17-05 01:42

- Relationships

- Notes
(0000540)
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
 
(0000541)
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)
 
(0000547)
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, 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
 
(0000587)
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
 
(0000594)
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
 
(0000595)
psm
10-02-05 23:19

resolved
 

- 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
10-02-05 23:19 psm Note Added: 0000595
10-02-05 23:19 psm Status assigned => closed
10-02-05 23:19 psm Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker