Warn about unsupported DT_FLAGS_1 flags.
authorCarlos O'Donell <carlos_odonell@mentor.com>
Fri, 30 Nov 2012 02:09:12 +0000 (18:09 -0800)
committerCarlos O'Donell <carlos_odonell@mentor.com>
Fri, 30 Nov 2012 02:12:23 +0000 (18:12 -0800)
The dynamic loader will now warn about unsupported DT_FLAGS_1
flags when run with LD_DEBUG=files or LD_DEBUG=all.

ChangeLog
elf/get-dynamic-info.h

index 9611f6cd81fa676e0565bf35329791a95f6a96b7..dabb7d13f3f5738a1068f768e7e26b52a7ac9587 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-29  Carlos O'Donell  <carlos@systemhalted.org>
+
+       * elf/get-dynamic-info.h (elf_get_dynamic_info): Warn
+       for unsupported DF_1_* bits when DL_DEBUG_FILES is set.
+
 2012-11-29  Mike Frysinger  <vapier@gentoo.org>
 
        * sysdeps/unix/sysv/linux/clock_getcpuclockid.c (HAS_CPUCLOCK): Delete.
index 9e018de6d297d7b2fc7e51b7baa03e51549a33fd..026f2462387ea98e53042f242170f8143788fdfa 100644 (file)
@@ -151,8 +151,16 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
     {
       l->l_flags_1 = info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val;
 
-      /* Only DT_1_SUPPORTED_MASK bits are allowed.  */
-      assert ((l->l_flags_1 & ~DT_1_SUPPORTED_MASK) == 0);
+      /* Only DT_1_SUPPORTED_MASK bits are supported, and we would like
+        to assert this, but we can't. Users have been setting
+        unsupported DF_1_* flags for a long time and glibc has ignored
+        them. Therefore to avoid breaking existing applications the
+        best we can do is add a warning during debugging with the
+        intent of notifying the user of the problem.  */
+      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
+         && l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
+       _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
+                         l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
 
       if (l->l_flags_1 & DF_1_NOW)
        info[DT_BIND_NOW] = info[VERSYMIDX (DT_FLAGS_1)];