Bug 1939

Summary: strverscmp failure
Product: uClibc Reporter: dglwx <dugulengwuxue>
Component: Shared Library SupportAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: uclibc-cvs
Priority: P5    
Version: 0.9.31   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description dglwx 2010-06-03 16:33:14 UTC
When I build the cross tool for arm based on buildroot-2010.05 with uClibc-0.9.31, which can build successfully. 
 
  But when I try to use this cross compiler to compile some program such as tree-1.5.2, which will call strverscmp(), it will failure when do link:

arm-linux-gcc -O2 -Wall -fomit-frame-pointer -D__USE_GNU -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -c -o tree.o tree.c
tree.c: In function 'main':
tree.c:507: warning: pointer targets in passing argument 1 of 'printit' differ in signedness
tree.c: In function 'listdir':
tree.c:759: warning: pointer targets in passing argument 1 of 'printit' differ in signedness
tree.c:772: warning: pointer targets in passing argument 1 of 'printit' differ in signedness
tree.c: In function 'printit':
tree.c:1234: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
tree.c:1235: warning: pointer targets in passing argument 2 of 'mbstowcs' differ in signedness
arm-linux-gcc -static -L/opt/buildroot-2010.05/staging/usr/lib -lc -o tree tree.o
tree.o: In function `versort':
tree.c:(.text+0x2160): undefined reference to `strverscmp'
collect2: ld returned 1 exit status
make: *** [tree] Error 1


I try modify head file uClibc-0.9.31/include/features.h and add __USE_GNU defined in it, and rebuild the cross compiler, it failure again.

Then I use arm-linux-objdump -x uClibc-0.9.31/lib/libc.a, I can find strverscmp() is defined in the static library, but why does the cross compiler can not find and link it?

strverscmp.os:     file format elf32-littlearm
rw-r--r-- 0/0   1280 Jun  3 22:45 2010 strverscmp.os
architecture: arm, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
private flags = 4000000: [Version4 EABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000010c  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000140  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000140  2**0
                  ALLOC
  3 .rodata       0000004c  00000000  00000000  00000140  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .note.GNU-stack 00000000  00000000  00000000  0000018c  2**0
                  CONTENTS, READONLY
  5 .ARM.attributes 00000031  00000000  00000000  0000018c  2**0
                  CONTENTS, READONLY
SYMBOL TABLE:
00000000 l    df *ABS*  00000000 strverscmp.c
00000000 l    d  .text  00000000 .text
00000000 l    d  .data  00000000 .data
00000000 l    d  .bss   00000000 .bss
0000003c l     O .rodata        00000010 next_state.1574
00000000 l     O .rodata        0000003c result_type.1575
00000000 l    d  .rodata        00000000 .rodata
00000000 l    d  .note.GNU-stack        00000000 .note.GNU-stack
00000000 l    d  .ARM.attributes        00000000 .ARM.attributes
00000000 g     F .text  0000010c .hidden __GI_strverscmp
00000000         *UND*  00000000 _GLOBAL_OFFSET_TABLE_
Comment 1 Bernhard Reutner-Fischer 2011-06-14 17:11:07 UTC
This was fixed in 139b8f0c673fed465d27f99c98568e5d5e1b9b72 and is fixed in 0.9.32.

Thanks!