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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to