[lld] r336794 - [ELF] - Report proper error message about mixing bitcode files.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 05:32:00 PDT 2018


Author: grimar
Date: Wed Jul 11 05:32:00 2018
New Revision: 336794

URL: http://llvm.org/viewvc/llvm-project?rev=336794&view=rev
Log:
[ELF] - Report proper error message about mixing bitcode files.

If we have 2 bitcode inputs for different targets, LLD would
print "<internal>" instead of the name of one of the files.

The patch adds a test and fixes this issue.

Added:
    lld/trunk/test/ELF/lto/Inputs/i386-empty.ll
    lld/trunk/test/ELF/lto/mix-platforms2.ll
Modified:
    lld/trunk/ELF/SymbolTable.cpp

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=336794&r1=336793&r2=336794&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Jul 11 05:32:00 2018
@@ -38,7 +38,7 @@ static InputFile *getFirstElf() {
     return ObjectFiles[0];
   if (!SharedFiles.empty())
     return SharedFiles[0];
-  return nullptr;
+  return BitcodeFiles[0];
 }
 
 // All input object files must be for the same architecture

Added: lld/trunk/test/ELF/lto/Inputs/i386-empty.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/Inputs/i386-empty.ll?rev=336794&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/Inputs/i386-empty.ll (added)
+++ lld/trunk/test/ELF/lto/Inputs/i386-empty.ll Wed Jul 11 05:32:00 2018
@@ -0,0 +1,2 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "i686-linux-gnu"

Added: lld/trunk/test/ELF/lto/mix-platforms2.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/mix-platforms2.ll?rev=336794&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/mix-platforms2.ll (added)
+++ lld/trunk/test/ELF/lto/mix-platforms2.ll Wed Jul 11 05:32:00 2018
@@ -0,0 +1,9 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %tx64.o
+; RUN: llvm-as %S/Inputs/i386-empty.ll -o %ti386.o
+; RUN: not ld.lld %ti386.o %tx64.o -o %t.out 2>&1 | FileCheck %s
+
+; CHECK: {{.*}}x64.o is incompatible with {{.*}}i386.o
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"




More information about the llvm-commits mailing list