This patch adds initial support for extracting offloading binaries from
COFF objects. This is a first step to allow building offloading files
on Windows targets with the new driver.
Depends on D136796
Paths
| Differential D136855
[Binary] Support extracting offloading files from COFF ClosedPublic Authored by jhuber6 on Oct 27 2022, 9:17 AM.
Details Summary This patch adds initial support for extracting offloading binaries from Depends on D136796
Diff Detail
Unit TestsFailed Event TimelineComment Actions To my eyes, this looks reasonale, but I don't know enough about COFF to be able to comfortably review this. Best get another opinion. Comment Actions
A question I have for COFF, is if the only way to identify these sections would be via the name. For ELF we use a custom section type to easily identify the fat binary section, but it doesn't seem that there is a COFF equivalent. I thought about checking for the IMAGE_SCN_LNK_REMOVE and IMAGE_SCN_MEM_DISCARDABLE flags, but that's not guaranteed to be correct. Comment Actions Seems reasonable to me.
This revision is now accepted and ready to land.Nov 1 2022, 3:46 PM This revision was landed with ongoing or failed builds.Nov 3 2022, 2:19 PM Closed by commit rG8298f0b7b92e: [Binary] Support extracting offloading files from COFF (authored by jhuber6). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 471188 llvm/lib/Object/OffloadBinary.cpp
llvm/test/tools/llvm-objdump/Offloading/coff.test
llvm/test/tools/llvm-objdump/Offloading/non-elf.test
llvm/tools/llvm-objdump/OffloadDump.cpp
|
Rather than duplicating the code, I think it makes sense to do the ELF check inside the loop. You can construct an ELFSectionRef from a regular SectionRef if the object is an ELF file.