about summary refs log tree commit diff
path: root/elf/get-dynamic-info.h
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos_odonell@mentor.com>2012-11-29 18:09:12 -0800
committerCarlos O'Donell <carlos_odonell@mentor.com>2012-11-29 18:12:23 -0800
commitc93ec1f091ec0d114e7a33cb1156e2745162eb4a (patch)
tree940cf699e06081b49376a72d85d428e55a4b2a55 /elf/get-dynamic-info.h
parent6355e122f552986a55dca427e9377db435c6e18b (diff)
downloadglibc-c93ec1f091ec0d114e7a33cb1156e2745162eb4a.tar.gz
glibc-c93ec1f091ec0d114e7a33cb1156e2745162eb4a.tar.xz
glibc-c93ec1f091ec0d114e7a33cb1156e2745162eb4a.zip
Warn about unsupported DT_FLAGS_1 flags.
The dynamic loader will now warn about unsupported DT_FLAGS_1
flags when run with LD_DEBUG=files or LD_DEBUG=all.
Diffstat (limited to 'elf/get-dynamic-info.h')
-rw-r--r--elf/get-dynamic-info.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
index 9e018de6d2..026f246238 100644
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -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)];