mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
mlibc: backport shared object promotion fix
This commit is contained in:
@@ -306,6 +306,24 @@ index 8592ea5..94ceba1 100644
|
||||
+ }
|
||||
+ return 0;
|
||||
}
|
||||
diff --git mlibc-clean/options/rtld/generic/main.cpp mlibc-workdir/options/rtld/generic/main.cpp
|
||||
index bf54bcb..106916a 100644
|
||||
--- mlibc-clean/options/rtld/generic/main.cpp
|
||||
+++ mlibc-workdir/options/rtld/generic/main.cpp
|
||||
@@ -729,7 +729,12 @@ void *__dlapi_open(const char *file, int flags, void *returnAddress) {
|
||||
// TODO: Thread-safety!
|
||||
auto rts = rtsCounter++;
|
||||
|
||||
- SharedObject *object = initialRepository->findLoadedObject(file);
|
||||
+ auto objectName = frg::string_view{file};
|
||||
+ auto lastSlash = objectName.find_last('/');
|
||||
+ if (lastSlash != static_cast<size_t>(-1))
|
||||
+ objectName = objectName.sub_string(lastSlash + 1, objectName.size() - (lastSlash + 1));
|
||||
+
|
||||
+ SharedObject *object = initialRepository->findLoadedObject(objectName);
|
||||
if (object && object->globalRts == 0 && (flags & RTLD_GLOBAL)) {
|
||||
// The object was opened with RTLD_LOCAL, but we are called with RTLD_GLOBAL.
|
||||
// According to the man page, we should promote to the global scope here.
|
||||
diff --git mlibc-clean/options/rtld/x86_64/runtime.S mlibc-workdir/options/rtld/x86_64/runtime.S
|
||||
index ba9a520..b958ef3 100644
|
||||
--- mlibc-clean/options/rtld/x86_64/runtime.S
|
||||
|
||||
Reference in New Issue
Block a user