--- libc/elf/dl-lookup.c.jj 2009-06-22 15:40:35.000000000 -0400 +++ libc/elf/dl-lookup.c 2009-12-16 10:26:10.403974000 -0500 @@ -379,7 +379,8 @@ _dl_lookup_symbol_x (const char *undef_n version, type_class, flags, skip_map); /* The object is used. */ - current_value.m->l_used = 1; + if (__builtin_expect (current_value.m->l_used == 0, 0)) + current_value.m->l_used = 1; if (__builtin_expect (GLRO(dl_debug_mask) & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0)) --- libc/elf/dl-object.c.jj 2009-06-22 15:40:38.000000000 -0400 +++ libc/elf/dl-object.c 2009-12-16 10:27:15.965268000 -0500 @@ -67,6 +67,10 @@ _dl_new_object (char *realname, const ch new->l_name = realname; new->l_type = type; + /* If we set the bit now since we know it is never used we avoid + dirtying the cache line later. */ + if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0) + new->l_used = 1; new->l_loader = loader; #if defined USE_TLS && NO_TLS_OFFSET != 0 new->l_tls_offset = NO_TLS_OFFSET; --- libc/elf/rtld.c.jj 2009-06-22 15:40:35.000000000 -0400 +++ libc/elf/rtld.c 2009-12-16 10:44:25.572605000 -0500 @@ -2668,6 +2668,8 @@ process_envvars (enum mode *modep) /* The caller wants this information. */ *modep = mode; + if (__builtin_expect (mode == normal, 1)) + GLRO(dl_debug_mask) &= ~DL_DEBUG_UNUSED; /* Extra security for SUID binaries. Remove all dangerous environment variables. */