<div>My take on it would be to have LinkerOptions and TargetInfo as seperate, because they mean totally different things.<br></div><div><br></div><div>Right now, targetOptions are used to only construct the type of object to create (little endian/big endian{32,64}) but I see lot more changes coming in that direction(like TargetHandler).</div>
<div><br></div><div>Different targets could consume LinkerOptions and say yes/no, to see the target sees them as valid options (or) not. </div><div><br></div><div>Thanks</div><div><br></div><div>Shankar Easwaran</div><br>
<div class="gmail_quote">On Wed, Jan 23, 2013 at 6:57 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Michael,<br>
<br>
I'm looking at flushing out the mach-o driver and targetinfo.<br>
<br>
Can we rename the "ld64" flavor to "darwin". The command line tool on MacOSX is called "ld" - just like on unix. The name ld64 is the current source repository name for the linker. Once lld takes over, the term ld64 won't mean anything.<br>
<br>
I've worked through adding DarwinOpts.td new DarwinDriver class, but have some questions about wiring it up. Currently the instantiated Driver transforms the command line arguments in to "core" arguments which is passed to generatedOptions() to construct a LinkerOptions object.<br>
<br>
Is the plan for LinkerOptions to contain the superset of all flavor's options? That seems like it won't scale well. In particular if you are using lld as a library and you want to programmatically create a LinkerOptions, it is unclear which options need to be set for a particular flavor.<br>
<br>
It seems like the concrete subclass of TargetInfo will ultimately hold the flavor specific options. So can DarwinDriver get a copy of the MachOTargetInfo object and set its ivars based on the command line options? Previously, I thought of LinkerOptions as the options needed by the core-linking phase (resolver), and the WriterOptions were flavor specific.<br>
<br>
<br>
Here is how I see it currently works:<br>
<br>
1) The flavor determines the driver class instantiated.<br>
2) The driver transforms flavor specific options into a "core" ArgList;<br>
3) LinkerOptions constructor requires a core ArgList and sets ivars base on the ArgList.<br>
4) The LinkerInvocation object is constructed from LinkerOptions object.<br>
5) The LinkerInvocation object instantiates a Target object from the LinkerOptions which also creates a TargetInfo object and passes ownership to of the TargetInfo to the Target object. This last step seems convoluted. Couldn't the Target constructor create the TargetInfo ivar?<br>
6) Problem: there is no way to connect flavor specific options to the BlahTargetInfo object.<br>
<br>
<br>
<br>
It seems like there are too many classes involved. I think would be simpler to have:<br>
1) The flavor determines the Driver class instantiated.<br>
2) The driver creates a TargetInfo subclass object. The base class TargetInfo contains all the fields that used to be in LinkerOptions.<br>
3) The driver looks at each command line option and either uses it to set something in the TargetInfo object or passes it to the super class to handle TargetInfo base class options.<br>
4) The LinkerInvocation object is constructed using the TargetInfo object.<br>
<br>
In summary, my proposed model merges the Target class and LinkerOptions class into the TargetInfo class. The LinkerInvocation class runs a link based on a TargetInfo object. The TargetInfo object is programmatically configured. In the command line case, it is created by a Driver instance and configured based on command line options.<br>
<br>
If we really need all the classes, can you explain the purpose of each (in doxygen comments). Thanks.<br>
<br>
-Nick<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
</div><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>