From patchwork Mon Nov 24 10:43:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 413608 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 C5C0214013F for ; Mon, 24 Nov 2014 21:43:55 +1100 (AEDT) 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:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=o/wR q57yAyT4y65xErgjuVE+vh8uQIVVTXTHPnqgFDf57cD5E/zTl/KZ99tg/ii672Hs m7BAneEccHgltI7Jf3DEFtna60RbY/NC8UtC7QsfTokjJl6BSRMNOaFfSvWhHXrM 1w+47vRGyc0rVJqbfoWl0DSvKBBHvOBQD2MoUAY= 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:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=fyqfQiHAZA OCmVgHSQwLjcRkdWE=; b=NoL5sVsCQppdpw4sOAXVDbsbw1OzEy1aZgASpKNkxD psQaqsfFFyASM+nWUlydSiuWwfjTNWC/tUk3Wkpcc3reNrQhHOm9jHK2ElexodXh jpO2J2jC9URHukg42D2TXXx7uYqj0hMrhrojZ586imEF4VwrQOAs7B+mNPjn4NGA A= Received: (qmail 3537 invoked by alias); 24 Nov 2014 10:43:49 -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 3507 invoked by uid 89); 24 Nov 2014 10:43:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Mon, 24 Nov 2014 16:13:35 +0530 From: Siddhesh Poyarekar To: Roland McGrath Cc: libc-alpha@sourceware.org Subject: Re: [ping][PATCH 04/19] Use MODULE_NAME in stap-probe instead of IN_LIB Message-ID: <20141124104335.GJ12197@spoyarek.pnq.redhat.com> References: <1408618663-2281-1-git-send-email-siddhesh@redhat.com> <1408618663-2281-5-git-send-email-siddhesh@redhat.com> <20140917124715.GW6586@spoyarek.pnq.redhat.com> <20141107233206.B655F2C3B00@topped-with-meat.com> <20141119070959.GI7942@spoyarek.pnq.redhat.com> <20141119234707.26C702C3B18@topped-with-meat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141119234707.26C702C3B18@topped-with-meat.com> User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) On Wed, Nov 19, 2014 at 03:47:07PM -0800, Roland McGrath wrote: > I'm not sure what you imagine I imagine that would do. What I'm talking > about is -DMODULE_NAME=libc instead of -DIN_MODULE=MODULE_libc and: > > #define IN_MODULE PASTE(MODULE_, MODULE_NAME) > #define PASTE(a, b) PASTE_1(a, b) > #define PASTE_1(a, b) a##b > > instead of generating #if IN_MODULE == ... #define MODULE_NAME ... #endif. > Of course the "#define MODULE_foo N" bit has to be generated. Thanks for clarifying. I have pushed the patch below, since it directly incorporates your suggestion and doesn't change the generated code. I have also pushed the remaining patches, which completes this patchset! ... and now for the next one :) Siddhesh commit 279bc5b3c384c09746fbadb2b68c6db9e833c064 Author: Siddhesh Poyarekar Date: Thu Nov 20 11:42:00 2014 +0530 Use MODULE_NAME in stap-probe instead of IN_LIB Define MODULE_NAME in the build command and define IN_MODULE using MODULE_NAME. Verified that the generated code is unchanged on x86_64. * Makeconfig (module-cppflags-real): Define MODULE_NAME instead of IN_MODULE. * include/libc-symbols.h (IN_MODULE): Define using MODULE_NAME. (PASTE_NAME, PASTE_NAME1): New macros. * include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead of IN_LIB. (STAP_PROBE_ASM): Likewise. diff --git a/ChangeLog b/ChangeLog index 0bde88c..43759c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2014-11-24 Siddhesh Poyarekar + + * Makeconfig (module-cppflags-real): Define MODULE_NAME + instead of IN_MODULE. + * include/libc-symbols.h (IN_MODULE): Define using + MODULE_NAME. + (PASTE_NAME, PASTE_NAME1): New macros. + * include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead + of IN_LIB. + (STAP_PROBE_ASM): Likewise. + 2014-11-23 Samuel Thibault * sysdeps/mach/hurd/i386/init-first.c (posixland_init): Call diff --git a/Makeconfig b/Makeconfig index 1a26cc5..bbf5460 100644 --- a/Makeconfig +++ b/Makeconfig @@ -830,9 +830,9 @@ in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \ libc)) module-cppflags-real = -include $(common-objpfx)libc-modules.h \ - -DIN_MODULE=MODULE_$(in-module) + -DMODULE_NAME=$(in-module) -# We don't need libc-modules.h and the IN_MODULE definition for +# We don't need libc-modules.h and the MODULE_NAME definition for # shlib-version.v.i. module-cppflags = $(if $(filter $(@F),$(skip-module-cppflags)), \ ,$(module-cppflags-real)) @@ -1008,7 +1008,7 @@ postclean-generated += soversions.mk soversions.i \ before-compile += $(common-objpfx)libc-modules.h ifeq ($(soversions.mk-done),t) # Generate a header with macro definitions for use with the IS_IN macro. -# These are the possible values for the IN_MODULE macro defined when building +# These are the possible values for the MODULE_NAME macro defined when building # sources, to identify which module the translation unit is going to be built # into. $(common-objpfx)libc-modules.h: $(common-objpfx)libc-modules.stmp; @: diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 9c5c9bb..5cbf473 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -20,8 +20,12 @@ #ifndef _LIBC_SYMBOLS_H #define _LIBC_SYMBOLS_H 1 +#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) #define IS_IN(lib) (IN_MODULE == MODULE_##lib) +#define PASTE_NAME(a,b) PASTE_NAME1 (a,b) +#define PASTE_NAME1(a,b) a##b + /* This file's macros are included implicitly in the compilation of every file in the C library by -imacros. diff --git a/include/stap-probe.h b/include/stap-probe.h index 688646c..150fc1e 100644 --- a/include/stap-probe.h +++ b/include/stap-probe.h @@ -30,7 +30,7 @@ Systemtap's header defines the macros STAP_PROBE (provider, name) and STAP_PROBEn (provider, name, arg1, ..., argn). For "provider" we paste - in the IN_LIB name (libc, libpthread, etc.) automagically. + in MODULE_NAME (libc, libpthread, etc.) automagically. The format of the arg parameters is discussed here: @@ -53,7 +53,7 @@ # endif # define LIBC_PROBE(name, n, ...) \ - LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__) + LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__) # define LIBC_PROBE_1(lib, name, n, ...) \ STAP_PROBE##n (lib, name, ## __VA_ARGS__) @@ -61,7 +61,7 @@ # define STAP_PROBE0 STAP_PROBE # define LIBC_PROBE_ASM(name, template) \ - STAP_PROBE_ASM (IN_LIB, name, template) + STAP_PROBE_ASM (MODULE_NAME, name, template) # define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS