Index: linkers/rld-cc.cpp
===================================================================
--- linkers/rld-cc.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-cc.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2011-2012, Chris Johns <chrisj@rtems.org>
+ * Copyright (c) 2011-2014, Chris Johns <chrisj@rtems.org>
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -28,7 +28,10 @@
   {
     std::string cc;
+    std::string cc_name = "gcc";
     std::string exec_prefix;
-    std::string march;
-    std::string mcpu;
+    std::string cppflags;
+    std::string cflags;
+    std::string cxxflags;
+    std::string ldflags;
     std::string install_path;
     std::string programs_path;
@@ -42,9 +45,9 @@
     static const char* std_lib_cplusplus = "libstdc++.a";
 
-    static void
+    void
     make_cc_command (rld::process::arg_container& args)
     {
       /*
-       * Use the absolute path to CC is provided.
+       * Use the absolute path to CC if provided.
        */
       if (!cc.empty ())
@@ -52,13 +55,37 @@
       else
       {
-        std::string cmd = "gcc";
+        std::string cmd = cc_name;
         if (!exec_prefix.empty ())
           cmd = exec_prefix + "-rtems" + rld::rtems_version () + '-' + cmd;
         args.push_back (cmd);
       }
-      if (!march.empty ())
-        args.push_back ("-march=" + march);
-      if (!mcpu.empty ())
-        args.push_back ("-mcpu=" + mcpu);
+    }
+
+    void
+    add_cppflags (rld::process::arg_container& args)
+    {
+      if (!cppflags.empty ())
+        args.push_back (cppflags);
+    }
+
+    void
+    add_cflags (rld::process::arg_container& args)
+    {
+      if (!cflags.empty ())
+        args.push_back (cflags);
+    }
+
+    void
+    add_cxxflags (rld::process::arg_container& args)
+    {
+      if (!cxxflags.empty ())
+        args.push_back (cxxflags);
+    }
+
+    void
+    add_ldflags (rld::process::arg_container& args)
+    {
+      if (!ldflags.empty ())
+        args.push_back (ldflags);
     }
 
@@ -83,4 +110,6 @@
 
       make_cc_command (args);
+      add_cppflags (args);
+      add_cflags (args);
       args.push_back ("-print-search-dirs");
 
@@ -89,5 +118,5 @@
       rld::process::status   status;
 
-      status = rld::process::execute ("gcc", args, out.name (), err.name ());
+      status = rld::process::execute (cc_name, args, out.name (), err.name ());
 
       if ((status.type == rld::process::status::normal) &&
@@ -95,5 +124,5 @@
       {
         if (rld::verbose () >= RLD_VERBOSE_DETAILS)
-          out.output ("gcc", std::cout, true);
+          out.output (cc_name, std::cout, true);
         out.open ();
         while (true)
@@ -120,5 +149,5 @@
       else
       {
-        err.output ("gcc", std::cout);
+        err.output (cc_name, std::cout);
       }
     }
@@ -130,4 +159,6 @@
 
       make_cc_command (args);
+      add_cflags (args);
+      add_ldflags (args);
       args.push_back ("-print-file-name=" + name);
 
@@ -136,5 +167,5 @@
       rld::process::status   status;
 
-      status = rld::process::execute ("gcc", args, out.name (), err.name ());
+      status = rld::process::execute (cc_name, args, out.name (), err.name ());
 
       if ((status.type == rld::process::status::normal) &&
@@ -156,5 +187,5 @@
 
     void
-    get_standard_libpaths (rld::files::paths& libpaths)
+    get_standard_libpaths (rld::path::paths& libpaths)
     {
       search_dirs ();
@@ -163,7 +194,7 @@
 
     void
-    get_standard_libs (rld::files::paths& libs,
-                       rld::files::paths& libpaths,
-                       bool               cplusplus)
+    get_standard_libs (rld::path::paths& libs,
+                       rld::path::paths& libpaths,
+                       bool              cplusplus)
     {
       strings libnames;
@@ -171,5 +202,5 @@
       rld::split (std_lib_c, libnames, RLD_PATHSTR_SEPARATOR);
       if (cplusplus)
-        rld::files::path_split (std_lib_cplusplus, libnames);
+        rld::path::path_split (std_lib_cplusplus, libnames);
 
       for (strings::iterator lni = libnames.begin ();
@@ -182,5 +213,5 @@
         std::string path;
 
-        rld::files::find_file (path, *lni, libpaths);
+        rld::path::find_file (path, *lni, libpaths);
         if (path.empty ())
           throw rld::error ("Library not found: " + *lni, "getting standard libs");
Index: linkers/rld-cc.h
===================================================================
--- linkers/rld-cc.h	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-cc.h	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2011-2012, Chris Johns <chrisj@rtems.org>
+ * Copyright (c) 2011-2014, Chris Johns <chrisj@rtems.org>
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -29,4 +29,5 @@
 
 #include <rld-files.h>
+#include <rld-process.h>
 
 namespace rld
@@ -34,8 +35,12 @@
   namespace cc
   {
-    extern std::string cc;             //< The CC executable.
+    extern std::string cc;             //< The CC executable as absolute path.
+    extern std::string cc_name;        //< The CC name, ie gcc, clang.
     extern std::string exec_prefix;    //< The CC executable prefix.
-    extern std::string march;          //< The CC machine architecture.
-    extern std::string mcpu;           //< The CC machine CPU.
+
+    extern std::string cppflags;       //< The CPP flags.
+    extern std::string cflags;         //< The CC flags.
+    extern std::string cxxflags;       //< The CXX flags.
+    extern std::string ldflags;        //< The LD flags.
 
     extern std::string install_path;   //< The CC reported install path.
@@ -44,14 +49,39 @@
 
     /**
+     * Make a CC command from the set arguments.
+     */
+    void make_cc_command (rld::process::arg_container& args);
+
+    /**
+     * If the cppflags has been set append to the arguments.
+     */
+    void add_cppflags (rld::process::arg_container& args);
+
+    /**
+     * If the cflags has been set append to the arguments.
+     */
+    void add_cflags (rld::process::arg_container& args);
+
+    /**
+     * If the cxxflags has been set append to the arguments.
+     */
+    void add_cxxflags (rld::process::arg_container& args);
+
+    /**
+     * If the ldflags has been set append to the arguments.
+     */
+    void add_ldflags (rld::process::arg_container& args);
+
+    /**
      * Get the standard libraries paths from the compiler.
      */
-    void get_standard_libpaths (rld::files::paths& libpaths);
+    void get_standard_libpaths (rld::path::paths& libpaths);
 
     /**
      * Get the standard libraries. Optionally add the C++ library.
      */
-    void get_standard_libs (rld::files::paths& libs,
-                            rld::files::paths& libpaths,
-                            bool               cpp = false);
+    void get_standard_libs (rld::path::paths& libs,
+                            rld::path::paths& libpaths,
+                            bool              cpp = false);
 
   }
Index: linkers/rld-files.cpp
===================================================================
--- linkers/rld-files.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-files.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -74,95 +74,4 @@
     }
 
-    std::string
-    basename (const std::string& name)
-    {
-      size_t b = name.find_last_of (RLD_PATH_SEPARATOR);
-      if (b != std::string::npos)
-        return name.substr (b + 1);
-      return name;
-    }
-
-    std::string
-    dirname (const std::string& name)
-    {
-      size_t b = name.find_last_of (RLD_PATH_SEPARATOR);
-      if (b != std::string::npos)
-        return name.substr (0, b - 1);
-      return name;
-    }
-
-    std::string
-    extension (const std::string& name)
-    {
-      size_t b = name.find_last_of ('.');
-      if (b != std::string::npos)
-        return name.substr (b);
-      return name;
-    }
-
-    void
-    path_split (const std::string& path, rld::files::paths& paths)
-    {
-      strings ps;
-      rld::split (path, ps, RLD_PATHSTR_SEPARATOR);
-      if (ps.size ())
-      {
-        for (strings::iterator psi = ps.begin ();
-             psi != ps.end ();
-             ++psi)
-        {
-          if (check_directory (*psi))
-            paths.push_back (*psi);
-        }
-      }
-    }
-
-    void
-    path_join (const std::string& path_, const std::string& file_, std::string& joined)
-    {
-      if ((path_[path_.size () - 1] != RLD_PATH_SEPARATOR) &&
-          (file_[0] != RLD_PATH_SEPARATOR))
-        joined = path_ + RLD_PATH_SEPARATOR + file_;
-      else if ((path_[path_.size () - 1] == RLD_PATH_SEPARATOR) &&
-               (file_[0] == RLD_PATH_SEPARATOR))
-        joined = path_ + &file_[1];
-      else
-        joined = path_ + file_;
-    }
-
-    bool
-    check_file (const std::string& path)
-    {
-      struct stat sb;
-      if (::stat (path.c_str (), &sb) == 0)
-        if (S_ISREG (sb.st_mode))
-          return true;
-      return false;
-    }
-
-    bool
-    check_directory (const std::string& path)
-    {
-      struct stat sb;
-      if (::stat (path.c_str (), &sb) == 0)
-        if (S_ISDIR (sb.st_mode))
-          return true;
-      return false;
-    }
-
-    void
-    find_file (std::string& path, const std::string& name, paths& search_paths)
-    {
-      for (rld::files::paths::iterator pi = search_paths.begin ();
-           pi != search_paths.end ();
-           ++pi)
-      {
-        path_join (*pi, name, path);
-        if (check_file (path))
-          return;
-      }
-      path.clear ();
-    }
-
     file::file (const std::string& aname,
                 const std::string& oname,
@@ -245,5 +154,5 @@
     file::is_valid () const
     {
-      return !aname_.empty () || ~oname_.empty ();
+      return !aname_.empty () || !oname_.empty ();
     }
 
@@ -257,5 +166,5 @@
       const std::string p = path ();
       if (!p.empty ())
-        result = check_file (p);
+        result = path::check_file (p);
       return result;
     }
@@ -289,5 +198,5 @@
     file::basename () const
     {
-      return rld::files::basename (full ());
+      return rld::path::basename (full ());
     }
 
@@ -844,5 +753,5 @@
         {
           object& obj = *(*oi);
-          const std::string&  oname = basename (obj.name ().oname ());
+          const std::string&  oname = path::basename (obj.name ().oname ());
           if (oname.length () >= rld_archive_fname_size)
             extended_file_names += oname + '\n';
@@ -869,5 +778,5 @@
           try
           {
-            std::string oname = basename (obj.name ().oname ());
+            std::string oname = path::basename (obj.name ().oname ());
 
             /*
@@ -1392,7 +1301,7 @@
 
     void
-    cache::add (paths& paths__)
-    {
-      for (paths::iterator pi = paths__.begin();
+    cache::add (path::paths& paths__)
+    {
+      for (path::paths::iterator pi = paths__.begin();
            pi != paths__.end();
            ++pi)
@@ -1401,7 +1310,7 @@
 
     void
-    cache::add_libraries (paths& paths__)
-    {
-      for (paths::iterator pi = paths__.begin();
+    cache::add_libraries (path::paths& paths__)
+    {
+      for (path::paths::iterator pi = paths__.begin();
            pi != paths__.end();
            ++pi)
@@ -1460,5 +1369,5 @@
     cache::collect_object_files ()
     {
-      for (paths::iterator ni = paths_.begin (); ni != paths_.end (); ++ni)
+      for (path::paths::iterator ni = paths_.begin (); ni != paths_.end (); ++ni)
         collect_object_files (*ni);
     }
@@ -1566,5 +1475,5 @@
     {
       list.clear ();
-      for (paths::const_iterator pi = paths_.begin ();
+      for (path::paths::const_iterator pi = paths_.begin ();
            pi != paths_.end ();
            ++pi)
@@ -1577,5 +1486,5 @@
     }
 
-    const paths&
+    const path::paths&
     cache::get_paths () const
     {
@@ -1640,10 +1549,12 @@
 
     void
-    find_libraries (paths& libraries, paths& libpaths, paths& libs)
+    find_libraries (path::paths& libraries,
+                    path::paths& libpaths,
+                    path::paths& libs)
     {
       if (rld::verbose () >= RLD_VERBOSE_INFO)
         std::cout << "Finding libraries:." << std::endl;
       libraries.clear ();
-      for (paths::size_type l = 0; l < libs.size (); ++l)
+      for (path::paths::size_type l = 0; l < libs.size (); ++l)
       {
         std::string lib = "lib" + libs[l] + ".a";
@@ -1651,11 +1562,11 @@
           std::cout << " searching: " << lib << std::endl;
         bool found = false;
-        for (paths::size_type p = 0; p < libpaths.size (); ++p)
+        for (path::paths::size_type p = 0; p < libpaths.size (); ++p)
         {
           std::string plib;
-          path_join (libpaths[p], lib, plib);
+          path::path_join (libpaths[p], lib, plib);
           if (rld::verbose () >= RLD_VERBOSE_DETAILS)
               std::cout << " checking: " << plib << std::endl;
-          if (check_file (plib))
+          if (path::check_file (plib))
           {
             if (rld::verbose () >= RLD_VERBOSE_INFO)
Index: linkers/rld-files.h
===================================================================
--- linkers/rld-files.h	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-files.h	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -39,4 +39,5 @@
 
 #include <rld.h>
+#include <rld-path.h>
 
 namespace rld
@@ -45,9 +46,4 @@
   {
     /**
-     * Container of file paths.
-     */
-    typedef std::vector < std::string > paths;
-
-    /**
      * Container of files.
      */
@@ -68,79 +64,4 @@
      */
     typedef std::list < object* > object_list;
-
-    /**
-     * Return the basename of the file name.
-     *
-     * @param name The full file name.
-     * @return std::string The basename of the file.
-     */
-    std::string basename (const std::string& name);
-
-    /**
-     * Return the dirname of the file name.
-     *
-     * @param name The full file name.
-     * @return std::string The dirname of the file.
-     */
-    std::string dirname (const std::string& name);
-
-    /**
-     * Return the extension of the file name.
-     *
-     * @param name The full file name.
-     * @return std::string The extension of the file.
-     */
-    std::string extension (const std::string& name);
-
-    /**
-     * Split a path from a string with a delimiter to the path container. Add
-     * only the paths that exist and ignore those that do not.
-     *
-     * @param path The paths as a single string delimited by the path
-     *             separator.
-     * @param paths The split path paths.
-     */
-    void path_split (const std::string& path,
-                     paths&             paths);
-
-    /**
-     * Make a path by joining the parts with required separator.
-     *
-     * @param path_ The path component to be joined.
-     * @param file_ The file name to add to the path.
-     * @param joined The joined path and file name with a path separator.
-     */
-    void path_join (const std::string& path_,
-                    const std::string& file_,
-                    std::string&       joined);
-
-    /**
-     * Check the path is a file using a stat call.
-     *
-     * @param path The path to check.
-     * @retval true The path is valid.
-     * @retval false The path is not valid.
-     */
-    bool check_file (const std::string& path);
-
-    /**
-     * Check if the path is a directory.
-     *
-     * @param path The path to check.
-     * @retval false The path is not a directory.
-     * @retval true The path is a directory.
-     */
-    bool check_directory (const std::string& path);
-
-    /**
-     * Find the file given a container of paths and file names.
-     *
-     * @param path The path of the file if found else empty.
-     * @param name The name of the file to search for.
-     * @param search_paths The container of paths to search.
-     */
-    void find_file (std::string&       path,
-                    const std::string& name,
-                    paths&             search_paths);
 
     /**
@@ -925,10 +846,10 @@
        * Add a container of path to the cache.
        */
-      void add (paths& paths__);
+      void add (path::paths& paths__);
 
       /**
        * Add a container of path to the cache.
        */
-      void add_libraries (paths& paths__);
+      void add_libraries (path::paths& paths__);
 
       /**
@@ -994,5 +915,5 @@
        * Get the paths.
        */
-      const paths& get_paths () const;
+      const path::paths& get_paths () const;
 
       /**
@@ -1039,8 +960,8 @@
 
     private:
-      paths    paths_;    //< The names of the files to process.
-      archives archives_; //< The archive files.
-      objects  objects_;  //< The object files.
-      bool     opened;    //< The cache is open.
+      path::paths paths_;    //< The names of the files to process.
+      archives    archives_; //< The archive files.
+      objects     objects_;  //< The object files.
+      bool        opened;    //< The cache is open.
     };
 
@@ -1058,5 +979,7 @@
      * have 'lib' and '.a' added.
      */
-    void find_libraries (paths& libraries, paths& libpaths, paths& libs);
+    void find_libraries (path::paths& libraries,
+                         path::paths& libpaths,
+                         path::paths& libs);
 
   }
Index: linkers/rld-outputter.cpp
===================================================================
--- linkers/rld-outputter.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-outputter.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -189,5 +189,5 @@
                   << ", dependents: " << dependents.size () << std::endl;
 
-      std::string ext = files::extension (name);
+      std::string ext = path::extension (name);
       std::string mdname =
         name.substr (0, name.length () - ext.length ()) + "-metadata.o";
Index: linkers/rld-path.cpp
===================================================================
--- linkers/rld-path.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
+++ linkers/rld-path.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2011-2014, Chris Johns <chrisj@rtems.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <algorithm>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <rld.h>
+
+namespace rld
+{
+  namespace path
+  {
+    std::string
+    basename (const std::string& name)
+    {
+      size_t b = name.find_last_of (RLD_PATH_SEPARATOR);
+      if (b != std::string::npos)
+        return name.substr (b + 1);
+      return name;
+    }
+
+    std::string
+    dirname (const std::string& name)
+    {
+      size_t b = name.find_last_of (RLD_PATH_SEPARATOR);
+      if (b != std::string::npos)
+        return name.substr (0, b - 1);
+      return name;
+    }
+
+    std::string
+    extension (const std::string& name)
+    {
+      size_t b = name.find_last_of ('.');
+      if (b != std::string::npos)
+        return name.substr (b);
+      return name;
+    }
+
+    void
+    path_split (const std::string& path, paths& paths)
+    {
+      strings ps;
+      rld::split (path, ps, RLD_PATHSTR_SEPARATOR);
+      if (ps.size ())
+      {
+        for (strings::iterator psi = ps.begin ();
+             psi != ps.end ();
+             ++psi)
+        {
+          if (check_directory (*psi))
+            paths.push_back (*psi);
+        }
+      }
+    }
+
+    void
+    path_join (const std::string& path_, const std::string& file_, std::string& joined)
+    {
+      if ((path_[path_.size () - 1] != RLD_PATH_SEPARATOR) &&
+          (file_[0] != RLD_PATH_SEPARATOR))
+        joined = path_ + RLD_PATH_SEPARATOR + file_;
+      else if ((path_[path_.size () - 1] == RLD_PATH_SEPARATOR) &&
+               (file_[0] == RLD_PATH_SEPARATOR))
+        joined = path_ + &file_[1];
+      else
+        joined = path_ + file_;
+    }
+
+    bool
+    check_file (const std::string& path)
+    {
+      struct stat sb;
+      if (::stat (path.c_str (), &sb) == 0)
+        if (S_ISREG (sb.st_mode))
+          return true;
+      return false;
+    }
+
+    bool
+    check_directory (const std::string& path)
+    {
+      struct stat sb;
+      if (::stat (path.c_str (), &sb) == 0)
+        if (S_ISDIR (sb.st_mode))
+          return true;
+      return false;
+    }
+
+    void
+    find_file (std::string& path, const std::string& name, paths& search_paths)
+    {
+      for (paths::iterator pi = search_paths.begin ();
+           pi != search_paths.end ();
+           ++pi)
+      {
+        path_join (*pi, name, path);
+        if (check_file (path))
+          return;
+      }
+      path.clear ();
+    }
+
+  }
+}
Index: linkers/rld-path.h
===================================================================
--- linkers/rld-path.h	(revision 40fd7a088afe6df7f65058619f660640506ee581)
+++ linkers/rld-path.h	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2011-2014, Chris Johns <chrisj@rtems.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * @file
+ *
+ * @ingroup rtems-ld
+ *
+ * @brief RTEMS Linker Path to help manage paths.
+ *
+ */
+
+#if !defined (_RLD_PATH_H_)
+#define _RLD_PATH_H_
+
+#include <list>
+#include <map>
+#include <string>
+#include <vector>
+
+#include <rld.h>
+
+namespace rld
+{
+  namespace path
+  {
+    /**
+     * Container of file paths.
+     */
+    typedef std::vector < std::string > paths;
+
+    /**
+     * Return the basename of the file name.
+     *
+     * @param name The full file name.
+     * @return std::string The basename of the file.
+     */
+    std::string basename (const std::string& name);
+
+    /**
+     * Return the dirname of the file name.
+     *
+     * @param name The full file name.
+     * @return std::string The dirname of the file.
+     */
+    std::string dirname (const std::string& name);
+
+    /**
+     * Return the extension of the file name.
+     *
+     * @param name The full file name.
+     * @return std::string The extension of the file.
+     */
+    std::string extension (const std::string& name);
+
+    /**
+     * Split a path from a string with a delimiter to the path container. Add
+     * only the paths that exist and ignore those that do not.
+     *
+     * @param path The paths as a single string delimited by the path
+     *             separator.
+     * @param paths The split path paths.
+     */
+    void path_split (const std::string& path,
+                     paths&             paths);
+
+    /**
+     * Make a path by joining the parts with required separator.
+     *
+     * @param path_ The path component to be joined.
+     * @param file_ The file name to add to the path.
+     * @param joined The joined path and file name with a path separator.
+     */
+    void path_join (const std::string& path_,
+                    const std::string& file_,
+                    std::string&       joined);
+
+    /**
+     * Check the path is a file using a stat call.
+     *
+     * @param path The path to check.
+     * @retval true The path is valid.
+     * @retval false The path is not valid.
+     */
+    bool check_file (const std::string& path);
+
+    /**
+     * Check if the path is a directory.
+     *
+     * @param path The path to check.
+     * @retval false The path is not a directory.
+     * @retval true The path is a directory.
+     */
+    bool check_directory (const std::string& path);
+
+    /**
+     * Find the file given a container of paths and file names.
+     *
+     * @param path The path of the file if found else empty.
+     * @param name The name of the file to search for.
+     * @param search_paths The container of paths to search.
+     */
+    void find_file (std::string&       path,
+                    const std::string& name,
+                    paths&             search_paths);
+
+  }
+}
+
+#endif
Index: linkers/rld-process.cpp
===================================================================
--- linkers/rld-process.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-process.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -161,5 +161,5 @@
     tempfile::open (bool writable)
     {
-      if ((fd < 0) && rld::files::check_file (_name))
+      if ((fd < 0) && rld::path::check_file (_name))
       {
         level = 0;
Index: linkers/rld-resolver.cpp
===================================================================
--- linkers/rld-resolver.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rld-resolver.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -58,5 +58,5 @@
                      const std::string&  fullname)
     {
-      const std::string name = files::basename (fullname);
+      const std::string name = path::basename (fullname);
 
       static int nesting = 0;
Index: linkers/rtems-ld.cpp
===================================================================
--- linkers/rtems-ld.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rtems-ld.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -69,6 +69,5 @@
   { "cc",          required_argument,      NULL,           'C' },
   { "exec-prefix", required_argument,      NULL,           'E' },
-  { "march",       required_argument,      NULL,           'a' },
-  { "mcpu",        required_argument,      NULL,           'c' },
+  { "cflags",      required_argument,      NULL,           'c' },
   { "rap-strip",   no_argument,            NULL,           'S' },
   { "rpath",       required_argument,      NULL,           'R' },
@@ -113,6 +112,5 @@
             << " -C file   : execute file as the target C compiler (also --cc)" << std::endl
             << " -E prefix : the RTEMS tool prefix (also --exec-prefix)" << std::endl
-            << " -a march  : machine architecture (also --march)" << std::endl
-            << " -c cpu    : machine architecture's CPU (also --mcpu)" << std::endl
+            << " -c cflags : C compiler flags (also --cflags)" << std::endl
             << " -S        : do not include file details (also --rap-strip)" << std::endl
             << " -R        : include file paths (also --rpath)" << std::endl
@@ -174,8 +172,8 @@
     rld::files::cache    base;
     rld::files::cache    cachera;
-    rld::files::paths    libpaths;
-    rld::files::paths    libs;
-    rld::files::paths    objects;
-    rld::files::paths    libraries;
+    rld::path::paths     libpaths;
+    rld::path::paths     libs;
+    rld::path::paths     objects;
+    rld::path::paths     libraries;
     rld::symbols::bucket defines;
     rld::symbols::bucket undefines;
@@ -200,5 +198,5 @@
     while (true)
     {
-      int opt = ::getopt_long (argc, argv, "hvwVMnsSb:E:o:O:L:l:a:c:e:d:u:C:W:R:P:", rld_opts, NULL);
+      int opt = ::getopt_long (argc, argv, "hvwVMnsSb:E:o:O:L:l:c:e:d:u:C:W:R:P:", rld_opts, NULL);
       if (opt < 0)
         break;
@@ -275,10 +273,6 @@
           break;
 
-        case 'a':
-          rld::cc::march = optarg;
-          break;
-
         case 'c':
-          rld::cc::mcpu = optarg;
+          rld::cc::cflags = optarg;
           break;
 
@@ -476,5 +470,5 @@
           if (!outra.empty ())
           {
-            rld::files::paths ra_libs;
+            rld::path::paths ra_libs;
             bool ra_exist = false;
 
Index: linkers/rtems-ra.cpp
===================================================================
--- linkers/rtems-ra.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rtems-ra.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -100,6 +100,5 @@
             << " -C file   : execute file as the target C compiler (also --cc)" << std::endl
             << " -E prefix : the RTEMS tool prefix (also --exec-prefix)" << std::endl
-            << " -a march  : machine architecture (also --march)" << std::endl
-            << " -c cpu    : machine architecture's CPU (also --mcpu)" << std::endl
+            << " -c cflags : C compiler flags (also --cflags)" << std::endl
             << " -S        : do not include file details (also --rap-strip)" << std::endl
             << " -R        : include file paths (also --rpath)" << std::endl
@@ -156,11 +155,11 @@
   try
   {
-    rld::files::paths       libpaths;
-    rld::files::paths       libs;
-    rld::files::paths       libraries;
-    rld::files::paths       outra;
-    rld::files::paths       raps_add;
-    rld::files::paths       raps_replace;
-    rld::files::paths       raps_delete;
+    rld::path::paths        libpaths;
+    rld::path::paths        libs;
+    rld::path::paths        libraries;
+    rld::path::paths        outra;
+    rld::path::paths        raps_add;
+    rld::path::paths        raps_replace;
+    rld::path::paths        raps_delete;
     std::string             cc_name;
     std::string             entry;
@@ -253,10 +252,6 @@
           break;
 
-        case 'a':
-          rld::cc::march = optarg;
-          break;
-
         case 'c':
-          rld::cc::mcpu = optarg;
+          rld::cc::cflags = optarg;
           break;
 
@@ -326,9 +321,9 @@
       * Convert ar file to ra file
       */
-      for (rld::files::paths::iterator p = libraries.begin (); p != libraries.end (); ++p)
+      for (rld::path::paths::iterator p = libraries.begin (); p != libraries.end (); ++p)
       {
-        rld::files::paths    library;
-        rld::symbols::table  symbols;
-        rld::files::cache*   cache = new rld::files::cache ();
+        rld::path::paths    library;
+        rld::symbols::table symbols;
+        rld::files::cache*  cache = new rld::files::cache ();
 
         library.clear ();
@@ -351,5 +346,5 @@
 
           rld::files::objects& objs = cache->get_objects ();
-          rld::files::paths    raobjects;
+          rld::path::paths     raobjects;
 
           int pos = -1;
@@ -385,5 +380,5 @@
 
           dependents.clear ();
-          for (rld::files::paths::iterator ni = raobjects.begin (); ni != raobjects.end (); ++ni)
+          for (rld::path::paths::iterator ni = raobjects.begin (); ni != raobjects.end (); ++ni)
           {
             rld::files::object* obj = new rld::files::object (*ni);
@@ -391,8 +386,8 @@
           }
 
-          bool ra_rap = true;
-          bool ra_exist = false;
+          bool              ra_rap = true;
+          bool              ra_exist = false;
           rld::files::cache cachera;
-          std::string raname = *p;
+          std::string       raname = *p;
 
           pos = -1;
@@ -441,8 +436,8 @@
       * Add, replace, delete files from the ra file.
       */
-      for (rld::files::paths::iterator pl = libs.begin (); pl != libs.end (); ++pl)
+      for (rld::path::paths::iterator pl = libs.begin (); pl != libs.end (); ++pl)
       {
-        rld::files::paths    library;
-        rld::files::cache*   cache = new rld::files::cache ();
+        rld::path::paths   library;
+        rld::files::cache* cache = new rld::files::cache ();
 
         library.clear ();
@@ -460,8 +455,8 @@
 
         rld::files::objects& objs = cache->get_objects ();
-        rld::files::paths    raobjects;
+        rld::path::paths     raobjects;
 
         std::string rap_name;
-        bool rap_delete = false;
+        bool        rap_delete = false;
 
         dependents.clear ();
@@ -478,5 +473,5 @@
           rap_delete = false;
 
-          for (rld::files::paths::iterator pa = raps_delete.begin ();
+          for (rld::path::paths::iterator pa = raps_delete.begin ();
                pa != raps_delete.end ();
                ++pa)
@@ -496,7 +491,8 @@
          * Add rap files into ra file, add supports replace.
          */
-        bool rap_exist = false;
-        rld::files::paths rap_objects;
-        for (rld::files::paths::iterator pa = raps_add.begin ();
+        rld::path::paths rap_objects;
+        bool             rap_exist = false;
+
+        for (rld::path::paths::iterator pa = raps_add.begin ();
              pa != raps_add.end ();
              ++pa)
@@ -521,5 +517,5 @@
         }
 
-        for (rld::files::paths::iterator pa = rap_objects.begin ();
+        for (rld::path::paths::iterator pa = rap_objects.begin ();
              pa != rap_objects.end ();
              ++pa)
@@ -537,11 +533,11 @@
          * Replace rap files in ra file
          */
-        bool rap_replace = false;
         rld::files::cache cachera;
+        bool              rap_replace = false;
 
         rap_objects.clear ();
         cachera.open ();
 
-        for (rld::files::paths::iterator pa = raps_replace.begin ();
+        for (rld::path::paths::iterator pa = raps_replace.begin ();
              pa != raps_replace.end ();
              ++pa)
@@ -567,5 +563,5 @@
         }
 
-        for (rld::files::paths::iterator pa = rap_objects.begin ();
+        for (rld::path::paths::iterator pa = rap_objects.begin ();
              pa != rap_objects.end ();
              ++pa)
Index: linkers/rtems-rapper.cpp
===================================================================
--- linkers/rtems-rapper.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rtems-rapper.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -639,5 +639,5 @@
   {
     std::string name = image.name ().full ();
-    std::string extension = rld::files::extension (image.name ().full ());
+    std::string extension = rld::path::extension (image.name ().full ());
 
     name = name.substr (0, name.size () - extension.size ()) + ".xrap";
@@ -704,15 +704,15 @@
 
 void
-rap_show (rld::files::paths& raps,
-          bool               warnings,
-          bool               show_header,
-          bool               show_machine,
-          bool               show_layout,
-          bool               show_strings,
-          bool               show_symbols,
-          bool               show_relocs,
-          bool               show_details)
+rap_show (rld::path::paths& raps,
+          bool              warnings,
+          bool              show_header,
+          bool              show_machine,
+          bool              show_layout,
+          bool              show_strings,
+          bool              show_symbols,
+          bool              show_relocs,
+          bool              show_details)
 {
-  for (rld::files::paths::iterator pi = raps.begin();
+  for (rld::path::paths::iterator pi = raps.begin();
        pi != raps.end();
        ++pi)
@@ -961,8 +961,8 @@
 
 void
-rap_overlay (rld::files::paths& raps, bool warnings)
+rap_overlay (rld::path::paths& raps, bool warnings)
 {
   std::cout << "Overlay .... " << std::endl;
-  for (rld::files::paths::iterator pi = raps.begin();
+  for (rld::path::paths::iterator pi = raps.begin();
        pi != raps.end();
        ++pi)
@@ -1051,8 +1051,8 @@
 
 void
-rap_expander (rld::files::paths& raps, bool warnings)
+rap_expander (rld::path::paths& raps, bool warnings)
 {
   std::cout << "Expanding .... " << std::endl;
-  for (rld::files::paths::iterator pi = raps.begin();
+  for (rld::path::paths::iterator pi = raps.begin();
        pi != raps.end();
        ++pi)
@@ -1150,16 +1150,16 @@
   try
   {
-    rld::files::paths raps;
-    bool              warnings = true;
-    bool              show = false;
-    bool              show_header = false;
-    bool              show_machine = false;
-    bool              show_layout = false;
-    bool              show_strings = false;
-    bool              show_symbols = false;
-    bool              show_relocs = false;
-    bool              show_details = false;
-    bool              overlay = false;
-    bool              expand = false;
+    rld::path::paths raps;
+    bool             warnings = true;
+    bool             show = false;
+    bool             show_header = false;
+    bool             show_machine = false;
+    bool             show_layout = false;
+    bool             show_strings = false;
+    bool             show_symbols = false;
+    bool             show_relocs = false;
+    bool             show_details = false;
+    bool             overlay = false;
+    bool             expand = false;
 
     while (true)
Index: linkers/rtems-syms.cpp
===================================================================
--- linkers/rtems-syms.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rtems-syms.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -83,6 +83,5 @@
             << " -C file   : execute file as the target C compiler (also --cc)" << std::endl
             << " -E prefix : the RTEMS tool prefix (also --exec-prefix)" << std::endl
-            << " -a march  : machine architecture (also --march)" << std::endl
-            << " -c cpu    : machine architecture's CPU (also --mcpu)" << std::endl;
+            << " -c cflags : C compiler flags (also --cflags)" << std::endl;
   ::exit (exit_code);
 }
@@ -132,8 +131,8 @@
   {
     rld::files::cache   cache;
-    rld::files::paths   libpaths;
-    rld::files::paths   libs;
-    rld::files::paths   objects;
-    rld::files::paths   libraries;
+    rld::path::paths    libpaths;
+    rld::path::paths    libs;
+    rld::path::paths    objects;
+    rld::path::paths    libraries;
     rld::symbols::table symbols;
     std::string         base_name;
@@ -149,5 +148,5 @@
     while (true)
     {
-      int opt = ::getopt_long (argc, argv, "hvwVSE:L:l:a:c:C:", rld_opts, NULL);
+      int opt = ::getopt_long (argc, argv, "hvwVSE:L:l:c:C:", rld_opts, NULL);
       if (opt < 0)
         break;
@@ -200,10 +199,6 @@
           break;
 
-        case 'a':
-          rld::cc::march = optarg;
-          break;
-
         case 'c':
-          rld::cc::mcpu = optarg;
+          rld::cc::cflags = optarg;
           break;
 
Index: linkers/rtems-tld.cpp
===================================================================
--- linkers/rtems-tld.cpp	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/rtems-tld.cpp	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -756,6 +756,5 @@
             << " -k        : keep temporary files (also --keep)" << std::endl
             << " -E prefix : the RTEMS tool prefix (also --exec-prefix)" << std::endl
-            << " -a march  : machine architecture (also --march)" << std::endl
-            << " -c cpu    : machine architecture's CPU (also --mcpu)" << std::endl
+            << " -c cflags : C compiler flags (also --cflags)" << std::endl
             << " -C ini    : user configuration INI file (also --config)" << std::endl;
   ::exit (exit_code);
@@ -816,5 +815,5 @@
     while (true)
     {
-      int opt = ::getopt_long (argc, argv, "hvwkVE:a:c:C:", rld_opts, NULL);
+      int opt = ::getopt_long (argc, argv, "hvwkVE:c:C:", rld_opts, NULL);
       if (opt < 0)
         break;
@@ -847,10 +846,6 @@
           break;
 
-        case 'a':
-          rld::cc::march = optarg;
-          break;
-
         case 'c':
-          rld::cc::mcpu = optarg;
+          rld::cc::cflags = optarg;
           break;
 
Index: linkers/wscript
===================================================================
--- linkers/wscript	(revision e5165d2d0a02443f82198ec00459bfbc4c150709)
+++ linkers/wscript	(revision 40fd7a088afe6df7f65058619f660640506ee581)
@@ -101,4 +101,5 @@
                   'rld-compression.cpp',
                   'rld-outputter.cpp',
+                  'rld-path.cpp',
                   'rld-process.cpp',
                   'rld-resolver.cpp',
