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

Nicholas Riley njriley at uiuc.edu
Wed Jul 27 21:13:02 PDT 2005


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 <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>




More information about the llvm-dev mailing list