I suggest a bit more simple approach - do not build a dynamic linker paths from sub-strings at all and return a whole string. In fact I was almost ready to commit this fix 5 minutes ago :)
On Wed, Jun 25, 2014 at 8:54 AM, NAKAMURA Takumi <[email protected]> wrote: > Ah, my fix was not right. It should be rewritten with SmallString or > std::string. > > It apparently fixed (for me) > http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/9035 > > Thanks for noticing. g2g. > > 2014-06-25 13:51 GMT+09:00 David Blaikie <[email protected]>: >> On Tue, Jun 24, 2014 at 9:34 PM, NAKAMURA Takumi <[email protected]> >> wrote: >>> Author: chapuni >>> Date: Tue Jun 24 23:34:20 2014 >>> New Revision: 211663 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=211663&view=rev >>> Log: >>> Tools.cpp: Update getLinuxDynamicLinker() to return Twine instead of >>> StringRef, since r211598 has introduced manipulation of return string. >> >> Returning a Twine is risky business (if the expression returned is >> anything more than a single Twine then the Twine subexpressions will >> be destroyed at the end of the function, leaving the top level Twine >> dangling) - was this change fixing a compilation error? What was the >> error? >> >>> >>> Modified: >>> cfe/trunk/lib/Driver/Tools.cpp >>> >>> Modified: cfe/trunk/lib/Driver/Tools.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=211663&r1=211662&r2=211663&view=diff >>> ============================================================================== >>> --- cfe/trunk/lib/Driver/Tools.cpp (original) >>> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jun 24 23:34:20 2014 >>> @@ -6929,8 +6929,8 @@ static void AddLibgcc(const llvm::Triple >>> CmdArgs.push_back("-ldl"); >>> } >>> >>> -static StringRef getLinuxDynamicLinker(const ArgList &Args, >>> - const toolchains::Linux &ToolChain) >>> { >>> +static Twine getLinuxDynamicLinker(const ArgList &Args, >>> + const toolchains::Linux &ToolChain) { >>> if (ToolChain.getTriple().getEnvironment() == llvm::Triple::Android) { >>> if (ToolChain.getTriple().isArch64Bit()) >>> return "/system/bin/linker64"; >>> @@ -6964,7 +6964,7 @@ static StringRef getLinuxDynamicLinker(c >>> return "/lib/ld.so.1"; >>> } else if (ToolChain.getArch() == llvm::Triple::mips64 || >>> ToolChain.getArch() == llvm::Triple::mips64el) { >>> - std::string LinkerFile = >>> + Twine LinkerFile = >>> mips::isNaN2008(Args) ? "ld-linux-mipsn8.so.1" : "ld.so.1"; >>> if (mips::hasMipsAbiArg(Args, "n32")) >>> return "/lib32/" + LinkerFile; >>> >>> >>> _______________________________________________ >>> cfe-commits mailing list >>> [email protected] >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits -- Simon Atanasyan _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
