[PATCH] D124017: [AIX] fixed llvm-ar can not read empty big archive correctly.
Digger Lin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 10:32:43 PDT 2022
DiggerLin created this revision.
DiggerLin added reviewers: jhenderson, hubert.reinterpretcast, MaskRay.
Herald added subscribers: StephenFan, rupprecht.
Herald added a project: All.
DiggerLin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
llvm-ar can not read empty big archive correctly. it output error as
error: unable to load 'empty.a': truncated or malformed archive (characters in size field in archive member header are not all decimal numbers: '<bigaf>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124017
Files:
llvm/include/llvm/Object/Archive.h
llvm/test/tools/llvm-ar/display-empty.test
llvm/test/tools/llvm-ar/full-path-option.test
llvm/test/tools/llvm-ar/quick-append.test
llvm/test/tools/llvm-size/archive.test
Index: llvm/test/tools/llvm-size/archive.test
===================================================================
--- llvm/test/tools/llvm-size/archive.test
+++ llvm/test/tools/llvm-size/archive.test
@@ -5,7 +5,7 @@
## Case 1: Empty archive. No output expected.
# RUN: rm -f %t1.a
-# RUN: llvm-ar rc --format=gnu %t1.a
+# RUN: llvm-ar rc %t1.a
# RUN: llvm-size -B %t1.a | count 0
# RUN: llvm-size -A %t1.a | count 0
Index: llvm/test/tools/llvm-ar/quick-append.test
===================================================================
--- llvm/test/tools/llvm-ar/quick-append.test
+++ llvm/test/tools/llvm-ar/quick-append.test
@@ -1,4 +1,3 @@
-# XFAIL: system-aix
## Test quick append
# RUN: rm -rf %t && mkdir -p %t
Index: llvm/test/tools/llvm-ar/full-path-option.test
===================================================================
--- llvm/test/tools/llvm-ar/full-path-option.test
+++ llvm/test/tools/llvm-ar/full-path-option.test
@@ -27,7 +27,7 @@
# Deleting will fail with P because the members exist as foo.txt, not a/foo.txt.
RUN: rm -f del1.a
-RUN: llvm-ar rcS --format=gnu del1.a foo.txt
+RUN: llvm-ar rcS del1.a foo.txt
RUN: llvm-ar dP del1.a a/foo.txt
RUN: llvm-ar t del1.a a/foo.txt | FileCheck %s --check-prefix=DISPLAY-FOUND --match-full-lines
RUN: llvm-ar d del1.a a/foo.txt
Index: llvm/test/tools/llvm-ar/display-empty.test
===================================================================
--- llvm/test/tools/llvm-ar/display-empty.test
+++ llvm/test/tools/llvm-ar/display-empty.test
@@ -3,7 +3,7 @@
# RUN: rm -rf %t && mkdir -p %t
## Display empty archive:
-# RUN: llvm-ar cr --format=gnu %t/empty.a
+# RUN: llvm-ar cr %t/empty.a
# RUN: llvm-ar tv %t/empty.a 2>&1 | count 0
## Display empty thin archive:
Index: llvm/include/llvm/Object/Archive.h
===================================================================
--- llvm/include/llvm/Object/Archive.h
+++ llvm/include/llvm/Object/Archive.h
@@ -359,7 +359,7 @@
// check if a symbol is in the archive
Expected<Optional<Child>> findSym(StringRef name) const;
- bool isEmpty() const;
+ virtual bool isEmpty() const;
bool hasSymbolTable() const;
StringRef getSymbolTable() const { return SymbolTable; }
StringRef getStringTable() const { return StringTable; }
@@ -412,6 +412,9 @@
BigArchive(MemoryBufferRef Source, Error &Err);
uint64_t getFirstChildOffset() const override { return FirstChildOffset; }
uint64_t getLastChildOffset() const { return LastChildOffset; }
+ bool isEmpty() const override {
+ return Data.getBufferSize() == sizeof(FixLenHdr);
+ };
};
} // end namespace object
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124017.423666.patch
Type: text/x-patch
Size: 2621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/53a913b3/attachment-0001.bin>
More information about the llvm-commits
mailing list