Position Dependent Loading in LLVM Modules

Hello All,
Does LLVM even support position dependent loading in bitcode files?
For example, how would I go about loading a module at a specific
address without a custom linker?


Hi Am,

I think you're conflating two issues here - LLVM bitcode is not loadable or
runnable, at all.

It needs to be generated into native code before it can be run or loaded -
of course if you use the -fPIC option the resulting output object will be
relocatable - you would then use your native linker (GNU LD or Gold) in the
same way as normal.

You can't load bitcode files by themselves.



Thanks James,

Let me rephrase my question:
How do I insert metadata into llvm modules (bit code files)?

- Am


Isn't that an entirely different question?

The easiest way is probably to do it textually - echo '!x = ...' >m; llvm-dis x.bc -o - | cat m - | llvm-as -o y.bc