public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function
@ 2021-08-09 20:25 Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-08-09 20:25 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=22b419be4e23df6fead108b7a40ea7b019aa9f13
commit 22b419be4e23df6fead108b7a40ea7b019aa9f13
Author: Vivek Das Mohapatra <vivek@collabora.com>
Date: Thu Jul 8 17:32:49 2021 +0100
elf: Abstract loaded-DSO search code into a helper function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diff:
---
elf/dl-load.c | 44 ++++++++++++++++++++++++++++++--------------
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 650e4edc35..fb23ba632b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2027,24 +2027,13 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
+/* Search for a shared object in a given namespace. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+_dl_find_dso (const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
-
- /* Look for this name among those already loaded. */
- for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+ for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
@@ -2073,6 +2062,33 @@ _dl_map_object (struct link_map *loader, const char *name,
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_find_dso (name, nsid);
+
+ if (l != NULL)
+ {
+ return l;
+ }
+
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
&& loader != NULL)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 9c15259236..22f3fea436 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1287,6 +1287,10 @@ extern void _dl_show_scope (struct link_map *new, int from)
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
+extern struct link_map *_dl_find_dso (const char *name, Lmid_t nsid);
+rtld_hidden_proto (_dl_find_dso)
+
+
/* Initialization which is normally done by the dynamic linker. */
extern void _dl_non_dynamic_init (void)
attribute_hidden;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function
@ 2021-09-27 18:54 Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-09-27 18:54 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e8c25633959f6c38e9b19dbddbf8de03e79e6594
commit e8c25633959f6c38e9b19dbddbf8de03e79e6594
Author: Vivek Das Mohapatra <vivek@collabora.com>
Date: Thu Jul 8 17:32:49 2021 +0100
elf: Abstract loaded-DSO search code into a helper function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diff:
---
elf/dl-load.c | 44 ++++++++++++++++++++++++++++++--------------
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 6ea71077af..36ad7ca020 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2028,24 +2028,13 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
+/* Search for a shared object in a given namespace. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+_dl_find_dso (const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
-
- /* Look for this name among those already loaded. */
- for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+ for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
@@ -2074,6 +2063,33 @@ _dl_map_object (struct link_map *loader, const char *name,
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_find_dso (name, nsid);
+
+ if (l != NULL)
+ {
+ return l;
+ }
+
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
&& loader != NULL)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index d49529da0d..c64650ff25 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1294,6 +1294,10 @@ extern void _dl_show_scope (struct link_map *new, int from)
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
+extern struct link_map *_dl_find_dso (const char *name, Lmid_t nsid);
+rtld_hidden_proto (_dl_find_dso)
+
+
/* Initialization which is normally done by the dynamic linker. */
extern void _dl_non_dynamic_init (void)
attribute_hidden;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function
@ 2021-08-10 13:42 Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-08-10 13:42 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=22b419be4e23df6fead108b7a40ea7b019aa9f13
commit 22b419be4e23df6fead108b7a40ea7b019aa9f13
Author: Vivek Das Mohapatra <vivek@collabora.com>
Date: Thu Jul 8 17:32:49 2021 +0100
elf: Abstract loaded-DSO search code into a helper function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diff:
---
elf/dl-load.c | 44 ++++++++++++++++++++++++++++++--------------
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 650e4edc35..fb23ba632b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2027,24 +2027,13 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
+/* Search for a shared object in a given namespace. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+_dl_find_dso (const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
-
- /* Look for this name among those already loaded. */
- for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+ for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
@@ -2073,6 +2062,33 @@ _dl_map_object (struct link_map *loader, const char *name,
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_find_dso (name, nsid);
+
+ if (l != NULL)
+ {
+ return l;
+ }
+
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
&& loader != NULL)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 9c15259236..22f3fea436 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1287,6 +1287,10 @@ extern void _dl_show_scope (struct link_map *new, int from)
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
+extern struct link_map *_dl_find_dso (const char *name, Lmid_t nsid);
+rtld_hidden_proto (_dl_find_dso)
+
+
/* Initialization which is normally done by the dynamic linker. */
extern void _dl_non_dynamic_init (void)
attribute_hidden;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function
@ 2021-08-10 12:43 Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-08-10 12:43 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=22b419be4e23df6fead108b7a40ea7b019aa9f13
commit 22b419be4e23df6fead108b7a40ea7b019aa9f13
Author: Vivek Das Mohapatra <vivek@collabora.com>
Date: Thu Jul 8 17:32:49 2021 +0100
elf: Abstract loaded-DSO search code into a helper function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diff:
---
elf/dl-load.c | 44 ++++++++++++++++++++++++++++++--------------
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 650e4edc35..fb23ba632b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2027,24 +2027,13 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
+/* Search for a shared object in a given namespace. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+_dl_find_dso (const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
-
- /* Look for this name among those already loaded. */
- for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+ for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
@@ -2073,6 +2062,33 @@ _dl_map_object (struct link_map *loader, const char *name,
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_find_dso (name, nsid);
+
+ if (l != NULL)
+ {
+ return l;
+ }
+
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
&& loader != NULL)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 9c15259236..22f3fea436 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1287,6 +1287,10 @@ extern void _dl_show_scope (struct link_map *new, int from)
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
+extern struct link_map *_dl_find_dso (const char *name, Lmid_t nsid);
+rtld_hidden_proto (_dl_find_dso)
+
+
/* Initialization which is normally done by the dynamic linker. */
extern void _dl_non_dynamic_init (void)
attribute_hidden;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function
@ 2021-08-09 20:31 Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-08-09 20:31 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=22b419be4e23df6fead108b7a40ea7b019aa9f13
commit 22b419be4e23df6fead108b7a40ea7b019aa9f13
Author: Vivek Das Mohapatra <vivek@collabora.com>
Date: Thu Jul 8 17:32:49 2021 +0100
elf: Abstract loaded-DSO search code into a helper function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diff:
---
elf/dl-load.c | 44 ++++++++++++++++++++++++++++++--------------
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 650e4edc35..fb23ba632b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2027,24 +2027,13 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
+/* Search for a shared object in a given namespace. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+_dl_find_dso (const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
-
- /* Look for this name among those already loaded. */
- for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+ for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
@@ -2073,6 +2062,33 @@ _dl_map_object (struct link_map *loader, const char *name,
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_find_dso (name, nsid);
+
+ if (l != NULL)
+ {
+ return l;
+ }
+
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
&& loader != NULL)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 9c15259236..22f3fea436 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1287,6 +1287,10 @@ extern void _dl_show_scope (struct link_map *new, int from)
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
+extern struct link_map *_dl_find_dso (const char *name, Lmid_t nsid);
+rtld_hidden_proto (_dl_find_dso)
+
+
/* Initialization which is normally done by the dynamic linker. */
extern void _dl_non_dynamic_init (void)
attribute_hidden;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function
@ 2021-08-09 20:17 Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-08-09 20:17 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=22b419be4e23df6fead108b7a40ea7b019aa9f13
commit 22b419be4e23df6fead108b7a40ea7b019aa9f13
Author: Vivek Das Mohapatra <vivek@collabora.com>
Date: Thu Jul 8 17:32:49 2021 +0100
elf: Abstract loaded-DSO search code into a helper function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diff:
---
elf/dl-load.c | 44 ++++++++++++++++++++++++++++++--------------
sysdeps/generic/ldsodefs.h | 4 ++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 650e4edc35..fb23ba632b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2027,24 +2027,13 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
+/* Search for a shared object in a given namespace. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+_dl_find_dso (const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
-
- /* Look for this name among those already loaded. */
- for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+ for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
@@ -2073,6 +2062,33 @@ _dl_map_object (struct link_map *loader, const char *name,
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_find_dso (name, nsid);
+
+ if (l != NULL)
+ {
+ return l;
+ }
+
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
&& loader != NULL)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 9c15259236..22f3fea436 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1287,6 +1287,10 @@ extern void _dl_show_scope (struct link_map *new, int from)
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
+extern struct link_map *_dl_find_dso (const char *name, Lmid_t nsid);
+rtld_hidden_proto (_dl_find_dso)
+
+
/* Initialization which is normally done by the dynamic linker. */
extern void _dl_non_dynamic_init (void)
attribute_hidden;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-09-27 18:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 20:25 [glibc/azanella/rtld-shared] elf: Abstract loaded-DSO search code into a helper function Adhemerval Zanella
-- strict thread matches above, loose matches on Subject: below --
2021-09-27 18:54 Adhemerval Zanella
2021-08-10 13:42 Adhemerval Zanella
2021-08-10 12:43 Adhemerval Zanella
2021-08-09 20:31 Adhemerval Zanella
2021-08-09 20:17 Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).