[LLVMdev] Error building compiler-rt

Andy Jost Andrew.Jost at synopsys.com
Tue Jul 9 15:00:08 PDT 2013

Ok, after familiarizing myself with clone it appears to me this is a bug in compiler-rt.

>From the clone man page:

In Linux 2.4 and earlier, clone() does not take arguments ptid, tls, and ctid.

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.

It looks like the fix (for all Linux versions) would be to simply remove the last three arguments from the call.


From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Andy Jost
Sent: Tuesday, July 09, 2013 2:44 PM
To: LLVMdev at cs.uiuc.edu
Subject: [LLVMdev] Error building compiler-rt


I get the following error while building compiler-rt:

/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'
  pid_t tracer_pid = clone(TracerThread, tracer_stack.Bottom(),
/usr/include/bits/sched.h:71:12: note: candidate function not viable: requires 4 arguments, but 7 were provided
extern int clone (int (*__fn) (void *__arg), void *__child_stack,

Inside sched.h, clone is indeed declared with four arguments, but, interestingly, the man page for clone provides this prototype:

       #include <sched.h>

       int clone(int (*fn)(void *), void *child_stack,
                 int flags, void *arg, ...
                 /* pid_t *pid, struct user_desc *tls, pid_t *ctid */ );

I'm running RedHat EL 2.6.9-89.ELlargesmp without root privileges.

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).

Also, is this something that autoconf should have detected?  What should it have done about it?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130709/78b1b383/attachment.html>

More information about the llvm-dev mailing list