mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
fix: running Blender with SYSMAN enabled on Linux
Related-To: NEO-11618 Signed-off-by: Oskar Hubert Weber <oskar.hubert.weber@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5adfaa0380
commit
8527779778
@@ -43,6 +43,8 @@ OsLibrary::OsLibrary(const std::string &name, std::string *errorValue) {
|
||||
auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
|
||||
/* Background: https://github.com/intel/compute-runtime/issues/122 */
|
||||
#endif
|
||||
dlopenFlag = OsLibrary::loadFlagsOverwrite ? *OsLibrary::loadFlagsOverwrite : dlopenFlag;
|
||||
OsLibrary::loadFlagsOverwrite = nullptr;
|
||||
adjustLibraryFlags(dlopenFlag);
|
||||
this->handle = SysCalls::dlopen(name.c_str(), dlopenFlag);
|
||||
if (!this->handle && (errorValue != nullptr)) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "shared/source/os_interface/os_library.h"
|
||||
namespace NEO {
|
||||
|
||||
const int *OsLibrary::loadFlagsOverwrite = nullptr;
|
||||
|
||||
decltype(&OsLibrary::load) OsLibrary::loadFunc = OsLibrary::load;
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -31,6 +31,8 @@ class OsLibrary {
|
||||
public:
|
||||
virtual ~OsLibrary() = default;
|
||||
|
||||
static const int *loadFlagsOverwrite;
|
||||
|
||||
static decltype(&OsLibrary::load) loadFunc;
|
||||
static OsLibrary *loadAndCaptureError(const std::string &name, std::string *errorValue);
|
||||
static const std::string createFullSystemPath(const std::string &name);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -26,7 +26,8 @@ void *dlopen(const char *filename, int flags) {
|
||||
dlopenError = -1;
|
||||
if (filename == nullptr ||
|
||||
(strcmp(filename, "libtest_dynamic_lib.so") == 0) ||
|
||||
(strcmp(filename, "libtest_l0_loader_lib.so") == 0)) {
|
||||
(strcmp(filename, "libtest_l0_loader_lib.so") == 0) ||
|
||||
(strcmp(filename, "libigsc.so.0") == 0)) {
|
||||
return dlopenFunc(filename, flags);
|
||||
}
|
||||
if (filename[0] == '_') {
|
||||
|
||||
@@ -73,4 +73,15 @@ TEST(OsLibraryTest, GivenInvalidLibraryWhenOpeningLibraryThenDlopenErrorIsReturn
|
||||
EXPECT_TRUE(NEO::SysCalls::dlOpenCalled);
|
||||
}
|
||||
|
||||
TEST(OsLibraryTest, GivenLoadFlagsOverwriteWhenOpeningLibraryThenDlOpenIsCalledWithExpectedFlags) {
|
||||
VariableBackup<int> dlOpenFlagsBackup{&NEO::SysCalls::dlOpenFlags, 0};
|
||||
VariableBackup<bool> dlOpenCalledBackup{&NEO::SysCalls::dlOpenCalled, false};
|
||||
|
||||
auto expectedFlag = RTLD_LAZY | RTLD_GLOBAL;
|
||||
NEO::OsLibrary::loadFlagsOverwrite = &expectedFlag;
|
||||
auto lib = std::make_unique<Linux::OsLibrary>("_abc.so", nullptr);
|
||||
EXPECT_TRUE(NEO::SysCalls::dlOpenCalled);
|
||||
EXPECT_EQ(NEO::SysCalls::dlOpenFlags, expectedFlag);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user