Hiya,
I've got a module I'm building that is half C and half Swift, I'm trying to link it into a program with all swift compiled in embedded mode. I used to do import AVR
(the module is called AVR
rather confusingly) in my programs and the object file would contain a swift1_autolink_entries
that listed linker commands for the static libraries I needed, like -lAVR
. So I could adapt my tooling to read this and add it to the link.
(side note: Given I'm using llvm, it should have been possible via llvm metadata, but that might be a limitation of linking ELF rather than macho.)
But either way, the issue is since I turned on embedded mode on the compiler, this section doesn't seem to be emitted any more. And I've no way of automatically getting the static libraries required to put into the link now.
Looking at the code in IRGenModule.cpp
it looks like perhaps this might be the trouble...
void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
// The debugger gets the autolink information directly from
// the LinkLibraries of the module, so there's no reason to
// emit it into the IR of debugger expressions.
if (Context.LangOpts.DebuggerSupport)
return;
if (Context.LangOpts.hasFeature(Feature::Embedded))
return;
...
...as I read this, in embedded mode, auto linking is automatically disabled. Is there a reason this has to be the case? Is there perhaps another mechanism I should be using?
Regards,
Carl