[llvm-dev] Proposal: Add a version symbol to instrumented binaries
Vedant Kumar via llvm-dev
llvm-dev at lists.llvm.org
Thu Jan 28 15:02:38 PST 2016
Hi all,
I'd like to change the version symbol used in binaries instrumented for
profiling.
This would let us catch `RawInstrProf::Version` mismatches between object files
and compiler-rt at link-time. Currently, we will happily link programs against
incompatible compiler-rt's and end up with useless profiles.
Why is this a problem? Suppose A.o comes from clang and B.o comes from swift:
if clang and swift are compiled against different versions of llvm, we can end
up with the situation above.
To implement this, I suggest having the compiler frontend emit a weak
`__llvm_raw_prof_ver_%d` symbol where `%d = RawInstrProf::Version`. To update
compiler-rt, we'd have to rename `__llvm_profile_raw_version` to
`__llvm_profile_raw_version_%d`.
Thoughts? In particular, I'd like to know whether rust, julia, and others would
be OK with this.
best,
vedant
More information about the llvm-dev
mailing list