@@ -97,9 +97,9 @@ std::string Linux::getMultiarchTriple(const Driver &D,
97
97
case llvm::Triple::mips64: {
98
98
std::string MT = std::string (IsMipsR6 ? " mipsisa64r6" : " mips64" ) +
99
99
" -linux-" + (IsMipsN32Abi ? " gnuabin32" : " gnuabi64" );
100
- if (D.getVFS ().exists (SysRoot + " /lib/ " + MT ))
100
+ if (D.getVFS ().exists (concat ( SysRoot, " /lib" , MT) ))
101
101
return MT;
102
- if (D.getVFS ().exists (SysRoot + " /lib/mips64-linux-gnu" ))
102
+ if (D.getVFS ().exists (concat ( SysRoot, " /lib/mips64-linux-gnu" ) ))
103
103
return " mips64-linux-gnu" ;
104
104
break ;
105
105
}
@@ -108,14 +108,14 @@ std::string Linux::getMultiarchTriple(const Driver &D,
108
108
return " mips64el-linux-android" ;
109
109
std::string MT = std::string (IsMipsR6 ? " mipsisa64r6el" : " mips64el" ) +
110
110
" -linux-" + (IsMipsN32Abi ? " gnuabin32" : " gnuabi64" );
111
- if (D.getVFS ().exists (SysRoot + " /lib/ " + MT ))
111
+ if (D.getVFS ().exists (concat ( SysRoot, " /lib" , MT) ))
112
112
return MT;
113
- if (D.getVFS ().exists (SysRoot + " /lib/mips64el-linux-gnu" ))
113
+ if (D.getVFS ().exists (concat ( SysRoot, " /lib/mips64el-linux-gnu" ) ))
114
114
return " mips64el-linux-gnu" ;
115
115
break ;
116
116
}
117
117
case llvm::Triple::ppc:
118
- if (D.getVFS ().exists (SysRoot + " /lib/powerpc-linux-gnuspe" ))
118
+ if (D.getVFS ().exists (concat ( SysRoot, " /lib/powerpc-linux-gnuspe" ) ))
119
119
return " powerpc-linux-gnuspe" ;
120
120
return " powerpc-linux-gnu" ;
121
121
case llvm::Triple::ppcle:
@@ -269,38 +269,38 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
269
269
// used. We need add both libo32 and /lib.
270
270
if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel) {
271
271
Generic_GCC::AddMultilibPaths (D, SysRoot, " libo32" , MultiarchTriple, Paths);
272
- addPathIfExists (D, SysRoot + " /libo32" , Paths);
273
- addPathIfExists (D, SysRoot + " /usr/libo32" , Paths);
272
+ addPathIfExists (D, concat ( SysRoot, " /libo32" ) , Paths);
273
+ addPathIfExists (D, concat ( SysRoot, " /usr/libo32" ) , Paths);
274
274
}
275
275
Generic_GCC::AddMultilibPaths (D, SysRoot, OSLibDir, MultiarchTriple, Paths);
276
276
277
- addPathIfExists (D, SysRoot + " /lib/ " + MultiarchTriple, Paths);
278
- addPathIfExists (D, SysRoot + " /lib/../ " + OSLibDir, Paths);
277
+ addPathIfExists (D, concat ( SysRoot, " /lib" , MultiarchTriple) , Paths);
278
+ addPathIfExists (D, concat ( SysRoot, " /lib/.." , OSLibDir) , Paths);
279
279
280
280
if (IsAndroid) {
281
281
// Android sysroots contain a library directory for each supported OS
282
282
// version as well as some unversioned libraries in the usual multiarch
283
283
// directory.
284
284
addPathIfExists (
285
285
D,
286
- SysRoot + " /usr/lib/ " + MultiarchTriple + " / " +
287
- llvm::to_string (Triple.getEnvironmentVersion ().getMajor ()),
286
+ concat ( SysRoot, " /usr/lib" , MultiarchTriple,
287
+ llvm::to_string (Triple.getEnvironmentVersion ().getMajor () )),
288
288
Paths);
289
289
}
290
290
291
- addPathIfExists (D, SysRoot + " /usr/lib/ " + MultiarchTriple, Paths);
291
+ addPathIfExists (D, concat ( SysRoot, " /usr/lib" , MultiarchTriple) , Paths);
292
292
// 64-bit OpenEmbedded sysroots may not have a /usr/lib dir. So they cannot
293
293
// find /usr/lib64 as it is referenced as /usr/lib/../lib64. So we handle
294
294
// this here.
295
295
if (Triple.getVendor () == llvm::Triple::OpenEmbedded &&
296
296
Triple.isArch64Bit ())
297
- addPathIfExists (D, SysRoot + " /usr/ " + OSLibDir, Paths);
297
+ addPathIfExists (D, concat ( SysRoot, " /usr" , OSLibDir) , Paths);
298
298
else
299
- addPathIfExists (D, SysRoot + " /usr/lib/../ " + OSLibDir, Paths);
299
+ addPathIfExists (D, concat ( SysRoot, " /usr/lib/.." , OSLibDir) , Paths);
300
300
if (IsRISCV) {
301
301
StringRef ABIName = tools::riscv::getRISCVABI (Args, Triple);
302
- addPathIfExists (D, SysRoot + " /" + OSLibDir + " / " + ABIName, Paths);
303
- addPathIfExists (D, SysRoot + " /usr/ " + OSLibDir + " / " + ABIName, Paths);
302
+ addPathIfExists (D, concat ( SysRoot, " /" , OSLibDir, ABIName) , Paths);
303
+ addPathIfExists (D, concat ( SysRoot, " /usr" , OSLibDir, ABIName) , Paths);
304
304
}
305
305
306
306
Generic_GCC::AddMultiarchPaths (D, SysRoot, OSLibDir, Paths);
@@ -312,8 +312,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
312
312
D.getVFS ().exists (D.Dir + " /../lib/libc++.so" ))
313
313
addPathIfExists (D, D.Dir + " /../lib" , Paths);
314
314
315
- addPathIfExists (D, SysRoot + " /lib" , Paths);
316
- addPathIfExists (D, SysRoot + " /usr/lib" , Paths);
315
+ addPathIfExists (D, concat ( SysRoot, " /lib" ) , Paths);
316
+ addPathIfExists (D, concat ( SysRoot, " /usr/lib" ) , Paths);
317
317
}
318
318
319
319
ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType () const {
@@ -586,7 +586,7 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
586
586
return ;
587
587
588
588
// LOCAL_INCLUDE_DIR
589
- addSystemInclude (DriverArgs, CC1Args, SysRoot + " /usr/local/include" );
589
+ addSystemInclude (DriverArgs, CC1Args, concat ( SysRoot, " /usr/local/include" ) );
590
590
// TOOL_INCLUDE_DIR
591
591
AddMultilibIncludeArgs (DriverArgs, CC1Args);
592
592
@@ -607,19 +607,20 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
607
607
// /usr/include.
608
608
std::string MultiarchIncludeDir = getMultiarchTriple (D, getTriple (), SysRoot);
609
609
if (!MultiarchIncludeDir.empty () &&
610
- D.getVFS ().exists (SysRoot + " /usr/include/" + MultiarchIncludeDir))
611
- addExternCSystemInclude (DriverArgs, CC1Args,
612
- SysRoot + " /usr/include/" + MultiarchIncludeDir);
610
+ D.getVFS ().exists (concat (SysRoot, " /usr/include" , MultiarchIncludeDir)))
611
+ addExternCSystemInclude (
612
+ DriverArgs, CC1Args,
613
+ concat (SysRoot, " /usr/include" , MultiarchIncludeDir));
613
614
614
615
if (getTriple ().getOS () == llvm::Triple::RTEMS)
615
616
return ;
616
617
617
618
// Add an include of '/include' directly. This isn't provided by default by
618
619
// system GCCs, but is often used with cross-compiling GCCs, and harmless to
619
620
// add even when Clang is acting as-if it were a system compiler.
620
- addExternCSystemInclude (DriverArgs, CC1Args, SysRoot + " /include" );
621
+ addExternCSystemInclude (DriverArgs, CC1Args, concat ( SysRoot, " /include" ) );
621
622
622
- addExternCSystemInclude (DriverArgs, CC1Args, SysRoot + " /usr/include" );
623
+ addExternCSystemInclude (DriverArgs, CC1Args, concat ( SysRoot, " /usr/include" ) );
623
624
624
625
if (!DriverArgs.hasArg (options::OPT_nobuiltininc) && getTriple ().isMusl ())
625
626
addSystemInclude (DriverArgs, CC1Args, ResourceDirInclude);
0 commit comments