[PATCH] D18027: [lto] Initialize asmparsers.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 21:01:05 PST 2016


silvas created this revision.
silvas added reviewers: ruiu, rafael.
silvas added subscribers: llvm-commits, Bigcheese.
Herald added a subscriber: joker.eph.

They are needed for inline asm during LTO.

In particular we hit the report_fatal_error on
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:138

    LLVM ERROR: Inline asm not supported by this streamer because we don't have an asm parser for this target

http://reviews.llvm.org/D18027

Files:
  ELF/Driver.cpp
  test/ELF/lto/inline-asm.ll

Index: test/ELF/lto/inline-asm.ll
===================================================================
--- /dev/null
+++ test/ELF/lto/inline-asm.ll
@@ -0,0 +1,11 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo() {
+  call void asm "nop", ""()
+  ret void
+}
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -321,6 +321,7 @@
   InitializeAllTargets();
   InitializeAllTargetMCs();
   InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
 
   SymbolTable<ELFT> Symtab;
   std::unique_ptr<TargetInfo> TI(createTarget());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18027.50233.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160310/42dd3023/attachment.bin>


More information about the llvm-commits mailing list