[patch] gccld not properly constructing paths when checking for bytecode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] gccld not properly constructing paths when checking for bytecode

Nicholas Riley
I was getting some weird errors from gccld and traced it to path
construction in isBytecodeLPath.  If the path doesn't end with a /,
then Path just tries to stick filenames onto it, which is not so good.
It would be more efficient to just add a "/" to the path once, I
guess.

Also, I had to touch lib/System/Path.cpp to get my changes to Path.inc
noticed; it seems the build system might need a bit of tweaking.

Here's a patch:

Index: lib/System/Unix/Path.inc
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/System/Unix/Path.inc,v
retrieving revision 1.43
diff -r1.43 Path.inc
436c436,439
<   DIR* direntries = ::opendir(path.c_str());
---
>   std::string dirPath = path;
>   if (dirPath[dirPath.size() - 1] != '/')
>     dirPath += '/';
>   DIR* direntries = ::opendir(dirPath.c_str());
444c447
<       Path aPath(path + (const char*)de->d_name);
---
>       Path aPath(dirPath + (const char*)de->d_name);

--
Nicholas Riley <[hidden email]> | <http://www.uiuc.edu/ph/www/njriley>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: [patch] gccld not properly constructing paths when checking for bytecode

Reid Spencer
Nicholas,

Your patch (more or less) was applied today. Thanks for finding this!
The patch applied is here:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050725/027268.html

Thanks,

Reid.

On Wed, 2005-07-27 at 23:13 -0500, Nicholas Riley wrote:

> I was getting some weird errors from gccld and traced it to path
> construction in isBytecodeLPath.  If the path doesn't end with a /,
> then Path just tries to stick filenames onto it, which is not so good.
> It would be more efficient to just add a "/" to the path once, I
> guess.
>
> Also, I had to touch lib/System/Path.cpp to get my changes to Path.inc
> noticed; it seems the build system might need a bit of tweaking.
>
> Here's a patch:
>
> Index: lib/System/Unix/Path.inc
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/System/Unix/Path.inc,v
> retrieving revision 1.43
> diff -r1.43 Path.inc
> 436c436,439
> <   DIR* direntries = ::opendir(path.c_str());
> ---
> >   std::string dirPath = path;
> >   if (dirPath[dirPath.size() - 1] != '/')
> >     dirPath += '/';
> >   DIR* direntries = ::opendir(dirPath.c_str());
> 444c447
> <       Path aPath(path + (const char*)de->d_name);
> ---
> >       Path aPath(dirPath + (const char*)de->d_name);
>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

signature.asc (196 bytes) Download Attachment