Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jan 19, 2024

I noticed this while working on #78658

I noticed this while working on llvm#78658
@llvmbot
Copy link
Member

llvmbot commented Jan 19, 2024

@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
Copy link
Member

@MaskRay MaskRay left a comment

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
5 of 6 checks passed
@sbc100 sbc100 deleted the simplify_handleLibcall branch January 19, 2024 20:39
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