[LLVMdev] Transition C->bitcode->assembly->object looses frame pointers

Alexander Potapenko ramosian.glider at gmail.com
Tue Apr 5 05:23:19 PDT 2011


Hi everyone,

We're doing some compile-time instrumentation according to the following scheme:

  llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll
  opt  -O2 -load Instr.so $INSTR_FLAGS $name.ll -S -o $name-inst.ll
  llc  $name-inst.ll -o $name.S
  g++ -c $name.S

However it turns out that the code instrumented this way is missing
frame pointers (e.g. backtrace() and/or libunwind cannot unwind the
stack when necessary).
Moreover, removing the instrumentation doesn't help: a simple
transition to and from bitcode doesn't help:

  llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll
  llc  $name.ll -o $name.S
  g++ -c $name.S

We also tried to use Clang and to add -fno-omit-frame-pointers and
--disable-fp-elim -- do not work either.

On the other hand, compiling the code in a single pass of
gcc/llvm-gcc/clang does preserve the frame pointers.

Does anyone happen to know where the problem might be? Are there any
other flags we're missing?

Thanks,
Alexander Potapenko



More information about the llvm-dev mailing list