Skip to content

Commit

Permalink
[lld-macho] Include archive name in bitcode files
Browse files Browse the repository at this point in the history
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D115281
  • Loading branch information
int3 committed Dec 8, 2021
1 parent 5b3a51f commit 8a1f2d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lld/MachO/InputFiles.cpp
Expand Up @@ -1478,6 +1478,7 @@ static macho::Symbol *createBitcodeSymbol(const lto::InputFile::Symbol &objSym,
BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
uint64_t offsetInArchive)
: InputFile(BitcodeKind, mb) {
this->archiveName = std::string(archiveName);
std::string path = mb.getBufferIdentifier().str();
// ThinLTO assumes that all MemoryBufferRefs given to it have a unique
// name. If two members with the same name are provided, this causes a
Expand Down
8 changes: 4 additions & 4 deletions lld/test/MachO/lto-archive.ll
Expand Up @@ -10,15 +10,15 @@
; RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/references-foo.s -o %t/references-foo.o

; RUN: %lld -lSystem %t/references-foo.o %t/foo.a -o /dev/null -why_load | FileCheck %s --check-prefix=FOO
; FOO: _foo forced load of foo.o
; FOO: _foo forced load of {{.+}}foo.a(foo.o)

; RUN: %lld -lSystem -force_load %t/foo.a %t/main.o -o /dev/null -why_load | FileCheck %s --check-prefix=FORCE-LOAD
; FORCE-LOAD: -force_load forced load of foo.o
; FORCE-LOAD: -force_load forced load of {{.+}}foo.a(foo.o)

; RUN: %lld -lSystem -ObjC -framework CoreFoundation %t/objc.a %t/main.o \
; RUN: -o /dev/null -why_load | FileCheck %s --check-prefix=OBJC
; OBJC: _OBJC_CLASS_$_Foo forced load of has-objc-symbol.o
; OBJC: -ObjC forced load of has-objc-category.o
; OBJC: _OBJC_CLASS_$_Foo forced load of {{.+}}objc.a(has-objc-symbol.o)
; OBJC: -ObjC forced load of {{.+}}objc.a(has-objc-category.o)

; RUN: %lld -lSystem %t/foo.a %t/main.o -o %t/no-force-load -why_load | count 0

Expand Down

0 comments on commit 8a1f2d6

Please sign in to comment.