[LLVMdev] pthread_equal multiply defined in .bc files

Duncan Sands baldrick at free.fr
Sun Sep 30 09:26:11 PDT 2012


Hi Yuelu,

> When I tried to use the latest version of LLVM tools (clang as the frontend) to
> compile and link a project with multiple c files, it appears that each of the
> generated .bc file contains a definition of pthread_equal, resulting llvm-link
> failure with error message "multiply symbols defined". I tried but did not get
> any answer on the web.  So I turn to you for help.

...

> define i32 @pthread_equal(i32 %__thread1, i32 %__thread2) nounwind readnone
> inlinehint {
> entry:
>    %cmp = icmp eq i32 %__thread1, %__thread2
>    %conv = zext i1 %cmp to i32
>    ret i32 %conv
> }
>
> That results multiple definitions of the same function and the linkage error.

on most platforms pthread functions will get some kind of weak linkage that
permits multiple definitions.  What platform are you on?  I suggest you create
a trivial program that uses pthreads, compile it and send the preprocessed
source to the mailing list (assuming that in the bitcode pthread equal turns
up like this: with a body but without a special linkage type).

Ciao, Duncan.



More information about the llvm-dev mailing list