On Nov 8, 2007 3:10 PM, Fillod Stephane <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Testing xenomai-2.4-rc5, I've encountered the following link error:
>
> powerpc-linux-uclibc-gcc -Wl,--wrap -Wl,pthread_create ....
> -Wl,--wrap -Wl,mmap -Wl,--wrap -Wl,munmap -o clocktest
> clocktest-clocktest.o  ../../skins/posix/.libs/libpthread_rt.a -lpthread
> -lrt
> .../powerpc-linux-uclibc/lib/libpthread.so: undefined reference to
> `__wrap_mmap'
> .../powerpc-linux-uclibc/lib/librt.so: undefined reference to
> `__wrap_close'
> .../powerpc-linux-uclibc/lib/libpthread.so: undefined reference to
> `__wrap_munmap'
> collect2: ld returned 1 exit status
> gmake[4]: *** [clocktest] Error 1
> $ powerpc-linux-uclibc-gcc --version
> powerpc-linux-uclibc-gcc (GCC) 3.4.3
> $ powerpc-linux-uclibc-ld --version
> GNU ld version 2.16.90.0.1 20050408
>
> If I swap the order of libpthread_rt.a and -lpthread -lrt, the link
> succeeds.
> I guess it has to do with the fact that a library which provides symbols
> has to be after in the link order of a module which needs them.
> Is it still okay with regard to pthread function wrapping?

No, libpthread_rt.a uses symbols defined by libpthread.so and
librt.so, so, they should be after. What you are observing is likely
an issue with regard to --wrap with static libraries.

The solution to this problem is to either use the dynamic
libpthread_rt.so, or to do the link edit in two stages:
first stage with libpthread_rt.a and all the --wrap
second stage with -lpthread and -lrt without all the --wrap

Unfortunately, the behaviour of --wrap with static libraries is not
the same on all platforms.

-- 
                                               Gilles Chanteperdrix

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to