title: Using gcc/g++ instrument functions with MinGW?
body: <p>i try to use the gcc instrument functions with g++ compiler of MinGW, but i
  always got linker issues. Is it possible to use the instrument functions with
  MinGW/MSYS?</p>
  
  <p>The linker failure output:</p>
  
  <pre><code>$ g++ instrumentFunctions.cpp -o iftest -finstrument-functions &gt;&gt; iflog.txt
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x4e): undefined reference to `__cyg_prof
  ile_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x158): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x179): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x18c): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x1a7): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x1bf): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x1db): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x1f3): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x22f): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x27a): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x29b): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x2e4): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x2ff): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x326): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x341): undefined reference to `__cyg_pro
  file_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text+0x368): undefined reference to `__cyg_pro
  file_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text$printf[_printf]+0x16): undefined referenc
  e to `__cyg_profile_func_enter'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text$printf[_printf]+0x43): undefined referenc
  e to `__cyg_profile_func_exit'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text$_ZSt3minIjERKT_S2_S2_[unsigned int const&amp;
   std::min&lt;unsigned int&gt;(unsigned int const&amp;, unsigned int const&amp;)]+0x15): undefined reference to `__cyg_profile_func_ent
  er'
  C:/Users/HELLHO~1/AppData/Local/Temp/ccUwxrxt.o:instrumentFunctions.cpp:(.text$_ZSt3minIjERKT_S2_S2_[unsigned int const&amp;
   std::min&lt;unsigned int&gt;(unsigned int const&amp;, unsigned int const&amp;)]+0x42): undefined reference to `__cyg_profile_func_exi
  t'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>g++ command i use: </p>
  
  <pre><code>g++ iftest.cpp -o iftest -finstruction-functions
  </code></pre>
  
  <p>Listing of my testsource:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
    void __cyg_profile_func_enter( void *, void * ) __attribute__ ((no_instrument_function));
  
    void __cyg_profile_func_enter(void *func, void *callsite)
    {
      printf("%p\n", (int)func);
    }
  
  
    void func_c( void )
    {
      return;
    }
  
    void func_b( void )
    {
      func_c();
  
      return;
    }
  
    void func_a( void )
    {
      func_b();
      return;
    }
  
  
    int main()
    {
      func_a();
      func_c();
    }
  </code></pre>