From 17bc4497847eb0388bedc5c8483bf8a1cbdd3a42 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 23 Jan 2024 11:26:21 -0800 Subject: [PATCH] [ELF] Improve thin-archivecollision.ll --- lld/test/ELF/lto/thin-archivecollision.ll | 32 ++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lld/test/ELF/lto/thin-archivecollision.ll b/lld/test/ELF/lto/thin-archivecollision.ll index 47a0beef7a27..da3d08801e96 100644 --- a/lld/test/ELF/lto/thin-archivecollision.ll +++ b/lld/test/ELF/lto/thin-archivecollision.ll @@ -1,28 +1,30 @@ ; REQUIRES: x86 -; RUN: opt -module-summary %s -o %t.o +; RUN: rm -rf %t && mkdir %t && cd %t +; RUN: mkdir d e +; RUN: opt -module-summary %s -o b.bc ; RUN: mkdir -p %t1 %t2 -; RUN: opt -module-summary %p/Inputs/thin1.ll -o %t1/t.coll.o -; RUN: opt -module-summary %p/Inputs/thin2.ll -o %t2/t.coll.o +; RUN: opt -module-summary %p/Inputs/thin1.ll -o d/coll.o +; RUN: opt -module-summary %p/Inputs/thin2.ll -o e/coll.o -; RUN: rm -f %t.a -; RUN: llvm-ar rcs %t.a %t1/t.coll.o %t2/t.coll.o -; RUN: ld.lld %t.o %t.a -o %t -; RUN: llvm-nm %t | FileCheck %s - -; Check without a archive symbol table -; RUN: rm -f %t.a -; RUN: llvm-ar rcS %t.a %t1/t.coll.o %t2/t.coll.o -; RUN: ld.lld %t.o %t.a -o %t -; RUN: llvm-nm %t | FileCheck %s +; RUN: llvm-ar rcS d/a.a d/coll.o e/coll.o +; RUN: ld.lld b.bc d/a.a -o out --save-temps +; RUN: llvm-nm out | FileCheck %s +; RUN: llvm-nm out2.lto.o | FileCheck %s --check-prefix=MOD2 +; RUN: llvm-nm out3.lto.o | FileCheck %s --check-prefix=MOD3 ; Check we handle this case correctly even in presence of --whole-archive. -; RUN: ld.lld %t.o --whole-archive %t.a -o %t -; RUN: llvm-nm %t | FileCheck %s +; RUN: rm out1.lto.o out2.lto.o out3.lto.o +; RUN: ld.lld b.bc --whole-archive d/a.a -o out --save-temps +; RUN: llvm-nm out | FileCheck %s +; RUN: ls out1.lto.o out2.lto.o out3.lto.o ; CHECK: T _start ; CHECK: T blah ; CHECK: T foo +; MOD2: T foo +; MOD3: T blah + target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-scei-ps4"