<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Ok, after familiarizing myself with clone it appears to me this is a bug in compiler-rt.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">From the clone man page:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-indent:.5in">In Linux 2.4 and earlier, clone() does not take arguments ptid, tls, and ctid.
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">The source file passes those arguments without any fencing to check the Linux version. Also, ptid, tls, and ctid are only used in conjunction with certain flags (e.g., CLONE_PARENT_SETTID), but none of those flags are set.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It looks like the fix (for all Linux versions) would be to simply remove the last three arguments from the call.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Andy<o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
<b>On Behalf Of </b>Andy Jost<br>
<b>Sent:</b> Tuesday, July 09, 2013 2:44 PM<br>
<b>To:</b> LLVMdev@cs.uiuc.edu<br>
<b>Subject:</b> [LLVMdev] Error building compiler-rt<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I get the following error while building compiler-rt:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">/slowfs/msret_s1_us03/ajost/src/llvm-3.3.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc:315:22: error: no matching function for call to 'clone'<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"> pid_t tracer_pid = clone(TracerThread, tracer_stack.Bottom(),<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"> ^~~~~<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">/usr/include/bits/sched.h:71:12: note: candidate function not viable: requires 4 arguments, but 7 were provided<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">extern int clone (int (*__fn) (void *__arg), void *__child_stack,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Inside sched.h, clone is indeed declared with four arguments, but, interestingly, the man page for clone provides this prototype:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> #include <sched.h><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> int clone(int (*fn)(void *), void *child_stack,<o:p></o:p></p>
<p class="MsoNormal"> int flags, void *arg, ...<o:p></o:p></p>
<p class="MsoNormal"> /* pid_t *pid, struct user_desc *tls, pid_t *ctid */ );<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m running RedHat EL 2.6.9-89.ELlargesmp without root privileges.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is this a bug in LLVM? Do I just have an old version of clone that’s not supported by LLVM? I can try just removing the last three arguments from the compiler-rt source, but is that the best solution? If someone can point out a clean
way to fix this, then I don’t mind trying to contribute a patch (I would need to learn how).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Also, is this something that autoconf should have detected? What should it have done about it?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Andy <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>