<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Here is the command lines that I use to compile and link the files:</div>
<div><br>
</div>
<div>clang -O2 -emit-llvm -c *.c -o *.bc;</div>
<div><br>
</div>
<div>llvm-link *.bc -o BARNES.bc</div>
<div><br>
</div>
<div>Then I get this error:</div>
<div><br>
</div>
<div>llvm-link: link error in 'code_io.o': Linking globals named 'pthread_equal': symbol multiply defined!</div>
<div><br>
</div>
<div><br>
</div>
<div>After using llvm-dis to get the llvm assembly code, I found that in every .bc, pthread_equal is defined:</div>
<div><br>
</div>
<div>
<div>define i32 @pthread_equal(i32 %__thread1, i32 %__thread2) nounwind readnone inlinehint {</div>
<div>entry:</div>
<div>  %cmp = icmp eq i32 %__thread1, %__thread2</div>
<div>  %conv = zext i1 %cmp to i32</div>
<div>  ret i32 %conv</div>
<div>}</div>
</div>
<div><br>
</div>
<div>That results multiple definitions of the same function and the linkage error.</div>
<div><br>
</div>
<div>NOTE: The above compile and link method works for single C file program.</div>
<div><br>
So what do I miss that can avoid this issue?</div>
<div><br>
</div>
<div>Thank you very much!</div>
<div><br>
</div>
<div><br>
</div>
<div>Yuelu</div>
</div>
</body>
</html>