<div dir="ltr"><div>Hi Nico,<br></div><div><br></div><div>That parenthesis might or might not work. I was going to submit a similar patch, but then I remembered that clang will call as with as-style parameters, not with clang parameters. At most, maybe -cc1as could work, but I don't think it's compatible either.</div><div><br></div><div>An as-compatible driver would be one solution for not patching afl, like Rafael said.</div><div class="gmail_extra">I haven't had the time to tinker with those things, though. I have a bunch of llvm-dis fixes to do, derived from afl.</div><div class="gmail_extra"><br></div><div class="gmail_extra">(sorry for the off-topic. Ending it)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Regards,</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">  Filipe<br></div></div>
<br><div class="gmail_quote">On Thu, Jan 22, 2015 at 9:38 AM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Thu, Jan 22, 2015 at 9:00 AM, Filipe Cabecinhas <span dir="ltr"><<a href="mailto:filcab@gmail.com" target="_blank">filcab@gmail.com</a>></span> wrote:<br><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">Hi all,<div><br></div><div>For using cctools: use as -q, which uses the clang assembler.<br><div><br></div><div>For afl-fuzz it's simple. You have two options:</div><div>Use Xcode's clang, which is the same used for as -q, which afl uses (AFL_CLANG=`xcrun -p clang` (AFL_CXX too)).</div></div></blockquote><div><br></div></span><div>Xcode's clang doesn't support -fsanitize=adress from what I can tell.</div><span class=""><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><div>Or</div>Change afl-as.c, look for -q (lower case. Should be conditioned on DARWIN), change to -c. Export AFL_AS=clang (path to your top of tree clang that is emitting the asm that as doesn't understand).</div></blockquote><div><br></div></span><div>This works.</div><div><br></div><div>Aha, looking through cctools/as/driver.c, -q just causes `clang -x assembler ... -integrated-as -c` to be called, and I suppose my Xcode 6.1 clang doesn't understand the .macosx_version_min (that was added last April!) yet. I agree that this patch is unnecessary, then.</div><div><br></div><div>Thanks!</div><div><br></div><div>(Maybe afl-as could call `AFL_CC ? AFL_CC : AFL_CXX ? AFL_CXX : clang` with -x assembler -integrated-as -c instead of as -q ifdef __APPLE__ to increase afl's it's-just-worksiness, but that's off-topic for this issue :-) ).</div><span class=""><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><br></div><div>Regards,</div><div><br></div><div>  Filipe<div><div><br><div><br>On Thursday, January 22, 2015, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<br><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 22, 2015 at 6:05 AM, Rafael Espíndola <span dir="ltr"><<a>rafael.espindola@gmail.com</a>></span> wrote:<br><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"><span>On 22 January 2015 at 00:36, Nico Weber <<a>thakis@chromium.org</a>> wrote:<br>
> I'm trying to use afl-fuzz with asan on OS X. afl-fuzz tells you to set CXX to afl-clang++ and rebuild your program. afl-clang++ then calls clang++ with -no-integrated-as and -B to a path with its own as wrapper that inserts some instrumentation assembly before calling real as. This doesn't work on OS X because clang++ writes this .macosx_version_min directive that as doesn't support. If I apply this patch, everything does work. So this seems like a useful thing to me – are there any downsides to this patch?<br>
<br>
</span>Yes, it puts us in a direction we really don't want to go.<br>
<br>
On OS X /usr/bin/as is really old and not supported. If afl is using<br>
it instead clang that is a bug in afl.<br></blockquote><div><br></div><div>afl is using -no-integrated-as to munge the asm output. It doesn't care which as gets run.</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">The correct way of making this easier would probably be to write a<br>
program that is command line compatible with /usr/bin/as but uses MC.<br></blockquote><div><br></div><div>That sounds great, but until that exists this patch seems to increase clang's it's-just-works-iness  by at least 8.3% for a very minor code change. Once llvm-gas (or however it should be called) exists, it's no longer necessary.</div></div></div></div>
</blockquote></div></div></div></div><span><font color="#888888"><br><br>-- <br>  F<br><br>
</font></span></blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>