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

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 13:47:36 PST 2019


davidxl added inline comments.


================
Comment at: lib/profile/InstrProfilingPlatformLinux.c:67
 }
+COMPILER_RT_VISIBILITY uint32_t *__llvm_profile_begin_orderfile(void) {
+  return &PROF_ORDERFILE_START;
----------------
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()));



================
Comment at: lib/profile/InstrProfilingPlatformOther.c:88
+COMPILER_RT_VISIBILITY
+uint32_t *__llvm_profile_begin_orderfile(void) { return OrderFileFirst; }
 
----------------
manmanren wrote:
> davidxl wrote:
> > manmanren wrote:
> > > Not sure what I should do for PlatformOther :[
> > For these platforms, you need to add interface to register symbols in orderFile section, and this new interface just track the start and end of the section. The register functions are called during startup. See also lowering pass that generates call to register functions.
> Is __llvm_profile_register_function the one? Should we add a new function for orderFile section?
yes, there is also __llvm_profile_register_names_function for name sections.

emit the registration call in void InstrProfiling::emitRegistration()  {..}


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