Add a -disable-cfi option to llvm-mc. This is useful for debugging as
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 23 Nov 2012 17:37:34 +0000 (17:37 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 23 Nov 2012 17:37:34 +0000 (17:37 +0000)
it will expand any .cfi_* directives in the input assembly.

Unfortunately this cannot replace elf-dump in tests as the asm streamer
cannot relax the line advance opcodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168522 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-mc/llvm-mc.cpp

index f7c3748f079bc0f3bf07d6aaeb44c463e1eb75bd..8329a41f2527c195c578bfacf7fd857744ebbe97 100644 (file)
@@ -68,6 +68,9 @@ OutputAsmVariant("output-asm-variant",
 static cl::opt<bool>
 RelaxAll("mc-relax-all", cl::desc("Relax all fixups"));
 
+static cl::opt<bool>
+DisableCFI("disable-cfi", cl::desc("Do not use .cfi_* directives"));
+
 static cl::opt<bool>
 NoExecStack("mc-no-exec-stack", cl::desc("File doesn't need an exec stack"));
 
@@ -415,9 +418,10 @@ int main(int argc, char **argv) {
       CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
       MAB = TheTarget->createMCAsmBackend(TripleName, MCPU);
     }
+    bool UseCFI = !DisableCFI;
     Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true,
                                            /*useLoc*/ true,
-                                           /*useCFI*/ true,
+                                           UseCFI,
                                            /*useDwarfDirectory*/ true,
                                            IP, CE, MAB, ShowInst));