<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 5 Jul 2017 7:34 pm, "Weiming Zhao via Phabricator via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">weimingz added a comment.<br>
<div class="quoted-text"><br>
In <a href="https://reviews.llvm.org/D34918#799141" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D34918#799141</a>, @EricWF wrote:<br>
<br>
> > On architectures without atomic instructions, the atomic built-ins cannot be lowered. If _LIBCPP_HAS_NO_THREADS is enabled, we should just use regular code.<br>
><br>
</div><div class="quoted-text">> Does "cannot be lowered" mean using them causes a compile error? If so I'm curious as to why you're the first one to run into this issue. If no compile error is caused then could you re-explain the rational for this change.<br>
><br>
> In <a href="https://reviews.llvm.org/D34918#798422" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D34918#798422</a>, @weimingz wrote:<br>
><br>
> > In <a href="https://reviews.llvm.org/D34918#797661" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D34918#797661</a>, @joerg wrote:<br>
> ><br>
> > > Lock-free atomic operations are also signal safe. Your code is not. While I don't know whether all this functions are not required to be signal safe, the general assertion is certainly questionable.<br>
> ><br>
> ><br>
> > No, they are no signal safe.  Per [1], "call to any library function, except the following signal-safe functions (note, in particular, dynamic allocation is not signal-safe):".<br>
> ><br>
> > Locale.cpp should be fine with the change.<br>
> >  {set,get}_new_handler, {set,get}_unexpected_handler are not in the list.<br>
> >  I'm not very sure about "__libcpp_refstring". Seems it is only used by stdexcept. Although throw expression is explicitly stated as not signal safe, the ref counting of stdexcept might be. We can leave it unchanged.<br>
><br>
><br>
> It would be really nice if we didn't cause the user unnecessary pain. Just because these functions aren't *required* to be signal safe doesn't necessarily mean they shouldn't be.<br>
><br>
> If this patch is indeed needed I would like to see it done similar to how `__libcpp_refcount_foo` <<a href="https://github.com/llvm-mirror/libcxx/blob/master/include/memory#L3370" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/libcxx/blob/master/<wbr>include/memory#L3370</a>> or the `src/include/atomic_support.h` <<a href="https://github.com/llvm-mirror/libcxx/blob/master/src/include/atomic_support.h" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/libcxx/blob/master/src/<wbr>include/atomic_support.h</a>> logic is implemented, where instead of having `#ifdef` branches at each call site the logic has been abstracted away into a function.<br>
><br>
> That being said I would like to better understand the rational for this patch before proceeding.<br>
<br>
<br>
</div>When the builtin cannot be lowered, compiler just emits function call, which eventually becomes a linker error as no libs implement those functions (libgcc. libclang-rt, libc)<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto"><div dir="auto" style="font-family:sans-serif">I thought this is where compiler-rt comes in? You should be able to build that for cortex-m0.</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">I haven't seen this on bare-metal though, I think it works for Linux platforms. Not 100% sure. Adding Renato for comments.</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">Cheers,</div><div dir="auto" style="font-family:sans-serif"><br></div><div dir="auto" style="font-family:sans-serif">/ Asiri</div></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="quoted-text"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D34918" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D34918</a><br>
<br>
<br>
<br>
</div><div class="elided-text">______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></blockquote></div><br></div></div></div>