================
@@ -0,0 +1,13 @@
+// This test checks if Window PE file compiled with -flto option contains a 
magic 
+// string "LTCG" to indicate LTO compilation.
+
+// REQUIRES: system-windows
+
+// RUN: %clang --target=x86_64-pc-windows-msvc -flto -fuse-ld=lld %s -o %t.exe
+// RUN: dumpbin /HEADERS %t.exe | FileCheck %s
----------------
mikolaj-pirog wrote:

I was using `llvm-objdump` while I was working on that, but I think that using 
`dumpbin` is better compared to that. It can be somewhat tricky to emit this 
info in such a way that `dumpbin` catches it: first this info has to be emitted 
in the debug dir and in such a way that `dumpbin` recognizes the string (I 
believe it's length has to be divisible by 4 -- if not it has to prefixed with 
null bytes). Using the `dumpbin` to test assures that it correctly sees the 
magic strings. Checking for simple existence of string in the Windows PE file, 
using `llvm-objdump` for example, is not enough, since the string can have 
wrong length, and not be recognized by `dumpbin`. I was also aiming to achieve 
running on other OS, but that means dropping the `dumpbin`, which I think is 
wrong and the "PGU" test still has to be run on Windows (since the binary has 
to be run)

https://github.com/llvm/llvm-project/pull/114260
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to