[clang] [lld] [llvm] [Windows] Add support for emitting PGO/LTO magic strings in the Windows PE debug directory (PR #114260)
Mikołaj Piróg via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 02:59:03 PST 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
----------------
mikolaj-pirog 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.)
My intention was to create a holistic test that tests the feature from clang invocation to checking that magic strings are emitted. I already have a lld tests; I will change the pgi/pgu to be solely a clang test, checking for .pgi/.pgu section existence. For LTO case, I need to do this this way, since I have to test that lld emits "LTCG" when given an LTOed object file. Do you have any suggestions where could I move this test? Would moving the "LTCG" test to lld be OK?
https://github.com/llvm/llvm-project/pull/114260
More information about the cfe-commits
mailing list