[PATCH] D25927: [cfi] Implement cfi-icall using inline assembly.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 16:40:01 PDT 2016

eugenis added inline comments.

Comment at: lib/Transforms/IPO/LowerTypeTests.cpp:669
+  if (!Dest->hasLocalLinkage())
+    OS << ".globl " << Dest->getName() << "\n";
+  OS << ".type " << Dest->getName() << ", function\n";
eugenis wrote:
> pcc wrote:
> > I wonder whether we want to escape these names? This appears to be the escaping we'd need to use:
> > http://llvm-cs.pcc.me.uk/lib/MC/MCSymbol.cpp#53
> > 
> > Maybe it's not necessary though since we pretty much expect all names we see to satisfy `MCAsmInfo::isValidUnquotedName`.
> Looks like we should escape the names.
> It's easy to call a function "\n" with __asm__ in the declaration, and that breaks the jumptable code.
It appears that neither llvm-mc nor gnu as support quoted identifier properly.
Gnu as allows  a quoted string in, for example, .globl directive. Llvm-mc does too, but it forgets to unescape it, so, say, "\n" turns into a 2-character string when saves as textual asm and read back.

Neither support quoted strings in expressions we need to declare aliases, like
  "\n" = .jumptable + 4.

I think I'll just make it a fatal error to apply cfi-icall to any name that requires escaping.



More information about the llvm-commits mailing list