From patchwork Mon Jul 4 13:45:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 644186 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3rjpJy3GGLz9ssP for ; Mon, 4 Jul 2016 23:49:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=mkDRB7AX; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=ZQeL mfkpN8yBkAf9UQSvRuCzhW0zxcVVwSeXvAhltVT3JZLsJY8s2iyG/6GAYYpINTI+ XaV1XrNL+7+Z2n5AjkM/KiLD0XvlsRW5TxE0JTSJ5AjyzIOruJWwRLf6XaHtp9no UDbt10ihMv/bWvjx5/4VKJGoDniy+pSbMGDzX24= 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:to:from:subject:date:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=F0PBLO/JV7 z/eAdBHF+azia7rfM=; b=mkDRB7AXFP6zX7jJnEV5VBta2495BYdE2NLCGf+uoP 8Q0aXcPDTGtNSxR0ktlmk9GLVFy3CLuc6RtxxP90QPcO6KKMQoTUzySny/STeM0W Y1ErwGPJRqPnyQMoInFcRNFq8Jr31bxjTjR2NlUmIFNgdI3TTNFRLNCMrEkchF5s U= Received: (qmail 2088 invoked by alias); 4 Jul 2016 13:49: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 2037 invoked by uid 89); 4 Jul 2016 13:48:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=ABC, damage X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: [PATCH 5/8] Use libc_ifunc macro for clock_* symbols in librt. Date: Mon, 4 Jul 2016 15:45:15 +0200 Lines: 115 Message-ID: References: <1466682952-6301-1-git-send-email-stli@linux.vnet.ibm.com> <1466682952-6301-5-git-send-email-stli@linux.vnet.ibm.com> <3a265423-d832-9226-88b2-b53df2633f6b@redhat.com> Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <3a265423-d832-9226-88b2-b53df2633f6b@redhat.com> On 07/04/2016 11:14 AM, Florian Weimer wrote: > On 06/23/2016 01:55 PM, Stefan Liebler wrote: >> +# define INIT_ARCH() >> +# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, >> &__##name) > > Doesn't this cause INIT_ARCH redefinition warnings in some cases? > > Thanks, > Florian > At the moment INIT_ARCH is only defined in -sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h -sysdeps/x86/cpu-features.h The latter one is included in ldsodefs.h which is included in dl-vdso.h. Thus the undef is needed in x86/i386 time.c/gettimeofday.c. I built and run testsuite for intel, power and s390. There did not occur a redefinition warning. Nevertheless, this is a good point and I add an undef INIT_ARCH before the definition in this patch and the other "Use libc_ifunc macro for ABC in libDEF." patches. From d80e99d0fcd917cdd66a8d9697e75de59e67b863 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Mon, 4 Jul 2016 15:33:56 +0200 Subject: [PATCH 5/8] Use libc_ifunc macro for clock_* symbols in librt. This patch uses the libc_ifunc macro to create already existing ifunc functions clock_getres, clock_gettime, clock_settime, clock_getcpuclockid and clock_nanosleep. If HAVE_IFUNC is defined, the macro COMPAT_REDIRECT uses the libc_ifunc macro. Furthermore some whitespace damage is cleaned. ChangeLog: * rt/clock-compat.c (COMPAT_REDIRECT): Use libc_ifunc macro. --- rt/clock-compat.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/rt/clock-compat.c b/rt/clock-compat.c index dc69e4a..b47781c 100644 --- a/rt/clock-compat.c +++ b/rt/clock-compat.c @@ -28,13 +28,9 @@ #include #if HAVE_IFUNC -# define COMPAT_REDIRECT(name, proto, arglist) \ - __typeof (name) *name##_ifunc (void) asm (#name); \ - __typeof (name) *name##_ifunc (void) \ - { \ - return &__##name; \ - } \ - asm (".type " #name ", %gnu_indirect_function"); +# undef INIT_ARCH +# define INIT_ARCH() +# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) #else # define COMPAT_REDIRECT(name, proto, arglist) \ int \ @@ -45,21 +41,21 @@ #endif COMPAT_REDIRECT (clock_getres, - (clockid_t clock_id, struct timespec *res), - (clock_id, res)) + (clockid_t clock_id, struct timespec *res), + (clock_id, res)) COMPAT_REDIRECT (clock_gettime, - (clockid_t clock_id, struct timespec *tp), - (clock_id, tp)) + (clockid_t clock_id, struct timespec *tp), + (clock_id, tp)) COMPAT_REDIRECT (clock_settime, - (clockid_t clock_id, const struct timespec *tp), - (clock_id, tp)) + (clockid_t clock_id, const struct timespec *tp), + (clock_id, tp)) COMPAT_REDIRECT (clock_getcpuclockid, - (pid_t pid, clockid_t *clock_id), - (pid, clock_id)) + (pid_t pid, clockid_t *clock_id), + (pid, clock_id)) COMPAT_REDIRECT (clock_nanosleep, - (clockid_t clock_id, int flags, - const struct timespec *req, - struct timespec *rem), - (clock_id, flags, req, rem)) + (clockid_t clock_id, int flags, + const struct timespec *req, + struct timespec *rem), + (clock_id, flags, req, rem)) #endif -- 2.3.0