[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

Michael Spencer bigcheesegs at gmail.com
Fri May 4 13:32:37 PDT 2012


On Thu, May 3, 2012 at 2:27 PM, Nick Kledzik <kledzik at apple.com> wrote:
>
> 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
>
>

I believe there are platforms that are sufficiently different to need
a different Platform class, but still use ELF. For example, Haiku and
PlayStation 3. PE/COFF is also used in EFI, which is very very
different from Windows.

The reader library will only be used by specific platforms.

- Michael Spencer




More information about the llvm-commits mailing list