[maemo-developers] Compiler bug with thread-local storage
From: David Huggins-Daines dhuggins at cs.cmu.eduDate: Thu May 29 22:53:23 EEST 2008
- Previous message: Pluthon on my N800 with OS2008
- Next message: Gtkmm's DrawingArea problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I'm not exactly sure where to report this bug, since maemo is using quite an old version of GCC, and I'm not sure if it is still present in the more recent ones. Anyway, when compiling this code: #include <stdio.h> __thread FILE *logfp = (FILE *)-1; FILE * set_logfp(FILE *newfp) { FILE *oldfp; if (logfp == (FILE *)-1) oldfp = stderr; else oldfp = logfp; logfp = newfp; return oldfp; } with the following options, I get this error message: [sbox-CHINOOK_ARMEL: ~/Projects] > gcc -O2 -fPIC -c foo.c /var/tmp/ccHiWmFT.s: Assembler messages: /var/tmp/ccHiWmFT.s:51: Error: symbol `.L8' is already defined I'm able to work around this bug by changing the code to this different, yet functionally equivalent version: #include <stdio.h> __thread FILE *logfp = (FILE *)-1; FILE * set_logfp(FILE *newfp) { FILE *oldfp; oldfp = logfp; logfp = newfp; if (oldfp == (void *)-1) oldfp = stderr; return oldfp; } My GCC version is: [sbox-CHINOOK_ARMEL: ~/Projects] > gcc -v Reading specs from /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.4/specs Reading specs from /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/gcc.specs rename spec cpp to old_cpp Configured with: /home/kl/cs2005q3-2_toolchain/gcc/glibc/work/gcc-2005q3-2/configure --build=i386-linux --host=i386-linux --target=arm-none-linux-gnueabi --prefix=/scratchbox/compilers/cs2005q3.2-glibc-arm --with-headers=/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include --enable-languages=c,c++ --enable-shared --enable-threads --disable-checking --enable-symvers=gnu --program-prefix=arm-linux- --with-gnu-ld --enable-__cxa_atexit --disable-libssp --disable-libstdcxx-pch --with-cpu= --enable-interwork Thread model: posix gcc version 3.4.4 (release) (CodeSourcery ARM 2005q3-2) If anyone could forward this or point me to the appropriate place to send it, I'd appreciate it, thanks!
- Previous message: Pluthon on my N800 with OS2008
- Next message: Gtkmm's DrawingArea problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]