[llvm-lib] [llvm-readobj] [llvm-cvtres] Add Support for ARM64X object files.
authorJacek Caban <jacek@codeweavers.com>
Fri, 21 Apr 2023 12:32:07 +0000 (15:32 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 21 Apr 2023 12:46:20 +0000 (15:46 +0300)
commitcea5d2870f379e7f93ba9da01747a279e4225998
treecb7aef44a3ed7066ddba72a4ffd653fce1ea80ec
parent85a2c50ec4979b87267e4f2068f2921beb0b98f2
[llvm-lib] [llvm-readobj] [llvm-cvtres] Add Support for ARM64X object files.

Similar to D125411, but for ARM64X.

ARM64X PE binaries are hybrids containing both ARM64EC and pure ARM64
variants in one file. They are usually linked by passing separate
ARM64EC and ARM64 object files to linker. Linked binaries use ARM64
machine and contain additional CHPE metadata in their load config.
CHPE metadata support is not part of this patch, I plan to send that later.

Using ARM64X as a machine type of object files themselves is somewhat
ambiguous, but such files are allowed by MSVC. It treats them as ARM64
or ARM64EC object, depending on the context. Such objects can be
produced with cvtres.exe -machine:arm64x.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D148517
15 files changed:
llvm/include/llvm/BinaryFormat/COFF.h
llvm/lib/BinaryFormat/Magic.cpp
llvm/lib/Object/COFFImportFile.cpp
llvm/lib/Object/COFFObjectFile.cpp
llvm/lib/Object/WindowsMachineFlag.cpp
llvm/lib/Object/WindowsResource.cpp
llvm/lib/ObjectYAML/COFFEmitter.cpp
llvm/lib/ObjectYAML/COFFYAML.cpp
llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
llvm/test/tools/llvm-cvtres/machine.test
llvm/test/tools/llvm-lib/Inputs/arm64x.yaml [new file with mode: 0644]
llvm/test/tools/llvm-lib/machine-mismatch.test
llvm/test/tools/llvm-readobj/COFF/arm64x.yaml [new file with mode: 0644]
llvm/tools/llvm-readobj/COFFDumper.cpp