On Tue, May 20, 2008 at 08:40:19PM +0200, Denys Vlasenko wrote:

>I can reproduce it. In fact, there is a hint in 
>libpthread/linuxthreads.old/forward.c
>that something is fishy here:
>
>#include <features.h>
>#include <stdlib.h>
>#include <dlfcn.h>
>
>/* psm: keep this before internals.h */  <==============
>libc_hidden_proto(exit)
>
>#include "internals.h"
>...
>
>psm noticed that doing libc_hidden_proto(exit) AFTER #include "internals.h"
>produces a warning, and commented about it. But he either didn't look into 
>"why?"
>or he didn't describe it in comments. Bad boy psm, bad ;) [joking]
>
>The same thing bites here, just with libc_hidden_proto(memcpy) etc. instead.
>it happens inside internals.h when it includes string.h.
>I killed 20 minutes finding out "why?".
>It happens quite deep in include tree.
>
>I took unmodified tree (prior to rev 22012) and played with
>adding just libc_hidden_proto(memcpy).
>In libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h
>adding #include <string.h> and libc_hidden_proto(memcpy)
>just before weak_extern (__pthread_initialize) will not warn:
>
>//warns? no
>//#include <string.h>
>//libc_hidden_proto(memcpy)
>weak_extern (__pthread_initialize)
>//warns? yes
>//#include <string.h>
>//libc_hidden_proto(memcpy)
>
>but adding after it will! Which is extremely strange -
>weak_extern expands into just "#pragma weak __pthread_initialize"
>
>These are exact gcc commands which are used to generate forward.oS:
>
>gcc -E libpthread/linuxthreads.old/forward.c -o forward.i.c -include 
>./include/libc-symbols.h -Wall -Wstrict-prototypes -fno-strict-aliasing 
>-Wnested-externs -Wshadow -Wmissing-noreturn -Wmissing-format-attribute 
>-Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wnonnull -Wundef 
>-ffunction-sections -fdata-sections -m32 -march=i486 -fstack-protector 
>-fno-builtin -nostdinc -I./include -I. -I./libc/sysdeps/linux/i386 
>-DUCLIBC_INTERNAL -std=gnu99 -Os -funit-at-a-time -fno-tree-loop-optimize 
>-fno-tree-dominator-opts -fno-strength-reduce -fomit-frame-pointer 
>-mpreferred-stack-boundary=2 -falign-functions=1 -falign-jumps=1 
>-falign-labels=1 -falign-loops=1 
>-I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux/i386 
>-I./libpthread/linuxthreads.old/sysdeps/i386 
>-I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux 
>-I./libpthread/linuxthreads.old/sysdeps/pthread 
>-I./libpthread/linuxthreads.old -I./libpthread 
>-I/usr/srcdevel/uclibc/include_2.6.18.1/include/ -iwithprefix include-fixed 
>-iwithprefix include -DMALLOC_DEBUGGING -DHEAP_DEBUGGING -fPIC -DSHARED 
>-fstack-protector-all
>gcc -c forward.i.c -o forward.i.oS -include ./include/libc-symbols.h -Wall 
>-Wstrict-prototypes -fno-strict-aliasing -Wnested-externs -Wshadow 
>-Wmissing-noreturn -Wmissing-format-attribute -Wformat=2 -Wmissing-prototypes 
>-Wmissing-declarations -Wnonnull -Wundef -ffunction-sections -fdata-sections 
>-m32 -march=i486 -fstack-protector -fno-builtin -nostdinc -I./include -I. 
>-I./libc/sysdeps/linux/i386 -DUCLIBC_INTERNAL -std=gnu99 -Os -funit-at-a-time 
>-fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce 
>-fomit-frame-pointer -mpreferred-stack-boundary=2 -falign-functions=1 
>-falign-jumps=1 -falign-labels=1 -falign-loops=1 
>-I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux/i386 
>-I./libpthread/linuxthreads.old/sysdeps/i386 
>-I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux 
>-I./libpthread/linuxthreads.old/sysdeps/pthread 
>-I./libpthread/linuxthreads.old -I./libpthread 
>-I/usr/srcdevel/uclibc/include_2.6.18.1/include/ -iwithprefix include-fixed 
>-iwithprefix include -DMALLOC_DEBUGGING -DHEAP_DEBUGGING -fPIC -DSHARED 
>-fstack-protector-all
>
>Can you confirm my observation by adding #include <string.h>
>and libc_hidden_proto(memcpy) after weak_extern (__pthread_initialize)
>and running above two commands?
>
>Also note: if you will run first command, then comment out this line
>in forward.i.c:
>
>//#pragma weak __pthread_initialize
>
>which should change nothing - __pthread_initialize is not mentined anywhere 
>else
>in forward.i.c - and run the second command - it will NOT warn!
>
>Looks like gcc bug to me.

hmz. I'll try to reproduce this sometimes in the next days. Do you have
a small standalone testcase that exposes this alleged bug that you could
put into the gcc bugzilla, by chance?

>
>P.S. I am getting tons of warnings like this:

I've fixed those earlier today, please svn up and holler if you still
get alot of them (a *few* undefined tokens are expected, ATM)
> CC libpthread/linuxthreads.old/spinlock.o
>In file included from ./libpthread/linuxthreads.old/sysdeps/i386/tls.h:23,
>                 from ./include/bits/uClibc_errno.h:14,
>                 from ./include/errno.h:62,
>                 from libpthread/linuxthreads.old/spinlock.c:19:
>./libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h:76:5: warning: 
>"__ASSUME_LDT_WORKS" is not defined
>In file included from libpthread/linuxthreads.old/internals.h:22,
>                 from libpthread/linuxthreads.old/spinlock.c:25:
>./libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h:40:5: warning: 
>"USE_TLS" is not defined
>
>(.config is attached)
>
>and also forward.oS is not automatically rebuilt by make
>if I touch it. I need to delete it and lib/* to make it work.
>Build system is broken.

Can you apply your other proposal (that lives next to the existing one so
we can start playing with it)? TIA!

_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to