[lld] ae62aaa - [ELF][test] Add --undefine-glob test to lto/duplicated.ll

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 09:41:00 PST 2022


Author: Fangrui Song
Date: 2022-02-16T09:40:55-08:00
New Revision: ae62aaa171b8409ac930391103b9523493a46d8e

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

LOG: [ELF][test] Add --undefine-glob test to lto/duplicated.ll

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 e0e05b1fe498a..60bdb4455ee6b 100644
--- a/lld/test/ELF/lto/duplicated.ll
+++ b/lld/test/ELF/lto/duplicated.ll
@@ -2,12 +2,16 @@
 ; RUN: rm -rf %t && split-file %s %t
 ; RUN: llvm-as %t/a.ll -o %t/a.bc
 ; RUN: llvm-mc --triple=x86_64-unknown-linux-gnu -filetype=obj %t/b.s -o %t/b.o
+; RUN: llvm-as %t/c.ll -o %t/c.bc
 ; 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
 
+;; --undefined-glob g extracts %t/c.bc which causes a duplicate symbol error.
+; RUN: not ld.lld %t/a.bc --start-lib %t/c.bc --undefined-glob g --thinlto-index-only -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK
+
 ; CHECK:      duplicate symbol: f
 ; CHECK-NEXT: >>> defined in {{.*}}.bc
 ; CHECK-NEXT: >>> defined in {{.*}}.bc
@@ -20,6 +24,10 @@
 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 @_start() {
+  ret void
+}
+
 define void @f() {
   ret void
 }
@@ -27,3 +35,15 @@ define void @f() {
 ;--- b.s
 .globl f
 f:
+
+;--- c.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
+}
+
+define void @g() {
+  ret void
+}


        


More information about the llvm-commits mailing list