<div dir="ltr"><div><div><div><div>Hi Renato,<br><br></div>Thank you very much for your help!<br><br></div>If I understood correctly, the first thing to implement is a tool that gathers information about the target, like (you mentioned):<br></div>- cpu, OS, etc. <br></div><div>The information gathered at this step will be used to generate the JSON file / local database. Did I understood correctly?<br><br></div><div>On the step when target != host, I need to think and research more, because I do not have a clear image.<br><br></div><div>Thank you!<br></div></div><br><div class="gmail_quote"><div dir="ltr">În Mar, 13 oct. 2015 la 13:06, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> a scris:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12 October 2015 at 01:35, Cornel Punga via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> I want to work on Configuration Manager open project.<br>
<br>
Hi Cornel,<br>
<br>
I wrote that spec, so I'll try to give you an overview of what I<br>
meant. That doesn't mean you have to do exactly that, just to guide<br>
you on your implementation.<br>
<br>
<br>
> In the description of the project (here) the first step would be to build a<br>
> CFLAGS file. I think it is something similar to the Makefile in the root<br>
> directory of the Clang, is that right?<br>
<br>
No. The idea was to do something similar to "llvm-config", but the<br>
other way around.<br>
<br>
The llvm-config tool, like similar ones, gives you a way to collect<br>
the flags needed to compile an LLVM based project. What this first<br>
step would be is to do the same for the hardware.<br>
<br>
GCC's structure is largely based on configure-time hard-coded values.<br>
So, from the same source, you can build a cross-compiler from<br>
virtually any host to any target, and the defaults and options will be<br>
restricted to the target arch. LLVM doesn't work like that.<br>
<br>
When you build LLVM, you build everything. You can cross-compile from<br>
one host to any target (if you compile all back-ends) on the same<br>
binary. Because of that, some options get slightly different<br>
behaviour, or they're only valid for one or another back-end, or they<br>
need another options to be set and correct, otherwise things blow up<br>
badly.<br>
<br>
So, there are two side of stage 1:<br>
<br>
1. Identify the host architecture (system introspection), and present<br>
the best combination of flags (mcpu, mfpu, march, etc) to produce the<br>
fastest code on the *host*. This will detect the CPU, SIMD,<br>
co-processors, variations and choose the right options.<br>
<br>
2. Identify the target, when host != target. This is more complicated,<br>
since however you detect it will depend on the target. If the target<br>
has an OS, you can telnet/ssh into it and query the system, but some<br>
OSs will need a server running on the target (Windows?). If the target<br>
is bare-metal, you'll need some JTAG equivalent, and thus interface<br>
with drivers on the host system.<br>
<br>
This second part would be more of a large collection of tools, rather<br>
than one single script.<br>
<br>
The second stage is to put these scripts into a local database (a JSON<br>
file would be enough), so that you could choose via Clang<br>
-mconfig=target-name and it'd automatically detect and pull the config<br>
from inside Clang. The scripts would still be used to create the<br>
database, though.<br>
<br>
<br>
> And the last, for now, would Python be a suitable choice for this project or<br>
> better write it in C++?<br>
<br>
Python would be perfect.<br>
<br>
cheers,<br>
--renato<br>
</blockquote></div>