[rtems-tools commit] linkers: Allow generation of symbol map file only

Sebastian Huber sebh at rtems.org
Thu Feb 29 08:57:17 UTC 2024


Module:    rtems-tools
Branch:    master
Commit:    cfef4b11dd70f672d8a58a6053aeaad03e9e302f
Changeset: http://git.rtems.org/rtems-tools/commit/?id=cfef4b11dd70f672d8a58a6053aeaad03e9e302f

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Feb 26 10:17:08 2024 +0100

linkers: Allow generation of symbol map file only

If a symbol map file is specified by the user and no output file, then
just generate the symbol map file.  The user can then compile the file
using its own build jobs.

---

 linkers/rtems-syms.cpp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp
index 377007d..9dd845f 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -345,6 +345,10 @@ generate_c (rld::process::tempfile& c,
             rld::symbols::symtab&   symbols,
             bool                    embed)
 {
+  if (rld::verbose ())
+    std::cout << "symbol C file: " << c.name () << std::endl;
+
+  c.open (true);
   temporary_file_paint (c, c_header);
 
   /*
@@ -390,11 +394,6 @@ generate_symmap (rld::process::tempfile& c,
                  rld::symbols::symtab&   symbols,
                  bool                    embed)
 {
-  c.open (true);
-
-  if (rld::verbose ())
-    std::cout << "symbol C file: " << c.name () << std::endl;
-
   generate_c (c, symbols, embed);
 
   if (rld::verbose ())
@@ -622,8 +621,8 @@ main (int argc, char* argv[])
       throw rld::error ("no kernel file", "options");
     if (argc != 1)
       throw rld::error ("only one kernel file", "options");
-    if (output.empty () && map.empty ())
-      throw rld::error ("no output or map", "options");
+    if (output.empty () && symc.empty() && map.empty ())
+      throw rld::error ("no output, symbol C file, or map", "options");
 
     kernel_name = *argv;
 
@@ -683,7 +682,7 @@ main (int argc, char* argv[])
       /*
        * Create an output file if asked too.
        */
-      if (!output.empty ())
+      if (!output.empty () || !symc.empty())
       {
         rld::process::tempfile c (".c");
 
@@ -694,9 +693,12 @@ main (int argc, char* argv[])
         }
 
         /*
-         * Generate and compile the symbol map.
+         * Generate and if requested compile the symbol map.
          */
-        generate_symmap (c, output, filter_symbols, embed);
+        if (output.empty())
+          generate_c (c, filter_symbols, embed);
+        else
+          generate_symmap (c, output, filter_symbols, embed);
       }
 
       kernel.close ();



More information about the vc mailing list