[LLVMdev] "-relocation-model=static" does not work in llc compiler ?

lipengcheng pli at cs.rochester.edu
Wed Nov 6 10:16:21 PST 2013


Hi LLVM,

When I compile code using llc with options " -relocation-model=static", the generated code still has 
relative addressing using *rip* frame pointer. May I know how to get rid of frame pointer and totally 
using absolute addressing ? 

E.g. 
    callq   *addr(%rip).  
Here *addr* is a global variable, and I want the global address shows up here, 
instead of relative addressing. 
In this sense, can we say " -relocation-model=static" doesn't work ? 

One more thing, 
When I compile with O0, O1, the generated code is absolute addressing. like, callq   *addr.
but when compiling with O2, O3, the generated code is relative addressing, callq   *addr(%rip).  

How could I make it always absolute addressing ? 

Thanks, 

- Pengcheng





More information about the llvm-dev mailing list