[PATCH] D150462: [AIX] Fixed malformed big archive when total archive file size is large than 4Gbytes

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 06:58:03 PDT 2023


DiggerLin added inline comments.


================
Comment at: llvm/lib/Object/ArchiveWriter.cpp:708
+  uint64_t PrevOffset = 0;
+  uint16_t Index = 0;
   for (const NewArchiveMember &M : NewMembers) {
----------------
jhenderson wrote:
> Why is `uint16_t` appropriate here? I don't think it's unfeasible for an archive to several several hundred thousand members in particularly big project. I'd stick with `uint32_t` unless this value directly matches up with a file format member that restricts it to `uint16_t`.
According to the definition of getSymbols() function , it should be uint16_t Index.

https://github.com/llvm/llvm-project/blob/main/llvm/lib/Object/ArchiveWriter.cpp#L582 

static Expected<std::vector<unsigned>>
getSymbols(MemoryBufferRef Buf, uint16_t Index, raw_ostream &SymNames,
           SymMap *SymMap, bool &HasObject)  

https://github.com/llvm/llvm-project/blob/main/llvm/lib/Object/ArchiveWriter.cpp#L50

struct SymMap {
  bool UseECMap;
  std::map<std::string, uint16_t> Map;
  std::map<std::string, uint16_t> ECMap;
};


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150462/new/

https://reviews.llvm.org/D150462



More information about the llvm-commits mailing list