[PATCH] D63852: [Clang] Move assembler into a separate file

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 07:58:46 PDT 2020


aykevl added a comment.

(sorry, I missed your comment)

I basically want to run `clang` by linking to it and calling it directly, without invoking any external commands.
You can see here how I did it:
https://github.com/tinygo-org/tinygo/blob/master/builder/clang.cpp
I copied the cc1as code in the project and modified it a little bit to be callable, essentially what this patch does:
https://github.com/tinygo-org/tinygo/blob/master/builder/cc1as.cpp

Ideally there would be something like the `tinygo_clang_driver` in Clang. Maybe there is, the last time I looked I couldn't find it.
What is most important is that it will not try to call `clang` externally, because that will make distribution much harder.

As a sidenote: I have needed to work around some global state in Clang/LLVM by creating a new process (essentially calling `argv[0]`) and doing the C file compilation in there. As one compiler invocation of TinyGo may need to compile several C files, global state led to problems. This is different from calling `clang` as I'm still shipping a single statically linked binary instead of several binaries.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63852/new/

https://reviews.llvm.org/D63852





More information about the llvm-commits mailing list