Skip to content

Lack of PGO probes in instrumented builds of libcoreclr #124141

@hoyosjs

Description

@hoyosjs

When building coreclr with --pgoinstrument, libcoreclr.so ends up with essentially no PGO instrumentation probes. The add_pgo(coreclr) call in src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt uses target_compile_options(PRIVATE), which only applies -flto -fprofile-instr-generate to the source files compiled directly into the coreclr shared library target - just mscoree.cpp and exports.cpp. The resulting library has very few probes (20-100 over ~30 functions). The vast majority of the runtime code lives in static libraries (cee_wks, utilcode, coreclrpal, etc.) that are linked in already compiled, without instrumentation flags. This doesn't affect clrjit because the JIT compiles all its source files directly into the shared library target. Windows doesn't have this issue since this is a link time option.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions