<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks for the reply.<div><br></div><div>I can't get clang to accept the architecture - it runs gcc instead. Maybe I'm doing something wrong when I modified LLVM to accept my architecture. I did the following:</div><div><br></div><div><ul class="MailOutline"><li>Modified 'configure' to specify my architecture's name in TARGETS_TO_BUILD.</li><li>When running configure, the --enable-targets=MY_ARCH option is given.</li><li>Added my architecture to the Triple::ArchType enumeration (in include/llvm/ADT/Triple.h).</li><li>Added suitable code to the switch statements that use Triple::ArchType (in lib/support/Tripple.cpp).</li></ul></div><div><br></div><div>'llc' accepts my target. I'm building clang inside 'tools/clang' of the LLVM working copy, in accordance to the documentation. I see clang getting rebuilt every time I modify my target's source files.</div><div><br></div><div>I should've mentioned that I'm working from the 2.6 release.</div><div><br></div><div><br></div><div>Also, once I've got that working, is there a way to make clang use these options by default? What's the difference between 'clang' and a custom driver built using 'llvmc'?</div><div><br></div><div>Regards,</div><div><br></div><div>- Mark</div><div><br></div><div><br><div><div>On 16 Dec 2009, at 11:49, Jean-Daniel Dupas wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>Le 16 déc. 2009 à 10:54, Mark Muir a écrit :<br><br><blockquote type="cite">Hi all,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm developing a custom back-end for an odd-ball architecture (but one that is still describable by LLVMTargetMachine). The toolchain that it will fit into doesn't have a linker as such, so I want to use assembly as the default output. I've got to the point of emitting working custom assembly for very simple C programs (i.e. ones that don't rely on libraries). At the moment, I'm doing this through clang-cc and llc:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">    </span>clang-cc -D=MY_ARCH -emit-llvm-bc -o -  in.c \<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">    </span>| llc -filetype=asm -march=my_arch<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I want to be able to package this compiler as a cross-compiler - a single binary to go from C to assembly for that target. It should define a macro (as shown above) to allow the target to be identified by source code. I was thinking of doing this using llvmc to capture the above command-line. Is that the recommended approach?<br></blockquote><br>clang-cc does not longer exist, so you should not rely on it and use clang instead.<br><br>You should be able to use it exactly the same way that you was using gcc (it is designed to be a drop in replacement), so "clang -arch my_arch -DMY_ARCH -S -o - in.c" should works.<br><br><br>-- Jean-Daniel<br></div></blockquote></div><br></div></body></html>