[lld] 20bdd3e - [ELF][test] Improve LTO duplicate symbol test

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 17:54:43 PST 2022


Author: Fangrui Song
Date: 2022-02-15T17:54:38-08:00
New Revision: 20bdd3e2326339d6c2de5af9d3c9e6f56abdd51c

URL: https://github.com/llvm/llvm-project/commit/20bdd3e2326339d6c2de5af9d3c9e6f56abdd51c
DIFF: https://github.com/llvm/llvm-project/commit/20bdd3e2326339d6c2de5af9d3c9e6f56abdd51c.diff

LOG: [ELF][test] Improve LTO duplicate symbol test

Added: 
    

Modified: 
    lld/test/ELF/lto/duplicated.ll

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/lto/duplicated.ll b/lld/test/ELF/lto/duplicated.ll
index 10afb8e5a37ef..8dae81d1249fa 100644
--- a/lld/test/ELF/lto/duplicated.ll
+++ b/lld/test/ELF/lto/duplicated.ll
@@ -1,14 +1,29 @@
 ; REQUIRES: x86
-; RUN: llvm-as %s -o %t.o
-; RUN: not ld.lld %t.o %t.o -o /dev/null -shared 2>&1 | FileCheck %s
+; RUN: rm -rf %t && split-file %s %t
+; RUN: llvm-as %t/a.ll -o %t/a.bc
+; RUN: llvm-mc -filetype=obj %t/b.s -o %t/b.o
+; RUN: not ld.lld %t/a.bc %t/a.bc -o /dev/null -shared 2>&1 | FileCheck %s
+
+;; --thinlto-index-only skips some passes. Test the error is present.
+; RUN: not ld.lld %t/a.bc %t/a.bc --thinlto-index-only -o /dev/null 2>&1 | FileCheck %s
+; RUN: not ld.lld %t/b.o %t/a.bc --lto-emit-asm -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK2
 
 ; CHECK:      duplicate symbol: f
-; CHECK-NEXT: >>> defined in {{.*}}.o
-; CHECK-NEXT: >>> defined in {{.*}}.o
+; CHECK-NEXT: >>> defined in {{.*}}.bc
+; CHECK-NEXT: >>> defined in {{.*}}.bc
+
+; CHECK2:      duplicate symbol: f
+; CHECK2-NEXT: >>> defined in {{.*}}.o
+; CHECK2-NEXT: >>> defined in {{.*}}.bc
 
+;--- a.ll
 target triple = "x86_64-unknown-linux-gnu"
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 
 define void @f() {
   ret void
 }
+
+;--- b.s
+.globl f
+f:


        


More information about the llvm-commits mailing list