+2018-04-01  Chung-Ju Wu  <jasonwucj@gmail.com>
+
+       * config/nds32/nds32.h (FUNCTION_PROFILER): Output newline character.
+       (PROFILE_HOOK): Define its implementation.
+
 2018-04-01  Chung-Ju Wu  <jasonwucj@gmail.com>
 
        * config/nds32/nds32.h (WCHAR_TYPE, WCHAR_TYPE_SIZE): Use unsigned int
 
 #define EXIT_IGNORE_STACK 1
 
 #define FUNCTION_PROFILER(file, labelno) \
-  fprintf (file, "/* profiler %d */", (labelno))
+  fprintf (file, "/* profiler %d */\n", (labelno))
+
+#define PROFILE_HOOK(LABEL)                                            \
+  {                                                                    \
+    rtx fun, lp;                                                       \
+    lp = get_hard_reg_initial_val (Pmode, LP_REGNUM);                  \
+    fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount");                       \
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, lp, Pmode);          \
+  }
 
 \f
 /* Implementing the Varargs Macros.  */