[PATCH] D10983: [lld] COFF: Set parent name for bitcode files.
Peter Collingbourne
peter at pcc.me.uk
Mon Jul 6 21:17:01 PDT 2015
pcc added a reviewer: ruiu.
pcc added a subscriber: llvm-commits.
http://reviews.llvm.org/D10983
Files:
COFF/Symbols.cpp
test/COFF/lto.ll
Index: test/COFF/lto.ll
===================================================================
--- test/COFF/lto.ll
+++ test/COFF/lto.ll
@@ -11,7 +11,7 @@
; RUN: lld -flavor link2 /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.obj
; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s
-; RUN: lld -flavor link2 /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.lib
+; RUN: lld -flavor link2 /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.lib /verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s
@@ -29,6 +29,8 @@
; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s
; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-10 %s
+; VERBOSE: foo.lto.lib({{.*}}foo.lto.obj)
+
; HEADERS-11: AddressOfEntryPoint: 0x1000
; TEXT-11: Disassembly of section .text:
; TEXT-11-NEXT: .text:
Index: COFF/Symbols.cpp
===================================================================
--- COFF/Symbols.cpp
+++ COFF/Symbols.cpp
@@ -221,17 +221,19 @@
return std::unique_ptr<InputFile>(nullptr);
file_magic Magic = identify_magic(MBRef.getBuffer());
- if (Magic == file_magic::bitcode)
- return std::unique_ptr<InputFile>(new BitcodeFile(MBRef));
if (Magic == file_magic::coff_import_library)
return std::unique_ptr<InputFile>(new ImportFile(MBRef));
- if (Magic != file_magic::coff_object) {
+ std::unique_ptr<InputFile> Obj;
+ if (Magic == file_magic::coff_object)
+ Obj.reset(new ObjectFile(MBRef));
+ else if (Magic == file_magic::bitcode)
+ Obj.reset(new BitcodeFile(MBRef));
+ else {
llvm::errs() << File->getName() << ": unknown file type\n";
return make_error_code(LLDError::InvalidFile);
}
- std::unique_ptr<InputFile> Obj(new ObjectFile(MBRef));
Obj->setParentName(File->getName());
return std::move(Obj);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10983.29147.patch
Type: text/x-patch
Size: 2190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150707/0216c72c/attachment.bin>
More information about the llvm-commits
mailing list