elf: Reinstate on DL_DEBUG_BINDINGS _dl_lookup_symbol_x

Message ID 20221025162200.997613-1-adhemerval.zanella@linaro.org
State Committed
Commit 891a7958a28eac6d4af1517dd2896fef5e4951d4
Headers
Series elf: Reinstate on DL_DEBUG_BINDINGS _dl_lookup_symbol_x |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Adhemerval Zanella Oct. 25, 2022, 4:22 p.m. UTC
  The prelink removal done by 6628c742b2c16e wrongly removed the debug
support.

Checked on x86_64-linux-gnu.
---
 elf/dl-lookup.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Andreas Schwab Oct. 26, 2022, 12:11 p.m. UTC | #1
On Okt 25 2022, Adhemerval Zanella via Libc-alpha wrote:

> The prelink removal done by 6628c742b2c16e wrongly removed the debug
> support.

Ok.
  

Patch

diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 4c86dc694e..67fb2e31e2 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -854,6 +854,23 @@  _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
   if (__glibc_unlikely (current_value.m->l_used == 0))
     current_value.m->l_used = 1;
 
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS))
+   {
+      const char *reference_name = undef_map->l_name;
+
+      _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
+			DSO_FILENAME (reference_name),
+			undef_map->l_ns,
+			DSO_FILENAME (current_value.m->l_name),
+			current_value.m->l_ns,
+			protected ? "protected" : "normal", undef_name);
+      if (version)
+	_dl_debug_printf_c (" [%s]\n", version->name);
+      else
+	_dl_debug_printf_c ("\n");
+   }
+
+
   *ref = current_value.s;
   return LOOKUP_VALUE (current_value.m);
 }