[llvm] [Archive][COFF] Split hybrid COFF files when adding them to an archive (PR #205160)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 27 15:16:45 PDT 2026
================
@@ -1580,6 +1580,69 @@ std::optional<MemoryBufferRef> COFFObjectFile::findHybridObjectSection() const {
return std::nullopt;
}
+std::unique_ptr<MemoryBuffer> COFFObjectFile::stripHybridSection() const {
+ if (getDOSHeader() || getMachine() != COFF::IMAGE_FILE_MACHINE_ARM64)
+ return nullptr;
+
+ for (SectionRef S : sections()) {
+ Expected<StringRef> Name = S.getName();
+ if (errorToBool(Name.takeError()) || *Name != kArm64XSectionName)
+ continue;
+
+ const coff_section *HybridSec = getCOFFSection(S);
+ if (!HybridSec->SizeOfRawData)
+ continue;
+
+ // Copy the original buffer, skipping the hybrid section content.
+ std::unique_ptr<WritableMemoryBuffer> HybridView =
----------------
mstorsjo wrote:
`HybridView` doesn't seem like the right name here - as we're aiming for the opposite, a non-hybrid view with only the main architecture?
https://github.com/llvm/llvm-project/pull/205160
More information about the llvm-commits
mailing list