summaryrefslogtreecommitdiff
path: root/ldso/ldso
diff options
context:
space:
mode:
authorLeonid Lisovskiy <lly.dev@gmail.com>2016-06-20 20:29:44 +0300
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-06-22 08:02:51 +0200
commit0bc1394750885d4e4b2064aff6c48dd542c6f4b8 (patch)
treef7d2c3930d353dabfcae271be2bd5fc956869e06 /ldso/ldso
parentfcbbde85024f494d7ba573bf8a4474755452efdd (diff)
ldso: Consistently set & use DL_OPENED flag in both ld.so and libdl
Previously, DL_OPENED flag was set in libdl only and never used. Set it centralized in _dl_load_elf_shared_library() & use it in both ld.so and libdl. Additionally, rename it to DL_OPENED2 for clarity. Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Diffstat (limited to 'ldso/ldso')
-rw-r--r--ldso/ldso/dl-elf.c1
-rw-r--r--ldso/ldso/ldso.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 04e8c60a4..8f71aeb05 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -546,6 +546,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned int rflags,
if (tpnt->st_dev == st.st_dev && tpnt->st_ino == st.st_ino) {
/* Already loaded */
tpnt->usage_count++;
+ tpnt->init_flag |= DL_OPENED2;
_dl_close(infile);
return tpnt;
}
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 7bb6a349b..4e8a49ef5 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -905,7 +905,7 @@ of this helper program; chances are you did not intend to run this program.\n\
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects && !_dl_trace_prelink &&
- tpnt1->usage_count == 1) {
+ !(tpnt1->init_flag & DL_OPENED2)) {
/* This is a real hack to make
* ldd not print the library
* itself when run on a
@@ -997,7 +997,7 @@ of this helper program; chances are you did not intend to run this program.\n\
# ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects && !_dl_trace_prelink &&
- tpnt1->usage_count == 1) {
+ !(tpnt1->init_flag & DL_OPENED2)) {
_dl_dprintf(1, "\t%s => %s (%x)\n",
cp2, tpnt1->libname,
DL_LOADADDR_BASE(tpnt1->loadaddr));
@@ -1034,6 +1034,8 @@ of this helper program; chances are you did not intend to run this program.\n\
/* Insert the ld.so only once */
ldso_tpnt = add_ldso(tpnt, load_addr,
ldso_mapaddr, auxvt, rpnt);
+ } else {
+ ldso_tpnt->init_flag |= DL_OPENED2;
}
ldso_tpnt->usage_count++;
tpnt1 = ldso_tpnt;
@@ -1064,7 +1066,7 @@ of this helper program; chances are you did not intend to run this program.\n\
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects && !_dl_trace_prelink &&
- tpnt1->usage_count == 1) {
+ !(tpnt1->init_flag & DL_OPENED2)) {
_dl_dprintf(1, "\t%s => %s (%x)\n",
lpntstr, tpnt1->libname,
DL_LOADADDR_BASE(tpnt1->loadaddr));