From patchwork Tue Jun 12 12:46:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 928305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-93080-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="KfoB63f2"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 414qQf00hVz9s0w for ; Tue, 12 Jun 2018 22:47:05 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= rxNIGE+ySD71hsAxfv0myWkaPv2oaHMtJReq5fFbGelmVWaVqJVzr/L0PyYfViYY WXi+i71LwtFr1j+lMlBojNLMQgrGu+73hQKKqNbj8AC2rBEJGcR/tV7Cts1wW5Mw +2Vt5bAKIpSQZTFKcvmOkkjJ3qCGKw+RktlfeoS02ic= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=m5CmLj DWez+xqvU34/38Oa6mWCE=; b=KfoB63f2NagGV9zjmmTgICiN2eqem9y04lCzfB OLVj/2Qw+rpDo67pskrQPAdpLa1+qaF4o4nEnNyWUrGy6orn+Aferiu5dXV+CTZC eDT6j3K9Ta4U3+YhjofqaUMI1ClwSWC4YcIbf4FNB+Vyrq9YvK+c0R4lQoQ+gHK7 Y5tWE= Received: (qmail 102350 invoked by alias); 12 Jun 2018 12:47:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 100977 invoked by uid 89); 12 Jun 2018 12:46:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Date: Tue, 12 Jun 2018 14:46:55 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] x86: Make strncmp usable from rtld User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20180612124655.F196E439942E1@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) Due to the way the conditions were written, the rtld build of strncmp ended up with no definition of the strncmp symbol at all: The implementations were renamed for use within an IFUNC resolver, but the IFUNC resolver itself was missing (because rtld does not use IFUNCs). 2018-06-12 Florian Weimer x86: Make strncmp usable from rtld. * sysdeps/i386/i686/multiarch/strncmp-c.c: Only rename strncmp to __strncmp_ia32 if in libc (and not in rtld). * sysdeps/x86_64/multiarch/strncmp-sse2.S: Rename strcmp to strncmp if not in libc (and not to __strncmp_sse2). Reviewed-by: Carlos O'Donell diff --git a/sysdeps/i386/i686/multiarch/strncmp-c.c b/sysdeps/i386/i686/multiarch/strncmp-c.c index cc059da494..2e3eca9b2b 100644 --- a/sysdeps/i386/i686/multiarch/strncmp-c.c +++ b/sysdeps/i386/i686/multiarch/strncmp-c.c @@ -1,4 +1,4 @@ -#ifdef SHARED +#if defined (SHARED) && IS_IN (libc) # define STRNCMP __strncmp_ia32 # undef libc_hidden_builtin_def # define libc_hidden_builtin_def(name) \ diff --git a/sysdeps/x86_64/multiarch/strncmp-sse2.S b/sysdeps/x86_64/multiarch/strncmp-sse2.S index cc5252d826..a5ecb82b13 100644 --- a/sysdeps/x86_64/multiarch/strncmp-sse2.S +++ b/sysdeps/x86_64/multiarch/strncmp-sse2.S @@ -18,10 +18,13 @@ #include -#define STRCMP __strncmp_sse2 - -#undef libc_hidden_builtin_def -#define libc_hidden_builtin_def(strcmp) +#if IS_IN (libc) +# define STRCMP __strncmp_sse2 +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(strcmp) +#else +# define STRCMP strncmp +#endif #define USE_AS_STRNCMP #include