When checking for duplicated modules use absolute library paths
[fw/sdcc] / link / z80 / lklibr.c
index c712d6745f7cad74f7d3ca8914f818557a27ffe3..4c1881ac47366e9793ea13ae0bdf7b08e17ba7b0 100644 (file)
@@ -577,8 +577,20 @@ int fndsym( char *name )
                 }
                 else
                 {
-                    if( !( EQ(FirstFound->libspc, ThisLibr->libspc) && 
-                           EQ(FirstFound->relfil, ThisLibr->relfil) ) )
+                    char absPath1[PATH_MAX];
+                    char absPath2[PATH_MAX];
+#if defined(__BORLANDC__) || defined(_MSC_VER)
+                    int j;
+
+                    _fullpath(absPath1, FirstFound->libspc, PATH_MAX);
+                    _fullpath(absPath2, ThisLibr->libspc, PATH_MAX);
+                    for(j=0; absPath1[j]!=0; j++) absPath1[j]=tolower(absPath1[j]);
+                    for(j=0; absPath2[j]!=0; j++) absPath2[j]=tolower(absPath2[j]);
+#else
+                    realpath(FirstFound->libspc, absPath1);
+                    realpath(ThisLibr->libspc, absPath2);
+#endif
+                    if( !( EQ(absPath1, absPath2) && EQ(FirstFound->relfil, ThisLibr->relfil) ) )
                     {
                         if(numfound==1)
                         {