[lld] [lld][ELF] Simplify handleLibcall. NFC (PR #78659)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 18:15:58 PST 2024


https://github.com/sbc100 created https://github.com/llvm/llvm-project/pull/78659

I noticed this while working on #78658

>From 322e1294d375abf9dcbf5c0135dc5e7a91ec87a3 Mon Sep 17 00:00:00 2001
From: Sam Clegg <sbc at chromium.org>
Date: Fri, 19 Jan 2024 02:14:58 +0000
Subject: [PATCH] [lld][ELF] Simplify handleLibcall. NFC

I noticed this while working on #78658
---
 lld/ELF/Driver.cpp | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 5ccc65600dcb91..07f4263c90e62b 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -2081,13 +2081,7 @@ static void handleUndefinedGlob(StringRef arg) {
 
 static void handleLibcall(StringRef name) {
   Symbol *sym = symtab.find(name);
-  if (!sym || !sym->isLazy())
-    return;
-
-  MemoryBufferRef mb;
-  mb = cast<LazyObject>(sym)->file->mb;
-
-  if (isBitcode(mb))
+  if (sym && sym->isLazy() && isa<BitcodeFile>(sym->file))
     sym->extract();
 }
 



More information about the llvm-commits mailing list