[clang] [lld] [llvm] [Windows] Add support for emitting PGO/LTO magic strings in the Windows PE debug directory (PR #114260)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 31 07:45:11 PDT 2024


================
@@ -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
----------------
mstorsjo wrote:

Note that this test as such doesn't fit the testing separation within LLVM.

As it stands, this test does compilation with Clang, linking with LLD, and inspects the results.

This is generally not allowed in Clang tests. A Clang test normally should only test that producing LLVM IR works correctly. An LLVM level test can test that IR -> object files does the right thing. And an LLD test can test that object file -> executable does the right thing.

But there's in general no guarantee that e.g. LLD is available while testing Clang, or that you have the right headers/libraries that might be expected while compiling. (In this case, the generated object files can end up requiring `msvcrt.lib` or `libcmt.lib` or similar libraries that aren't available in general, when cross compiling.)

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


More information about the cfe-commits mailing list