<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Random question. Have you (or anyone) built compiler-rt for i686 and i386 and compared the outputs? Do we actually generate anything different between the two?<div class=""><br class=""></div><div class="">If not it seems to me we should teach clang to fall back to i386 if there isn’t a library that corresponds to the explicitly specified triple.</div><div class=""><br class=""></div><div class="">WRT compiler-rt’s build system code you pointed out, Petr Hosek has graciously picked up some of the work I started on cleaning up cross-compiling and multi-arch targeting for compiler-rt. I would strongly suggest you check out his patches. I’ll list the two most interesting ones below.</div><div class=""><br class=""></div><div class=""><a href="https://reviews.llvm.org/D26653" class="">https://reviews.llvm.org/D26653</a></div><div class=""><a href="https://reviews.llvm.org/D26652" class="">https://reviews.llvm.org/D26652</a><br class=""><div class=""><br class=""></div><div class="">As people start exercising his patches we will likely start hitting issues in both compiler-rt’s build system and the clang driver because they both have an excess of strange magic. I’d really like to see us converge the two of them into a single convention so that we can get rid of as much of the magic as possible.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 14, 2016, at 6:10 AM, Michał Górny via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello,<br class=""><br class="">One of our users recently (well, it is not that recent anymore)<br class="">reported that our clang install is unable to find compiler-rt libraries<br class="">on 32-bit x86. As I suspected, the problem is that our default CHOST is<br class="">i686-pc-linux-gnu, while the compiler-rt libraries are built with i386<br class="">suffix.<br class=""><br class="">I can easily reproduce this on multilib x86_64 system as well, using<br class="">the -target option:<br class=""><br class="">  clang -v -m32 hello.c              # works, uses i386<br class="">  clang -v -target i386-pc-linux-gnu # works<br class="">  clang -v -target i686-pc-linux-gnu # fails, looks for i686<br class="">  clang -v -target i586-pc-linux-gnu # fails, looks for i586<br class=""><br class="">I think the relevant function is ToolChain::getCompilerRT() from<br class="">lib/Driver/ToolChain.cpp. It seems to use arch name straight from<br class="">the triple, with some special cases.<br class=""><br class="">On the other hand, compiler-rt seems to allow only a few very specific<br class="">names:<br class=""><br class="">  set(X86 i386 i686)<br class="">  set(X86_64 x86_64)<br class=""><br class="">while I don't know the rationale for allowing both i386 and i686, this<br class="">is certainly much narrower than what clang looks for.<br class=""><br class="">Do you have any suggestions how we could improve this? I was thinking<br class="">of making the clang driver use Triple::getArchTypeName() rather than<br class="">the raw arch string but I don't know if I wouldn't break somebody's use<br class="">case.<br class=""><br class="">Alternatively, I could add compiler-rt symlinks for i486..i686 but that<br class="">seems like a very non-pretty solution. And clang seems to accept<br class="">triples up to i986.<br class=""><br class="">Thanks in advance.<br class=""><br class="">[1]:<a href="https://bugs.gentoo.org/show_bug.cgi?id=592964" class="">https://bugs.gentoo.org/show_bug.cgi?id=592964</a><br class=""><br class="">-- <br class="">Best regards,<br class="">Michał Górny<br class=""><<a href="http://dev.gentoo.org/~mgorny/" class="">http://dev.gentoo.org/~mgorny/</a>><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>