[PATCH] D58997: Order File Instrumentation: dump the data in compiler-rt (Make it work for Linux/Windows etc)

Manman Ren via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 20:34:01 PST 2019


manmanren marked an inline comment as done.
manmanren added a comment.

Thanks!

Manman



================
Comment at: lib/profile/InstrProfilingPlatformLinux.c:67
 }
+COMPILER_RT_VISIBILITY uint32_t *__llvm_profile_begin_orderfile(void) {
+  return &PROF_ORDERFILE_START;
----------------
davidxl wrote:
> manmanren wrote:
> > davidxl wrote:
> > > manmanren wrote:
> > > > I am getting undefined reference to `__start___llvm_orderfile'. Not quite know where we define these symbols for PROF_CNTS etc.
> > > The cnt, data symbols are created in the related sections. Those symbols are created during instrumentation lowering -- see lib/Transforms/Instrumentation/InstrProfiling.cc
> > I can't find INSTR_PROF_SECT_START or "__start_" in InstrProfiling.cpp. Can you provide a bit more info? Thanks!
> The __start_xxx and __stop_xxx symbols are automatically generated by the linker to reference to the start end stop address of section named 'xxx'.   Compiler just need to put things into 'xxx':
> 
> CounterPtr->setSection(
>       getInstrProfSectionName(IPSK_cnts, TT.getObjectFormat()));
> 
In InstrOrderFile.cpp, we have this already:
    OrderFileBuffer->setSection(
        getInstrProfSectionName(IPSK_orderfile, TT.getObjectFormat()));

This actually works locally on my Linux machine.

The buildbot error message was
/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/stage2/lib/clang/9.0.0/lib/linux/libclang_rt.profile-powerpc64.a(InstrProfilingPlatformLinux.c.o): In function `__llvm_profile_begin_orderfile':
InstrProfilingPlatformLinux.c:(.text.__llvm_profile_begin_orderfile+0x2): undefined reference to `__start___llvm_orderfile'
InstrProfilingPlatformLinux.c:(.text.__llvm_profile_begin_orderfile+0x6): undefined reference to `__start___llvm_orderfile'
/bin/ld: /home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/stage2/projects/compiler-rt/test/profile/Profile-powerpc64/Posix/Output/instrprof-dlopen.test.tmp.d/func.shared: hidden symbol `__start___llvm_orderfile' isn't defined
/bin/ld: final link failed: Bad value
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58997/new/

https://reviews.llvm.org/D58997





More information about the llvm-commits mailing list