Skip to content

Undefined symbols when using ThinLTO + cs-profile-generate #167327

@tru

Description

@tru

This is my simple compile script. CC is clang-cl.exe, LD is lld-link.exe and PROFILE is the path to clang_rt.profile.lib

%CC% /c /Fotest_pgo.obj -fprofile-generate=pgo.profraw -flto=thin test.cpp
%LD% /out:test_pgo.exe test_pgo.obj %PROFILE%

.\test_pgo.exe
%PD% merge -o default.prof pgo.profraw

%CC% /c /Fotest.obj -fcs-profile-generate -fprofile-use=default.prof -flto=thin test.cpp
%LD% /out:test.exe test.obj %PROFILE% /lto-cs-profile-generate

This leads to the following error:

lld-link: error: undefined symbol: __llvm_profile_counter_bias
>>> referenced by clang_rt.profile.lib(InstrProfilingFile.c.obj):(mmapForContinuousMode)

In another project I also see that __llvm_profile_filename is undefined.

I tired to define these in the source but it doesn't seem to make a difference.

Anyone using CS PGO on Windows? @zmodem @teresajohnson

Metadata

Metadata

Assignees

No one assigned

    Labels

    PGOProfile Guided Optimizationsclang-cl`clang-cl` driver. Don't use for other compiler partsplatform:windowsquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions