Simple Object and DLL Loader
This project demonstrates applying a PIC loader to a COFF or DLL capability.
Project Files
Notes
This project demonstrates how to support COFF and DLL loading within one set of .spec files and codebase.
loader.spec is a fairly standard specification file, but it has one difference. It calls run link.spec to delegate the capability linking logic to this other file. We could have kept all of our commands in one file, but we would have had to reproduce the common PIC boilerplate across four capability/arch targets rather than two arch targets.
The Makefile builds our loader program. Our program includes no go function. Instead, we have go_object and go_dll as potential entry points. The link.spec specification file will remap one of these symbols to go depending on whether the capability is a COFF or DLL. We use make pic +optimize to get rid of any unused functions (including the unused entry point).
link.spec has targets for x86.o, x64.o, x86.dll, and x64.dll. These are capability specific targets (e.g., x86.o for a COFF, x86.dll for a DLL). Crystal Palace will use one of these capability-specific targets when they're available. When they're not, it'll use x86 or x64.
License
This project is licensed under the BSD License.