about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-07-06 06:55:57 -0700
committerUlrich Drepper <drepper@redhat.com>2009-07-06 06:55:57 -0700
commita38862a58910a5209c9ac3baae5797fbbedbeb1c (patch)
tree2552acb5f620fc9c5b0ca60c1d5312fb42578068 /elf
parent2123d5815eaaa53a772be4b6069bdc6332f2f491 (diff)
downloadglibc-a38862a58910a5209c9ac3baae5797fbbedbeb1c.tar.gz
glibc-a38862a58910a5209c9ac3baae5797fbbedbeb1c.tar.xz
glibc-a38862a58910a5209c9ac3baae5797fbbedbeb1c.zip
Optimize test for valid ELF symbol types in lookup function. ibm/master
Diffstat (limited to 'elf')
-rw-r--r--elf/do-lookup.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index ae74da4846..acbc53dbbe 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -87,13 +87,13 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
 			      0))
 	  return NULL;
 
-	if (__builtin_expect (stt > STT_FUNC
-			      && stt != STT_COMMON
-			      && stt != STT_TLS
-			      && stt != STT_GNU_IFUNC, 0))
-	  /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC, STT_COMMON,
-	     STT_TLS, and STT_GNU_IFUNC since these are no code/data
-	     definitions.  */
+	/* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC,
+	   STT_COMMON, STT_TLS, and STT_GNU_IFUNC since these are no
+	   code/data definitions.  */
+#define ALLOWED_STT \
+	((1 << STT_NOTYPE) | (1 << STT_OBJECT) | (1 << STT_FUNC) \
+	 | (1 << STT_COMMON) | (1 << STT_TLS) | (1 << STT_GNU_IFUNC))
+	if (__builtin_expect (((1 << stt) & ALLOWED_STT) == 0, 0))
 	  return NULL;
 
 	if (sym != ref && strcmp (strtab + sym->st_name, undef_name))