Index: linkers/rtems-tld.cpp
===================================================================
--- linkers/rtems-tld.cpp	(revision 17c836402fe28360d9805eed1584dd0e2dd33db5)
+++ linkers/rtems-tld.cpp	(revision 2126ea7ff045df25fe6588e8820e02504744549d)
@@ -136,5 +136,4 @@
       rld::strings headers;         /**< Include statements. */
       rld::strings defines;         /**< Define statements. */
-      std::string  map_sym_prefix;  /**< Mapping symbol prefix. */
       std::string  arg_trace;       /**< Code template to trace an argument. */
       std::string  ret_trace;       /**< Code template to trace the return value. */
@@ -442,5 +441,4 @@
       parse (config, section, "code-blocks", "code",   code, false);
 
-      map_sym_prefix = section.get_record_item ("map-sym-prefix");
       arg_trace = rld::dequote (section.get_record_item ("arg-trace"));
       ret_trace = rld::dequote (section.get_record_item ("ret-trace"));
@@ -465,6 +463,5 @@
         out << "    " << (*di) << std::endl;
       }
-      out << "   Mapping Symbol Prefix: " << map_sym_prefix << std::endl
-          << "   Arg Trace Code: " << arg_trace << std::endl
+      out << "   Arg Trace Code: " << arg_trace << std::endl
           << "   Return Trace Code: " << ret_trace << std::endl
           << "   Code blocks: " << std::endl;
@@ -647,15 +644,30 @@
             c.write_line("{");
 
-            std::string l;
-
             /*
              * @todo Need to define as part of the function signature if ret
              *       processing is required.
              */
-            if (sig.ret != "void")
+            bool has_ret = sig.ret != "void";
+
+            if (has_ret)
+              c.write_line(" " + sig.ret + " ret;");
+
+            std::string l;
+
+            for (size_t a = 0; a < sig.args.size (); ++a)
             {
-              c.write_line(" " + sig.ret + " ret;");
+              std::string l = ' ' + generator_.arg_trace;
+              std::string n = rld::to_string ((int) (a + 1));
+              l = rld::find_replace (l, "@ARG_NUM@", n);
+              l = rld::find_replace (l, "@ARG_TYPE@", '"' + sig.args[0] + '"');
+              l = rld::find_replace (l, "@ARG_SIZE@", "sizeof(" + sig.args[0] + ')');
+              l = rld::find_replace (l, "@ARG_LABEL@", "a" + n);
+              c.write_line(l);
+            }
+
+            l.clear ();
+
+            if (has_ret)
               l = " ret =";
-            }
 
             l += " __real_" + sig.name + '(';
@@ -669,6 +681,11 @@
             c.write_line(l);
 
-            if (sig.ret != "void")
+            if (has_ret)
             {
+              std::string l = ' ' + generator_.ret_trace;
+              l = rld::find_replace (l, "@RET_TYPE@", '"' + sig.ret + '"');
+              l = rld::find_replace (l, "@RET_SIZE@", "sizeof(" + sig.ret + ')');
+              l = rld::find_replace (l, "@RET_LABEL@", "ret");
+              c.write_line(l);
               c.write_line(" return ret;");
             }
@@ -786,13 +803,12 @@
         std::cout << "linking: " << o.name () << std::endl;
 
-      std::string wrap = " -Wl,--wrap -Wl,";
+      std::string wrap = " -Wl,--wrap=";
 
       rld::cc::make_ld_command (args);
 
-      args.push_back (o.name ());
-
-      rld::process::args_append (args, ld_cmd);
       rld::process::args_append (args,
                                  wrap + rld::join (tracer_.get_traces (), wrap));
+      args.push_back (o.name ());
+      rld::process::args_append (args, ld_cmd);
 
       rld::process::tempfile out;
@@ -808,7 +824,8 @@
           (status.code != 0))
       {
-        err.output (rld::cc::get_cc (), std::cout);
+        err.output (rld::cc::get_ld (), std::cout);
         throw rld::error ("Linker error", "linking");
       }
+      err.output (rld::cc::get_ld (), std::cout);
     }
 
Index: linkers/rtld-base.ini
===================================================================
--- linkers/rtld-base.ini	(revision 17c836402fe28360d9805eed1584dd0e2dd33db5)
+++ linkers/rtld-base.ini	(revision 2126ea7ff045df25fe6588e8820e02504744549d)
@@ -15,13 +15,12 @@
 ;
 [printf-generator]
-map-sym-prefix = rtld_pg__
 headers = printf-generator-headers
-arg-trace = "rtld_pg_print_arg(@ARG_NUM@, @ARG_TYPE@, @ARG_SIZE@, &@ARG_LABEL@);"
-ret-trace = "rtld_pg_print_ret(@RET_TYPE@, @RETG_SIZE@, &@RET_LABEL@);"
+arg-trace = "rtld_pg_print_arg(@ARG_NUM@, @ARG_TYPE@, @ARG_SIZE@, (void*) &@ARG_LABEL@);"
+ret-trace = "rtld_pg_print_ret(@RET_TYPE@, @RET_SIZE@, (void*) &@RET_LABEL@);"
 code = <<<CODE
-static inline void rtld_pg_print_arg(int    arg_num,
-                                     const  char* arg_type,
-                                     int    arg_size,
-                                     void*  arg)
+static inline void rtld_pg_print_arg(int         arg_num,
+                                     const char* arg_type,
+                                     int         arg_size,
+                                     void*       arg)
 {
   const char* p = arg;
@@ -31,4 +30,14 @@
   printf ("\n");
 }
+static inline void rtld_pg_print_ret(const char* ret_type,
+                                     int         ret_size,
+                                     void*       ret)
+{
+  const char* p = ret;
+  int   i;
+  printf (" rt] %s(%d) = ", ret_type, ret_size);
+  for (i = 0; i < ret_size; ++i, ++p) printf ("%02x", (unsigned int) *p);
+  printf ("\n");
+}
 CODE
 
