<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 14, 2013, at 8:46 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">On Thu, Mar 14, 2013 at 6:27 PM, John McCall<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;"><div style="word-wrap: break-word;"><div>On Mar 14, 2013, at 5:59 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>> wrote:</div><blockquote type="cite"><div>On Thu, Mar 14, 2013 at 10:00 AM, John McCall<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br></blockquote></div></blockquote></div></blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"><div><blockquote type="cite"><div class="gmail_quote">Our conclusion was: if you want to use a function from inline asm, you should use an asm label on that function, otherwise it might get mangled unexpectedly. This is true independent of the static/extern "C" issue, due to some platforms prepending an underscore to symbol names, etc.</div></blockquote><div><br></div></div>Conveniently enough, inline assembly usually can't be shared between platforms that do Pascal mangling and those that don't, because significantly different platforms usually have significantly different compilers and with significantly different inline assembly syntax.</div></blockquote><div><br></div><div>Inconveniently, we have to cope with exactly that when we call into the problematic symbols in llvm/lib/Target/X86/X86JITInfo.cpp (this is what the message I quoted above was referring to). Search for calls to LLVMX86CompilationCallback2, and note the ASMPREFIX hack.</div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"> What you're doing is making it more awkward to port inline assembly between compilers on the *same* platform by introducing a totally spurious hurdle, based on a line from the standard that's inconsistent with an overwhelmingly dominant existing practice.</div></blockquote><div><br></div><div>I don't agree that g++ counts as "overwhelmingly dominant existing practice", especially given that EDG does not follow g++ here in its g++-compatible mode. This would not be the first g++ bug which people have come to rely on, which we could support at the expense of being subtly non-conforming, but choose not to. Plus, there is a simple, trivial fix to the offending code which allows it to be accepted by us, g++, and EDG.</div></div></div></blockquote><div><br></div><div>The existing practice is g++, MSVC (did anyone confirm this?), and all released Clang versions. EDG is the outlier here, and (of the compilers we're talking about), the one with the smallest install base, so I think it's fairly safe to say that existing practice is to not mangle these names.</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class="gmail_quote"><div>I think the right question is, is this a battle worth fighting? Is one inconvenienced user enough that we should give up any hope of ever conforming in this area?</div></div></div></blockquote><div><br></div>This first question goes both ways. Do Clang's users benefit from a change in this area? It seems that users porting from g++ or MSVC, or upgrading their Clang do not benefit (at least not immediately) because they will need to change their code, and that change won't necessarily make their code that much more portable.</div><div><br></div><div>We have a conflict between existing practice and the C++ standard, and I don't think we have a strong case for changing Clang's behavior in the name of conformance. I think the C++ committee needs to decide whether to adapt the standard to cover existing practice or to reaffirm that this aspect of the language-linkage model is intended despite conflicting with existing practice.</div><div><br><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div><br><div><br></div></body></html>