internal/rosa/llvm: insert Rosa OS paths via musl ldso
All checks were successful
Test / Create distribution (push) Successful in 2m47s
Test / Sandbox (push) Successful in 6m51s
Test / Hakurei (push) Successful in 8m55s
Test / Sandbox (race detector) (push) Successful in 9m24s
Test / ShareFS (push) Successful in 9m49s
Test / Hakurei (race detector) (push) Successful in 12m33s
Test / Flake checks (push) Successful in 2m45s
All checks were successful
Test / Create distribution (push) Successful in 2m47s
Test / Sandbox (push) Successful in 6m51s
Test / Hakurei (push) Successful in 8m55s
Test / Sandbox (race detector) (push) Successful in 9m24s
Test / ShareFS (push) Successful in 9m49s
Test / Hakurei (race detector) (push) Successful in 12m33s
Test / Flake checks (push) Successful in 2m45s
This is cleaner than unconditionally adding rpath, and avoids breaking rpath priority. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -90,8 +90,23 @@ index 8ac8d4eb9181..e46b04a898ca 100644
|
|||||||
addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
|
addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
|
||||||
`},
|
`},
|
||||||
|
|
||||||
{"path-system-libraries", `diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
|
{"path-system-libraries", `diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||||
index d525b417b4ea..fdc411f2239c 100644
|
index cb6a9b242421..b8d31690d1af 100644
|
||||||
|
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||||
|
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||||
|
@@ -2314,6 +2314,10 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||||
|
Prefixes.push_back("/opt/rh/devtoolset-2/root/usr");
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (TargetTriple.getVendor() == llvm::Triple::Rosa) {
|
||||||
|
+ Prefixes.push_back(concat(SysRoot, "/system"));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// Fall back to /usr which is used by most non-Solaris systems.
|
||||||
|
Prefixes.push_back(concat(SysRoot, "/usr"));
|
||||||
|
}
|
||||||
|
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||||
|
index d525b417b4ea..2b93f401733e 100644
|
||||||
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
||||||
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||||
@@ -302,6 +302,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
@@ -302,6 +302,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||||
@@ -102,18 +117,7 @@ index d525b417b4ea..fdc411f2239c 100644
|
|||||||
|
|
||||||
if (IsCSKY && !SelectedMultilibs.empty())
|
if (IsCSKY && !SelectedMultilibs.empty())
|
||||||
SysRoot = SysRoot + SelectedMultilibs.back().osSuffix();
|
SysRoot = SysRoot + SelectedMultilibs.back().osSuffix();
|
||||||
@@ -337,12 +338,23 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
@@ -341,8 +342,12 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||||
const std::string OSLibDir = std::string(getOSLibDir(Triple, Args));
|
|
||||||
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
|
|
||||||
|
|
||||||
+ if (IsRosa) {
|
|
||||||
+ ExtraOpts.push_back("-rpath");
|
|
||||||
+ ExtraOpts.push_back("/system/lib");
|
|
||||||
+ ExtraOpts.push_back("-rpath");
|
|
||||||
+ ExtraOpts.push_back(concat("/system/lib", Triple.str()));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// mips32: Debian multilib, we use /libo32, while in other case, /lib is
|
|
||||||
// used. We need add both libo32 and /lib.
|
// used. We need add both libo32 and /lib.
|
||||||
if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel) {
|
if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel) {
|
||||||
Generic_GCC::AddMultilibPaths(D, SysRoot, "libo32", MultiarchTriple, Paths);
|
Generic_GCC::AddMultilibPaths(D, SysRoot, "libo32", MultiarchTriple, Paths);
|
||||||
@@ -128,7 +132,7 @@ index d525b417b4ea..fdc411f2239c 100644
|
|||||||
}
|
}
|
||||||
Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
|
Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
|
||||||
|
|
||||||
@@ -360,18 +372,30 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
@@ -360,18 +365,30 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||||
Paths);
|
Paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +168,7 @@ index d525b417b4ea..fdc411f2239c 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
|
ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
|
||||||
@@ -572,6 +596,9 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
|
@@ -572,6 +589,9 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
|
||||||
return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker";
|
return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker";
|
||||||
}
|
}
|
||||||
if (Triple.isMusl()) {
|
if (Triple.isMusl()) {
|
||||||
@@ -174,18 +178,5 @@ index d525b417b4ea..fdc411f2239c 100644
|
|||||||
std::string ArchName;
|
std::string ArchName;
|
||||||
bool IsArm = false;
|
bool IsArm = false;
|
||||||
|
|
||||||
diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp
|
|
||||||
index f484d6f33ad8..dca55e72d67e 100644
|
|
||||||
--- a/clang/tools/clang-installapi/Options.cpp
|
|
||||||
+++ b/clang/tools/clang-installapi/Options.cpp
|
|
||||||
@@ -514,7 +514,7 @@ bool Options::processFrontendOptions(InputArgList &Args) {
|
|
||||||
FEOpts.FwkPaths = std::move(FrameworkPaths);
|
|
||||||
|
|
||||||
// Add default framework/library paths.
|
|
||||||
- PathSeq DefaultLibraryPaths = {"/usr/lib", "/usr/local/lib"};
|
|
||||||
+ PathSeq DefaultLibraryPaths = {"/usr/lib", "/system/lib", "/usr/local/lib"};
|
|
||||||
PathSeq DefaultFrameworkPaths = {"/Library/Frameworks",
|
|
||||||
"/System/Library/Frameworks"};
|
|
||||||
|
|
||||||
`},
|
`},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,23 @@ rmdir -v /work/lib
|
|||||||
Chmod: true,
|
Chmod: true,
|
||||||
|
|
||||||
Env: env,
|
Env: env,
|
||||||
|
|
||||||
|
Patches: []KV{
|
||||||
|
{"ldso-rosa", `diff --git a/ldso/dynlink.c b/ldso/dynlink.c
|
||||||
|
index 715948f4..c2fece68 100644
|
||||||
|
--- a/ldso/dynlink.c
|
||||||
|
+++ b/ldso/dynlink.c
|
||||||
|
@@ -1157,7 +1157,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||||
|
sys_path = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
|
||||||
|
+ if (!sys_path) sys_path = "/system/lib:/system/lib/" LDSO_ARCH "-rosa-linux-musl:/lib:/usr/local/lib:/usr/lib";
|
||||||
|
fd = path_open(name, sys_path, buf, sizeof buf);
|
||||||
|
}
|
||||||
|
pathname = buf;
|
||||||
|
`},
|
||||||
|
},
|
||||||
}, &helper,
|
}, &helper,
|
||||||
Coreutils,
|
Coreutils,
|
||||||
), version
|
), version
|
||||||
|
|||||||
Reference in New Issue
Block a user