Skip to content

[lld][ELF] Simplify handleLibcall. NFC - #78659

Merged
sbc100 merged 1 commit into
llvm:mainfrom
sbc100:simplify_handleLibcall
Jan 19, 2024
Merged

sbc100 merged 1 commit into
llvm:mainfrom
sbc100:simplify_handleLibcall

Conversation

@sbc100

@sbc100 sbc100 commented Jan 19, 2024

Copy link
Copy Markdown
Contributor

I noticed this while working on #78658

I noticed this while working on llvm#78658
@llvmbot

llvmbot commented Jan 19, 2024 •

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-lld-elf

@llvm/pr-subscribers-lld

Author: Sam Clegg (sbc100)

Changes

I noticed this while working on #78658


Full diff: https://github.com/llvm/llvm-project/pull/78659.diff

1 Files Affected:

  • (modified) lld/ELF/Driver.cpp (+1-7)
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();
 }
 

@sbc100
sbc100 requested a review from MaskRay January 19, 2024 02:16

@MaskRay MaskRay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this opportunity is enabled by my previous change removing LazyArchive https://reviews.llvm.org/D119074

@sbc100
sbc100 merged commit f5e58a0 into llvm:main Jan 19, 2024
@sbc100
sbc100 deleted the simplify_handleLibcall branch January 19, 2024 20:39
paleauraaaa pushed a commit to paleauraaaa/llvm-project that referenced this pull request Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants