[llvm-commits] [lld] r156100 - in /lld/trunk: include/lld/Reader/ include/lld/Reader/Reader.h lib/CMakeLists.txt lib/Reader/ lib/Reader/CMakeLists.txt lib/Reader/COFFReader.cpp tools/lld-core/CMakeLists.txt tools/lld-core/lld-core.cpp

Nick Kledzik kledzik at apple.com
Thu May 3 14:27:57 PDT 2012


On May 3, 2012, at 1:52 PM, Michael J. Spencer wrote:
> --- lld/trunk/lib/Reader/COFFReader.cpp (added)

I would have imagined this file going in:
        lld/trunk/lib/Platforms/Windows/COFFReader.cpp

In my mind there are three (initial) platforms:  Darwin, Windows, Unix*.  So, we have:
  
        lld/trunk/lib/Platforms/Darwin/
        lld/trunk/lib/Platforms/Windows/
        lld/trunk/lib/Platforms/Unix/  

And code only needed by one platform goes under its Platform directory.

The interface that all Platforms must provide is defined by Platform.h.  So one way to manage this would be to add:
    bool isObjectFile(llvm::MemoryBuffer*);
    File * parseObjectFile(llvm::MemoryBuffer*);
to the Platform class, and wire up your COFF reader behind that in the Windows Platform.

My assumption is that even though the lld internal model is platform independent, no one is going to want to use other platform object files (e.g. win32 in mach-o).  There are just too many ABI and other conventions implicit in the file format.  

* By Unix I mean ELF based Linux, Solaris, etc. I also image that the Unix platform will be much more customizable to support all the *nix variants.

-Nick
  




More information about the llvm-commits mailing list