Some places in this header were following the LLVM convention of:
namespace ... {
struct Foo {
};
}
and one-two places had extra indentation. I standardized the code on the LLVM
convention.
- Rename swift::addNewDSOImage() to swift_addNewDSOImage() and
export using SWIFT_RUNTIME_EXPORT.
- Move ELF specific parts of ImageInspection.h into
ImageInspectionELF.h.
- For ELF targets, keep track of shared objects as they are
dynamically loaded so that section data can be added to
the protocol conformance and type metadata caches after
initialisation (rdar://problem/19045112).
- Win32 does not support dlfcn.h, Dl_info or dladdr() so add
lookupSymbol() as a wrapper for ELF/MachO/Win32
- Win32 version needs an implementation, currently it just returns
an error for `cannot lookup address'
The code we use to interface with the platform dynamic linker is turning into a rat's nest of conditionals that's hard to maintain and extend. Since ELF, Mach-O, and PE platforms have pretty fundamentally different dynamic linker interfaces and capabilities, it makes sense to factor that code into a separate file per-platform, instead of trying to conditionalize the logic in-line. This patch factors out a much simpler portable interface for lazily kicking off the protocol conformance and type metadata lookup caches, and factors the guts out into separate MachO, ELF, and Win32 backends. This should also be a much cleaner interface to interface static binary behavior into, assisting #5349.