File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2114,8 +2114,11 @@ static void handleUndefinedGlob(StringRef arg) {
21142114
21152115static void handleLibcall (StringRef name) {
21162116 Symbol *sym = symtab.find (name);
2117- if (sym && sym->isLazy () && isa<BitcodeFile>(sym->file ))
2117+ if (sym && sym->isLazy () && isa<BitcodeFile>(sym->file )) {
2118+ if (!config->whyExtract .empty ())
2119+ ctx.whyExtractRecords .emplace_back (" <libcall>" , sym->file , *sym);
21182120 sym->extract ();
2121+ }
21192122}
21202123
21212124static void writeArchiveStats () {
Original file line number Diff line number Diff line change 44; RUN: llvm-as -o %t2.o %S/Inputs/libcall-archive.ll
55; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -o %t3.o %S/Inputs/libcall-archive.s
66; RUN: llvm-ar rcs %t.a %t2.o %t3.o
7- ; RUN: ld.lld -o %t %t.o %t.a
7+ ; RUN: ld.lld --why-extract=why.txt -o %t %t.o %t.a
8+ ; RUN: FileCheck %s --input-file=why.txt --check-prefix=CHECK-WHY
89; RUN: llvm-nm %t | FileCheck %s
910; RUN: ld.lld -o %t2 %t.o --start-lib %t2.o %t3.o --end-lib
1011; RUN: llvm-nm %t2 | FileCheck %s
1112
13+ ; CHECK-WHY: reference extracted symbol
14+ ; CHECK-WHY: <libcall> {{.*}}tmp.a({{.*}}tmp2.o) memcpy
15+
1216; CHECK-NOT: T __sync_val_compare_and_swap_8
1317; CHECK: T _start
1418; CHECK: T memcpy
1519
20+
1621target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
1722target triple = "x86_64-unknown-linux-gnu"
1823
You can’t perform that action at this time.
0 commit comments