vapier | 2 Apr 2011 19:36
Favicon

[5368] trunk/elf2flt/ld-elf2flt.c: elf2flt: fix running on Windows systems

Revision 5368 Author vapier Date 2011-04-02 13:36:20 -0400 (Sat, 02 Apr 2011)

Log Message

elf2flt: fix running on Windows systems the attached patch is needed for the recent elf2flt on MinGW builds. The stat() cannot cope with directories ending with the directory separator.

Modified Paths

Diff

Modified: trunk/elf2flt/ld-elf2flt.c (5367 => 5368)

--- trunk/elf2flt/ld-elf2flt.c 2011-04-02 07:15:17 UTC (rev 5367) +++ trunk/elf2flt/ld-elf2flt.c 2011-04-02 17:36:20 UTC (rev 5368) <at> <at> -506,13 +506,15 <at> <at> Make bindir point to the bin dir for bin/<TARGET_ALIAS>-foo. Make tooldir point to the bin dir for <TARGET_ALIAS>/bin/foo. */ if (streqn(elf2flt_progname, TARGET_ALIAS)) { - tmp = concat(argv0_dir, "../" TARGET_ALIAS "/bin/", NULL); - if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) - tooldir = tmp; + tmp = concat(argv0_dir, "../" TARGET_ALIAS "/bin", NULL); + if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) { + tooldir = concat(tmp, "/", NULL); + } } else { - tmp = concat(argv0_dir, "../../bin/", NULL); - if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) - bindir = tmp; + tmp = concat(argv0_dir, "../../bin", NULL); + if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) { + bindir = concat(tmp, "/", NULL); + } } /* Typically ld-elf2flt is invoked as `ld` which means error
<div>

<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/toolchain/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=toolchain&amp;revision=5368">5368</a>
Author <a href="http://blackfin.uclinux.org/gf/user/vapier/">vapier</a>
Date 2011-04-02 13:36:20 -0400 (Sat, 02 Apr 2011)
<h3>Log Message</h3>
elf2flt: fix running on Windows systems

the attached patch is needed for the recent elf2flt
on MinGW builds. The stat() cannot cope with directories
ending with the directory separator.

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkelf2fltldelf2fltc">trunk/elf2flt/ld-elf2flt.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/elf2flt/ld-elf2flt.c (5367 =&gt; 5368)</h4>
<span>
<span class="info">--- trunk/elf2flt/ld-elf2flt.c	2011-04-02 07:15:17 UTC (rev 5367)
+++ trunk/elf2flt/ld-elf2flt.c	2011-04-02 17:36:20 UTC (rev 5368)
</span><span class="lines"> <at>  <at>  -506,13 +506,15  <at>  <at> 
</span><span class="cx"> 	   Make bindir point to the bin dir for bin/&lt;TARGET_ALIAS&gt;-foo.
</span><span class="cx"> 	   Make tooldir point to the bin dir for &lt;TARGET_ALIAS&gt;/bin/foo.  */
</span><span class="cx"> 	if (streqn(elf2flt_progname, TARGET_ALIAS)) {
</span>-		tmp = concat(argv0_dir, "../" TARGET_ALIAS "/bin/", NULL);
-		if (stat(tmp, &amp;buf) == 0 &amp;&amp; S_ISDIR(buf.st_mode))
-			tooldir = tmp;
+		tmp = concat(argv0_dir, "../" TARGET_ALIAS "/bin", NULL);
+		if (stat(tmp, &amp;buf) == 0 &amp;&amp; S_ISDIR(buf.st_mode)) {
+			tooldir = concat(tmp, "/", NULL);
+		}
<span class="cx"> 	} else {
</span>-		tmp = concat(argv0_dir, "../../bin/", NULL);
-		if (stat(tmp, &amp;buf) == 0 &amp;&amp; S_ISDIR(buf.st_mode))
-			bindir = tmp;
+		tmp = concat(argv0_dir, "../../bin", NULL);
+		if (stat(tmp, &amp;buf) == 0 &amp;&amp; S_ISDIR(buf.st_mode)) {
+			bindir = concat(tmp, "/", NULL);
+		}
<span class="cx"> 	}
</span><span class="cx"> 
</span><span class="cx"> 	/* Typically ld-elf2flt is invoked as `ld` which means error
</span></span>
</div>
</div>

</div>

Gmane