write shared object file in memory


I’d like to take a llvm::Module and emit it as a shared object file in memory. I’ve been browsing the tools/ source for clues but it’s not clear to me how I get the behavior of the –relocation-model=pic.

I see that the function TargetMachine::addPassesToEmitFile can be used to write an object file. What can I do to emit a shared object?