Index: /trunk/src/emx/include/InnoTekLIBC/backend.h
===================================================================
--- /trunk/src/emx/include/InnoTekLIBC/backend.h	(revision 1522)
+++ /trunk/src/emx/include/InnoTekLIBC/backend.h	(revision 1523)
@@ -134,7 +134,14 @@
  * @param   pszBuf      Where to store the resolved path.
  * @param   cchBuf      Size of the buffer.
- * @param   fFlags      At the moment 0. Which means the entire path must exist.
+ * @param   fFlags      Combination of __LIBC_BACKFS_FLAGS_RESOLVE_* defines.
  */
 int __libc_Back_fsPathResolve(const char *pszPath, char *pszBuf, size_t cchBuf, unsigned fFlags);
+/** Flags for __libc_Back_fsPathResolve().
+ * @{ */
+#define __LIBC_BACKFS_FLAGS_RESOLVE_FULL    0
+/** Get the native path instead, no unix root translations. */
+#define __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE  0x10
+/** @} */
+
 
 /**
Index: /trunk/src/emx/include/stdlib.h
===================================================================
--- /trunk/src/emx/include/stdlib.h	(revision 1522)
+++ /trunk/src/emx/include/stdlib.h	(revision 1523)
@@ -292,4 +292,6 @@
 #ifdef __BSD_VISIBLE
 char    *_getcwdux(char *, size_t);
+/* todo: int     _chdirux(char *); */
+char	*_realrealpath(const char *, char *, size_t);
 #endif
 #ifdef  __USE_GNU
Index: /trunk/src/emx/src/emxomf/emxomfld.c
===================================================================
--- /trunk/src/emx/src/emxomf/emxomfld.c	(revision 1522)
+++ /trunk/src/emx/src/emxomf/emxomfld.c	(revision 1523)
@@ -803,5 +803,5 @@
      * Make abspath with slashes the desired way and such.
      */
-    if (_abspath(pszFullname, pszName, _MAX_PATH + 1))
+    if (!_realrealpath(pszName, pszFullname, _MAX_PATH + 1))
     {
         printf("emxomfld: _abspath failed on '%s'!!!\n", pszName);
@@ -962,4 +962,5 @@
                 if (phFile)
                 {
+                    char *pszTmp;
                     if (autoconvert_flag)
                     {
@@ -968,4 +969,12 @@
                         else if (!check_omf(phFile))
                             phFile = aout_to_omf(phFile, pszFullname, TRUE);
+                    }
+
+                    /* Get the real native path. */
+                    pszTmp = _realrealpath(pszFullname, NULL, 0);
+                    if (pszTmp)
+                    {
+                        strcpy(pszFullname, pszTmp);
+                        free(pszTmp);
                     }
 
@@ -1103,7 +1112,23 @@
         rc = WLDGenerateWeakAliases (pwld, weakobj_fname, weakdef_fname);
       if (!rc && weakobj_fname[0])
-        add_name_list (&add_obj_fnames, weakobj_fname, 0);
+        {
+          char *pszTmp = _realrealpath(weakobj_fname, NULL, 0);
+          if (pszTmp)
+          {
+              strcpy(weakobj_fname, pszTmp);
+              free(pszTmp);
+          }
+          add_name_list (&add_obj_fnames, weakobj_fname, 0);
+        }
       if (!rc && weakdef_fname[0])
-        def_fname = weakdef_fname;
+        {
+          char *pszTmp = _realrealpath(weakdef_fname, NULL, 0);
+          if (pszTmp)
+          {
+              strcpy(weakdef_fname, pszTmp);
+              free(pszTmp);
+          }
+          def_fname = weakdef_fname;
+        }
 
       /* cleanup the linker */
@@ -1424,5 +1449,7 @@
                   usage ();
                 }
-              def_fname = optarg;
+              def_fname = _realrealpath(optarg, NULL, 0);
+              if (!def_fname)
+                def_fname = optarg;
             }
 
@@ -1438,5 +1465,7 @@
                   usage ();
                 }
-              res_fname = optarg;
+              res_fname = _realrealpath(optarg, NULL, 0);
+              if (!def_fname)
+                res_fname = optarg;
             }
 
Index: /trunk/src/emx/src/lib/libc.def
===================================================================
--- /trunk/src/emx/src/lib/libc.def	(revision 1522)
+++ /trunk/src/emx/src/lib/libc.def	(revision 1523)
@@ -1190,2 +1190,3 @@
     "___libc_Back_fsDriveDefaultGet" @1210
     "___libc_Back_fsDriveDefaultSet" @1211
+    "__realrealpath" @1212
Index: /trunk/src/emx/src/lib/misc/_realrealpath.c
===================================================================
--- /trunk/src/emx/src/lib/misc/_realrealpath.c	(revision 1523)
+++ /trunk/src/emx/src/lib/misc/_realrealpath.c	(revision 1523)
@@ -0,0 +1,88 @@
+/* $Id$ */
+/** @file
+ *
+ * _realrealpath().
+ *
+ * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
+ *
+ *
+ * This file is part of InnoTek LIBC.
+ *
+ * InnoTek LIBC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * InnoTek LIBC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with InnoTek LIBC; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "libc-alias.h"
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/syslimits.h>
+#include <InnoTekLIBC/backend.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
+#include <InnoTekLIBC/logstrict.h>
+
+
+/**
+ * Gets the absolute native path. This is used when path and such is passed on to
+ * non libc processes.
+ *
+ * @returns Pointer to the resolved path.
+ * @returns NULL and errno on failure.
+ * @param   pszPath     The path to resolve
+ * @param   pszResolved Where to put the resolved path.
+ *                      If NULL a fitting buffer is malloc'ed.
+ * @param   cchResolved Size of the passed in buffer. Minimum size of an allocated buffer.
+ */
+char	*_realrealpath(const char *pszPath, char *pszResolved, size_t cchResolved)
+{
+    LIBCLOG_ENTER("pszPath=%p:{%s} pszResolved=%p cchResolved=%d\n", (void *)pszPath, pszPath, pszResolved, cchResolved);
+
+    int rc;
+    if (!pszResolved)
+    {
+        char *psz = malloc(PATH_MAX);
+        if (psz)
+        {
+            rc = __libc_Back_fsPathResolve(pszPath, psz, PATH_MAX, __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE);
+            if (!rc)
+            {
+                char *pszOld = psz;
+                int cch = strlen(psz) + 1;
+                if (cch < cchResolved)
+                    cch = cchResolved;
+                psz = realloc(psz, cch);
+                if (!psz)
+                    psz = pszOld;
+                LIBCLOG_RETURN_MSG(psz, "ret %p:{%s}\n", psz, psz);
+            }
+            free(psz);
+        }
+        else
+            rc = -ENOMEM;
+    }
+    else
+    {
+        rc = __libc_Back_fsPathResolve(pszPath, pszResolved, cchResolved, __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE);
+        if (!rc)
+            LIBCLOG_RETURN_MSG(pszResolved, "ret %p:{%s}\n", pszResolved, pszResolved);
+    }
+
+    errno = -rc;
+    LIBCLOG_RETURN_P(NULL);
+}
+
Index: /trunk/src/emx/src/lib/misc/realpath.c
===================================================================
--- /trunk/src/emx/src/lib/misc/realpath.c	(revision 1522)
+++ /trunk/src/emx/src/lib/misc/realpath.c	(revision 1523)
@@ -69,8 +69,8 @@
                 LIBCLOG_RETURN_MSG(psz, "ret %p:{%s}\n", psz, psz);
             }
+            free(psz);
         }
         else
             rc = -ENOMEM;
-        free(psz);
     }
     else
Index: /trunk/src/emx/src/lib/sys/b_fsPathResolve.c
===================================================================
--- /trunk/src/emx/src/lib/sys/b_fsPathResolve.c	(revision 1522)
+++ /trunk/src/emx/src/lib/sys/b_fsPathResolve.c	(revision 1523)
@@ -34,4 +34,5 @@
 #include <os2emx.h>
 #include "fs.h"
+#include <errno.h>
 #include <string.h>
 #include <InnoTekLIBC/backend.h>
@@ -49,5 +50,5 @@
  * @param   pszBuf      Where to store the resolved path.
  * @param   cchBuf      Size of the buffer.
- * @param   fFlags      At the moment 0. Which means the entire path must exist.
+ * @param   fFlags      Combination of __LIBC_BACKFS_FLAGS_RESOLVE_* defines.
  */
 int __libc_Back_fsPathResolve(const char *pszPath, char *pszBuf, size_t cchBuf, unsigned fFlags)
@@ -69,5 +70,5 @@
     {
         char *pszSrc = &szNativePath[0];
-        if (fInUnixTree)
+        if (!(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) && fInUnixTree)
         {
             pszSrc += __libc_gcchUnixRoot;
@@ -79,8 +80,9 @@
         if (cch < cchBuf)
         {
-            /** @todo use DosFindFirst to get the correctly cased path. */
             memcpy(pszBuf, pszSrc, cchBuf);
             LIBCLOG_RETURN_MSG(0, "ret 0 pszPath=%p:{%s}\n", (void *)pszPath, pszPath);
         }
+        else
+            rc = -ERANGE;
     }
     else
