[PATCH] D86771: [llvm-readobj/elf] - Don't fail when dumping an archive with a member that can't be recognized.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 03:16:40 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG506f89ce914e: [llvm-readobj/elf] - Don't fail when dumping an archive with a member that… (authored by grimar).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86771/new/
https://reviews.llvm.org/D86771
Files:
llvm/test/tools/llvm-readobj/archive.test
llvm/tools/llvm-readobj/llvm-readobj.cpp
Index: llvm/tools/llvm-readobj/llvm-readobj.cpp
===================================================================
--- llvm/tools/llvm-readobj/llvm-readobj.cpp
+++ llvm/tools/llvm-readobj/llvm-readobj.cpp
@@ -584,8 +584,8 @@
else if (COFFImportFile *Imp = dyn_cast<COFFImportFile>(&*ChildOrErr.get()))
dumpCOFFImportFile(Imp, Writer);
else
- reportError(errorCodeToError(readobj_error::unrecognized_file_format),
- Arc->getFileName());
+ reportWarning(errorCodeToError(readobj_error::unrecognized_file_format),
+ Arc->getFileName());
}
if (Err)
reportError(std::move(Err), Arc->getFileName());
Index: llvm/test/tools/llvm-readobj/archive.test
===================================================================
--- llvm/test/tools/llvm-readobj/archive.test
+++ llvm/test/tools/llvm-readobj/archive.test
@@ -1,3 +1,5 @@
+## Test how we dump archives.
+
## Show that dumping operations apply to all members in an archive.
# RUN: rm -f %t.a
@@ -82,3 +84,17 @@
Characteristics: [ ]
sections: []
symbols: []
+
+## Here we test that we report a warning and continue dumping when an archive contains
+## a unrecognized object. We place a dummy archive to another archive in the middle,
+## so that it is placed between two valid objects.
+
+# RUN: rm -f %t2.a
+# RUN: llvm-ar rc %t.dir/broken.a %t.dir/trivial.obj.elf-x86-64
+# RUN: llvm-ar qc %t2.a %t.dir/trivial.obj.elf-x86-64 %t.dir/broken.a %t.dir/trivial.obj.elf-x86-64
+# RUN: llvm-readobj --all %t2.a 2>&1 | FileCheck %s -DARFILE="%t2.a" --check-prefix=BROKEN
+# RUN: llvm-readelf --all %t2.a 2>&1 | FileCheck %s -DARFILE="%t2.a" --check-prefix=BROKEN
+
+# BROKEN: File: [[ARFILE]](trivial.obj.elf-x86-64)
+# BROKEN: warning: '[[ARFILE]]': Unrecognized file type.
+# BROKEN: File: [[ARFILE]](trivial.obj.elf-x86-64)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86771.288910.patch
Type: text/x-patch
Size: 1852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200831/3425c637/attachment-0001.bin>
More information about the llvm-commits
mailing list