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: 27747 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