This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by DiggerLin on May 12 2023, 10:34 AM.

Details

Summary
  1. we use the unsigned type for NextOffset,PrevOffset ,GlobalSymbolOffset , MemberTableSize, it will caused a malform big archive when the archive file size is large than 4G.
  2. also fix a NFC comment on https://reviews.llvm.org/D142479#inline-1443927

Diff Detail

Event Timeline

DiggerLin created this revision.May 12 2023, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2023, 10:34 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
DiggerLin requested review of this revision.May 12 2023, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2023, 10:34 AM
DiggerLin retitled this revision from [NFC] Fixed malformed big archive when member file size large than 4Gbytes to [NFC] Fixed malformed big archive when total archive file size is large than 4Gbytes.May 12 2023, 10:35 AM
DiggerLin edited the summary of this revision. (Show Details)May 12 2023, 10:55 AM
DiggerLin added a reviewer: alisonz.
DiggerLin retitled this revision from [NFC] Fixed malformed big archive when total archive file size is large than 4Gbytes to [AIX] Fixed malformed big archive when total archive file size is large than 4Gbytes.May 12 2023, 12:50 PM

Sorry for not getting around to reviewing many of your patches. I'm very heavily loaded with my regular work commitments, and will be for the next couple of weeks at least. I'm just trying to review smaller patches in the meantime.

llvm/lib/Object/ArchiveWriter.cpp
708

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.

DiggerLin added inline comments.May 15 2023, 6:58 AM
llvm/lib/Object/ArchiveWriter.cpp
708

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;

};

DiggerLin added a comment.EditedMay 15 2023, 7:01 AM

Sorry for not getting around to reviewing many of your patches. I'm very heavily loaded with my regular work commitments, and will be for the next couple of weeks at least. I'm just trying to review smaller patches in the meantime.

Hi James, Please don't worry about the delay in reviewing the patches. . I completely understand your work load , and I'm grateful for any time you can spare. thank you very much for your time and your professional comments.

jhenderson accepted this revision.May 15 2023, 7:18 AM

Thanks for the explanation. LGTM.

This revision is now accepted and ready to land.May 15 2023, 7:18 AM