This is an archive of the discontinued LLVM Phabricator instance.

[llvm-lib] [llvm-readobj] [llvm-cvtres] Add Support for ARM64X object files.

Authored by jacek on Apr 17 2023, 5:51 AM.



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.

Diff Detail

Event Timeline

jacek created this revision.Apr 17 2023, 5:51 AM
Herald added a project: Restricted Project. · View Herald Transcript
jacek requested review of this revision.Apr 17 2023, 5:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 5:51 AM

It looks like this covers all the basics... the "object file you can treat either way" thing is a bit weird, but I guess that's defined by Microsoft.


It looks like you don't use this helper anywhere other than this header.


Maybe name this isAnyArm64, or something like that, to indicate that it's encompassing all the different variants.

jacek updated this revision to Diff 514434.Apr 17 2023, 3:14 PM

Thanks for the review. I updated the patch with the helper renamed to isAnyArm64. I also included use of isArm64EC in libDriverMain (I think I lost it in rebase). I have a bit more use of it in my queue, but nothing substantial, so I may remove it if you prefer.

This revision is now accepted and ready to land.Apr 18 2023, 10:20 AM
This revision was landed with ongoing or failed builds.Apr 21 2023, 5:46 AM
This revision was automatically updated to reflect the committed changes.

Hello and good afternoon from the UK,

I believe this is 3 of 3 patches that may have caused the following build bot to begin failing, are you able to take a look?

Warm regards,
Tom W