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

Alexandre Ganea via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jul 4 09:19:57 PDT 2026


================
@@ -0,0 +1,23 @@
+// This test checks if COFF file compiled with
+// -fprofile-generate has magic section ".pgi" to indicate so.
+
+// REQUIRES: x86-registered-target
+
+// RUN: %clang --target=x86_64-pc-windows -fprofile-generate %s -c -o %t_x86
+// RUN: llvm-objdump -h %t_x86 | FileCheck --check-prefix=CHECK_PGI %s
+
+// CHECK_PGI: {{.*}}.pgi{{.*}}
+
+// This test checks if COFF file contains a magic ".pgu" section to indicate that
+// it was compiled using profiling data.
+
+// RUN: llvm-profdata merge -output=%code.profdata %S/Inputs/thinlto_expect1.proftext
+// RUN: %clang --target=x86_64-pc-windows -fprofile-use=%code.profdata -c %s -o %t.obj
----------------
aganea wrote:

This won't work with `-flto`, instead I think you need to add a module flag like @rnk [suggests](https://github.com/llvm/llvm-project/pull/114260#discussion_r1852769032).

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


More information about the llvm-branch-commits mailing list