strtoq on x86_64

Natanael Copa natanael.copa at gmail.com
Fri Nov 26 12:52:12 UTC 2010


Hi,

We are working on porting Alpine Linux to x86_64 (with nptl). In
addition to __GI___chk_fail fix[1] and protected symbols
"workaround"[2] we have so far bumped into an issue with strtoq. pcre
fails to build during linking on missing symbol strtoq. The configure
script only did a compile check when testing for strtoq() and not link
test. Changing[3] the configure script to do link test makes it build
successfully.

Second issue is asterisk, which also seems to be related to strtoq.

   [CC] chan_sip.c -> chan_sip.o
In file included from
/home/ncopa/aports/main/asterisk/src/asterisk-1.8.0/include/asterisk.h:27:0,
                 from chan_sip.c:209:
/home/ncopa/aports/main/asterisk/src/asterisk-1.8.0/include/asterisk/compat.h:129:10:
error: conflicting types for 'strtoq'
/usr/include/stdlib.h:211:22: note: previous declaration of 'strtoq' was here
make[1]: *** [chan_sip.o] Error 1
make: *** [channels] Error 2

strtoq seems to be a strong alias to strtoll

This testcase works on x86 but not x86_64:

$ cat strtoq.c
int main() { char* e; return strtoq("100", &e, 10); }
$ gcc strtoq.c
/tmp/ccEh3NhS.o: In function `main':
strtoq.c:(.text+0x30): undefined reference to `strtoq'
collect2: ld returned 1 exit status

Doing the same with strtoll works though.

There are some ifdefs in libc/stdlib.c[4] that prevents the strtoq
alias be made. Exactly why i dont know really, but i think we either
need to create a correct alias for x86_64 or remove the strtoq def in
the header file.

-- 
Natanael Copa

[1] https://bugs.busybox.net/show_bug.cgi?id=2713
[2] http://lists.uclibc.org/pipermail/uclibc/2010-April/043935.html
[3] http://git.alpinelinux.org/cgit/aports/tree/main/pcre/uclibc-strtoq.patch
[4] http://git.uclibc.org/uClibc/tree/libc/stdlib/stdlib.c#n348


More information about the uClibc mailing list