[llvm] [llvm-profgen] Support COFF binary (PR #83972)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 15:09:48 PST 2024


================
@@ -211,9 +212,12 @@ void ProfiledBinary::load() {
   OwningBinary<Binary> OBinary = unwrapOrError(createBinary(Path), Path);
   Binary &ExeBinary = *OBinary.getBinary();
 
-  auto *Obj = dyn_cast<ELFObjectFileBase>(&ExeBinary);
-  if (!Obj)
-    exitWithError("not a valid Elf image", Path);
+  auto *ELFObj = dyn_cast<ELFObjectFileBase>(&ExeBinary);
----------------
wlei-llvm wrote:

This feel like there are two `Obj` files, `ELFObj` and `Obj`. Would it make sense here to use `isa<ELFObjectFileBase>` for the check and cast the `Obj` file when it's used as ELF file? 

https://github.com/llvm/llvm-project/pull/83972


More information about the llvm-commits mailing list