I have an llvm module that I dumped as a bitcode file using llvm::WriteBitcodeToFile. I want to turn this file into a regular dynamically loaded library containing functions in the module.
How should I do it? I tried using llcfor this, but this creates code that apparently does not move, because after following the following steps:
llc -enable-pie -cppgen=functions -filetype=asm executableModule -o em.s
then by installing gnu asin the object file:
as -o mylib.o em.s
finally trying to create a shared library with:
gcc -shared -o libmyfile.so -fPIC mylib.o
error cannot be executed:
/usr/bin/ld: error: mylib.o: requires dynamic R_X86_64_PC32 reloc against 'X.foo' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status
source
share