From patchwork Sun Apr 16 21:01:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Mezentsev X-Patchwork-Id: 83932 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1738768vqo; Sun, 16 Apr 2023 14:01:46 -0700 (PDT) X-Google-Smtp-Source: AKy350Y3XiTkqbNQUloiSzCWx6CL7MraLHPuc0euqT6aKMbyO1C75xRFSzhdxLPAUwVbKG/zTSLU X-Received: by 2002:a17:906:3a82:b0:8a0:7158:15dc with SMTP id y2-20020a1709063a8200b008a0715815dcmr4525656ejd.74.1681678906401; Sun, 16 Apr 2023 14:01:46 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f25-20020a056402069900b0050508e6cf5asi8907438edy.79.2023.04.16.14.01.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Apr 2023 14:01:46 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=h1ZdqiNh; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38628385772C for ; Sun, 16 Apr 2023 21:01:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38628385772C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681678905; bh=gXskJp9v+OboVOUl7UsM3HgGF87kxP8f8SSxY7DsM+A=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=h1ZdqiNhwmF6d7J3FWXXDq95Anv3GzO/abiZzZHMqcJKG4mCYVsCQ2M6pQJW6ZkrH 8cUSHc31EFlQhd8W0E9amdKGJmIXaPFs167YWVV8eP28H6+YpAfdkh5Q/5OV4VVI+Z wK6ah1O7vthdXxq580I9XfoJ/hwMTKiZM8E2ZLL4= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 34BF93858D1E for ; Sun, 16 Apr 2023 21:01:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34BF93858D1E Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33GJjZiq020941 for ; Sun, 16 Apr 2023 21:01:33 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pyjuc1s13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 16 Apr 2023 21:01:32 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33GKfMpQ023094 for ; Sun, 16 Apr 2023 21:01:32 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3pyjc35c3d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 16 Apr 2023 21:01:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nPZtd4YggPrlhVN5Qu1s3Vjm4+Zxy6jB2S1HQqSwJYKvaz4C15lZMatRyGt6b/9ARzYNKRq61ftRBt4AhzNMa1Ixxi86Y0dfuL18+FhnEfFRKAD6qoBgSickqz8dwCTq5YXYBuNmmvm2Z5tQ//z3BV00Jj5olto03cqyr9OzUgCicoOrQO7+xwVf9c84ZiEwsJyr3Bj+CjTdlpZoQNaJPvcyq8/gXOBXknbDmjLGqYNLfL96wkq6l49Ru9qh5EAeqhKgq6QxVr/6MnhdUDC8ckj/QrOCV9aHbPAVs1n5Pfrcnkk2nH65HKz3BHyOuTkvk+u+HZRRXOj/N++cu8d9xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gXskJp9v+OboVOUl7UsM3HgGF87kxP8f8SSxY7DsM+A=; b=oIpynlFIpcf2C/ZSCZSHwTddX9BGzKiEMy53QRkzRLrDGtDFxDeCFRNR0GTQ5i1ztq3AJBKQaCt0zG7r1UFu3dRtSMrZGCXgcOB2LxxirQ2g+Xl9Z3QDJL1e5xIioHqRQJJjyEoAFUH2O1I8gD7sYWWzhi5YHcmYcF4gUlTql8T6A8x+DiiHQCT9NIEVte3qF44wLpQxuf0WO2zL6zdLUBS7Mg6q6s/zvX3UqIJNwz9YR1+sUHsCGnE03bD5J7Lqae0oWTkAhXnQSbuKQlvKuc1gntEeCzqTLWH2LxX30cQB+niy/dtsOd5V9H1OSoXbqhtYqjJ/T9BPUZpm4qJTGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) by DS7PR10MB4990.namprd10.prod.outlook.com (2603:10b6:5:3a5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Sun, 16 Apr 2023 21:01:28 +0000 Received: from SA2PR10MB4636.namprd10.prod.outlook.com ([fe80::d045:6fb:e0f4:631b]) by SA2PR10MB4636.namprd10.prod.outlook.com ([fe80::d045:6fb:e0f4:631b%3]) with mapi id 15.20.6298.030; Sun, 16 Apr 2023 21:01:27 +0000 To: binutils@sourceware.org Cc: Vladimir Mezentsev Subject: [Review is neded] gprofng: 30360 Seg. Fault when application uses std::thread Date: Sun, 16 Apr 2023 14:01:22 -0700 Message-Id: <20230416210122.3363899-1-vladimir.mezentsev@oracle.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: BY3PR04CA0017.namprd04.prod.outlook.com (2603:10b6:a03:217::22) To SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PR10MB4636:EE_|DS7PR10MB4990:EE_ X-MS-Office365-Filtering-Correlation-Id: bd244051-af63-440a-a96d-08db3ebdbecd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0M2Jl5ap7zn6wh4tNCjvf2ExasTwzu4bBRJoGDOCFOQxuOxAGb0ViPW3WL23mGCT63HGj/YPlImmB+TmYfxgJDCVK2w+5MBtG77kbdOiReNqUgAd3Isf16dvGEQb+SSt+bb3q2nF8yGRrrLiCB1W0jgQti/+28i3c6XPAulYq5CGfgAn/GhrEbwqtD/7uew5vpVeZwXI6SOlfgimuyAWiq3T9X8w3shco/OEhSgcqoiT4dEEtRz6EToM22CisQ6U0dSIJR+sSps+E3XVeVOFse4RvOA2WCUobQzn+LZyIE3hj7cDcoDvxWCn/9kacFRisrSZyKNwGd1Rd547lN6WKq6brwn75HFoPwyjolSCQwOJX0JzH1KAL4hN1pZwsJYLGiGcSpdV9VPay4jocE7bO+VXAa60FeuuhlUiue7n7WvOUNMoeTbgpXdP5D7JLMo2K3ZhD5HszS0ZpPqGgRNAiHIAHbiXekT9C0mI4XrARI+r69cOAPmdsXMFxswvdsa8SaUPldLii8P0eFcPuqr8JPC5xTtmOf/wm21L5HT6rWZJaIpW72xyAJ2aKYSNGX00 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4636.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(396003)(366004)(346002)(376002)(451199021)(38100700002)(8676002)(8936002)(5660300002)(2906002)(30864003)(36756003)(86362001)(478600001)(6486002)(6666004)(186003)(107886003)(2616005)(9686003)(6512007)(6506007)(1076003)(26005)(66476007)(66946007)(316002)(41300700001)(83380400001)(6916009)(4326008)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gnuRUb3d2/FTMCbPU/Tb9EwWoSk0DUFfQKnjrjftoc3qOBr8/VLLdEydxK2Bcjts09ClZqEHW4GkU6qol2qqfqONCng0ZHLBc2xbMt1IQTqnGYp3RumMlNQcmiWsTJAJnKXq5o0D/P6nSsVtWCx4vcIIPpu5LM4xkKOM6XZ9HDwuEkW7ROyT0wPBEomWx0cLokSvsTRHN4B/3I4FOv6ZoiPORsTH+mpdLLYrxgBfQFwRQ4bcQXR1240vdbTL74S/nsB8wphwHRUUdbEzWsiBXxCsN9BRStxMzPLqRXJki6hcYfN9o+wG0RN2V/1QzaMQO5JXFoGjiBftvc3+vLGXSJPLtwVgQeWHkhttCohoBC5Uga0GdPAFDEWO85qHfUUImjAekWFHwDjJ3sg5O5A0lz9GdK5YRc+rNsg33GJ3jLwtDorI3tcULmap8s3bPNVtwXR/dAm8P1foWfAWRdiA5TTaE3WWI+y0devy6j+WOgGx7QpV86nyheO7bazv8WQZOjCmyV1Glp2WnGY9Ix0iMipMC3Rk3YvxQcDbg1Wvg4Lm1XiCC0CtnytB62fOPi2wy2AUZfa/c/dHxgzHNdJx2roclxpoDsQIo0xU7yuqtooWaHxcKCC9CiLtq9K0c3iJ4tQFZgLVRpWQsoWcx0ad0uvCgE68iNsHg/iZgifvdTjrkHmtWqOs0Hs0hquP5cNe5rjOGBlwP55MJMntegjePscDVXQRupgmwmSIDGSn2zaxsujuVXsXI9wUEdIhiNnaqyGfB/afC3KAh6vWym6j+jnNLZfcn8cI5LRGfnIkzklIvqKUMlVwoE6C9AKNFV5c//pC9AlA18qGKFu2lV8/IgDf5n7pvMgQO5e2aj23CnxKWLdr7nLEZYqEIZHq9BtvC0QGQlw8Or+dmSBjN4/qzZzcF0PRWI6dmDlvB2DnRzKUc6irfxsEWZ98keXAeEQIAEO/HJ0tFGAmjObX8vtEpM245ikUMQLl7rl+z9sdrzT2O08ZF+STcR1cAkGLLtaMcNCKQmDurb4mIbXy2kCouHhUeDlxXA1J7xIaHucEBV1xbHCPAMu6jq90HS+3226jFmFJiQ+4HcEC6A0r1Mqtld0SMEio/Teq88+5ZzaMeu+I+hkjlCxQJvF4tSMR7dLhspDiPh2xlnlrZLXcLJyf6CJaEqF1jtTG/Nb+7M1lCPCXlIMeRw4/QV9tf0MThUE+lPYWausLwLeRY7v6+C5UX4ofxmAmZwxaqfnBjl1t6AKiv7ydzgtpvDdq90sGbUhJhlRlgqszppxar6rRl9P9LQP2PhId1tg/ijXbYLXoW4IX4xs48EYPJOxrw19t+H6x6w2A8WRIPWWQpil05PmyN2h3ex6lOHytkHg6KMb6t3o9RaZfm16lJiHBSf5Ebx3LelpwR0Q5Nqg4eUOrfNWaQ0mXBc6tgHj8ezFeYn9+4YuXQyvcl2e6bhOCa6TOiB6MSBWnQfrKBFnKUVHaSXjlJnmG2cO7dr94GqvHu0CHVGP8nB+PP9TbhPFjDi7nq0eil+EDWkOJZrn/kvlL8TAZWnklxPVhYIbNOkjd2SSrfywQ9G7J5iEKNaawAwoRVIUlf/IWICDTSZh2YCofPWkCQQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yRBpdS3lrF/Q34VhBqq5dAzoNhGeJyHExoFhNgg2d1Ou0KW0PvnWnjzql7Iiz6BUR7HMYTpELk2kz3GW13K4JIqqq7+bfTAJL/EPiM0kQd58M4SowV+7CmzAxV/cr46fYreXdR86rFIxcMpprxq6gTNppIO14lLbc7BJjoaGiyQZmruFcNW+z/g/nqrl5ZLk4D3oAPoOHKB3gQUEt6MZdNvu/Y5RV0gwR1+cr4n274gFvduTakFCLzW4pFuKRfnBEOn7tRmPinR+HfsnXkp6Y2SeB+3eVV2Pqf9Iluu5QpxaBPToerLJe/Q1xndysms0y5m5aGRBLgQeDHFXrTR7U6gJhChwDrHCwz+N29JNmKTSFRlm/ctkRPgvTRFJ1aaYDuEfga7prUIO3NXZr4L+7SC7DFYVpdug1GRX4VNRiIxil4RLk5iWTkPfxgUULEAXVcLuYZ0rsUc89s/ZUnITEzVNJ6sztyDiLkFVcYjvEKhfQ55kYNhDs3h6DmPzmQfl2VQsZ0gLQ6ebXzLToXyEZleMKRB7wqqcZfILKNi5MPGOEI31/lH5LJ2cQ3+PUfPk71Eq6FHYO+g//2SIQ6kY226WsqoNkFVKJDyajHv2AOZ7MhKRq4CRkPW7Nb6x1oc/I1yDCoIPAMdfadBWPqg/UrlVO1084MRf1xrjeGFvcMSTl4aJkIbJRLKBVQBG9VsMSjC60tyaapwKqXt1d0dqG10/fDf6G1F8P3q8tCIPZhVT/x/NvLwfbIS4ACYyxb+N X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd244051-af63-440a-a96d-08db3ebdbecd X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4636.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2023 21:01:27.6628 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nc+y0t/YwWNXfLT/42FotY7H+X0WDFmzdrg2h4XNx3+kEeTiGimsnB2snqvJ7AfA/ogbZwBwCa4BpdSTuousC7gvMvnY+U5hrfIG7zqFzW4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4990 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-16_12,2023-04-14_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304160199 X-Proofpoint-GUID: IJU_8tuoSIIgi6DUzx0yhz-XVrg2E2bl X-Proofpoint-ORIG-GUID: IJU_8tuoSIIgi6DUzx0yhz-XVrg2E2bl X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vladimir Mezentsev via Binutils From: Vladimir Mezentsev Reply-To: vladimir.mezentsev@oracle.com Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763368141038356508?= X-GMAIL-MSGID: =?utf-8?q?1763368141038356508?= From: Vladimir Mezentsev We interpose a lot of libC functions (dlopen, fork, pthread_create, etc.). Some of these functions have versions. For example, % nm -D /lib64/gprofng/libgp-collector.so | grep thread_create@ | sort 000000000004b420 T pthread_create@GLIBC_2.34 000000000004b490 T pthread_create@GLIBC_2.17 000000000004b500 T pthread_create@GLIBC_2.2.5 000000000004b570 T pthread_create@GLIBC_2.1 000000000004b5e0 T pthread_create@GLIBC_2.0 Our library does not set the default version for symbols. This is correct because we don't know which libC will be used. gcc and g++ links differently the version symbols when the default version is not set. c-linker is using our pthread_create@GLIBC_2.34 and c++-linker is using our pthread_create@GLIBC_2.0 by default. The current implementation of the interposed functions is: If we are in our pthread_create@GLIBC_, we use dlvsym (dlflag, "pthread_create", "GLIBC_") to find and call the same function from libC. In the test from PR 30360, pthread_create@GLIBC_2.0 is not in the current libC. We need to call the default version symbol from libC. gprofng/ChangeLog 2023-04-16 Vladimir Mezentsev PR gprofng/30360 * libcollector/iotrace.c: Find and call a default libC version symbol. * libcollector/dispatcher.c: Likewise. * libcollector/iotrace.c: Likewise. * libcollector/linetrace.c: Likewise. * libcollector/mmaptrace.c: Likewise. * libcollector/synctrace.c: Likewise. * libcollector/collector.h (REAL_DCL): Remove an unused argument. --- gprofng/libcollector/collector.h | 2 +- gprofng/libcollector/dispatcher.c | 35 ++++++++----- gprofng/libcollector/iotrace.c | 87 ++++++++++++++++++------------- gprofng/libcollector/linetrace.c | 50 ++++++++++++------ gprofng/libcollector/mmaptrace.c | 16 +++--- gprofng/libcollector/synctrace.c | 40 +++++++------- 6 files changed, 136 insertions(+), 94 deletions(-) diff --git a/gprofng/libcollector/collector.h b/gprofng/libcollector/collector.h index 12a6e15a733..4de7022be11 100644 --- a/gprofng/libcollector/collector.h +++ b/gprofng/libcollector/collector.h @@ -50,7 +50,7 @@ #else #define DCL_FUNC_VER(REAL_DCL, sym, ver) \ SYMVER_ATTRIBUTE (__collector_ ## sym, ver) \ - REAL_DCL (__collector_ ## sym, CALL_REAL (sym)) + REAL_DCL (__collector_ ## sym) #endif extern hrtime_t __collector_start_time; diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c index 82c4bb7a533..9bb694cabd7 100644 --- a/gprofng/libcollector/dispatcher.c +++ b/gprofng/libcollector/dispatcher.c @@ -695,7 +695,16 @@ init_interposition_intf () __real_pthread_sigmask_2_17 = dlvsym (dlflag, "pthread_sigmask", "GLIBC_2.17"); __real_pthread_sigmask_2_2_5 = dlvsym (dlflag, "pthread_sigmask", "GLIBC_2.2.5"); __real_pthread_sigmask_2_0 = dlvsym (dlflag, "pthread_sigmask", "GLIBC_2.0"); - __real_pthread_sigmask = dlsym (dlflag, "pthread_sigmask"); + if (__real_pthread_sigmask_2_32) + __real_pthread_sigmask = __real_pthread_sigmask_2_32; + else if (__real_pthread_sigmask_2_17) + __real_pthread_sigmask = __real_pthread_sigmask_2_17; + else if (__real_pthread_sigmask_2_2_5) + __real_pthread_sigmask = __real_pthread_sigmask_2_2_5; + else if (__real_pthread_sigmask_2_0) + __real_pthread_sigmask = __real_pthread_sigmask_2_0; + else + __real_pthread_sigmask = dlsym (dlflag, "pthread_sigmask"); __real_pthread_create_2_34 = dlvsym (dlflag, "pthread_create", "GLIBC_2.34"); __real_pthread_create_2_17 = dlvsym (dlflag, "pthread_create", "GLIBC_2.17"); @@ -922,12 +931,12 @@ gprofng_timer_create (int (real_func) (), clockid_t clockid, return -1; } -#define DCL_TIMER_CREATE(dcl_f, real_f) \ +#define DCL_TIMER_CREATE(dcl_f) \ int dcl_f (clockid_t clockid, struct sigevent *sevp, timer_t *timerid) \ { \ - if ((real_f) == NULL) \ + if (__real_timer_create == NULL) \ init_interposition_intf (); \ - return gprofng_timer_create (real_f, clockid, sevp, timerid); \ + return gprofng_timer_create (__real_timer_create, clockid, sevp, timerid); \ } DCL_FUNC_VER (DCL_TIMER_CREATE, timer_create_2_34, timer_create@GLIBC_2.34) @@ -935,7 +944,7 @@ DCL_FUNC_VER (DCL_TIMER_CREATE, timer_create_2_17, timer_create@GLIBC_2.17) DCL_FUNC_VER (DCL_TIMER_CREATE, timer_create_2_3_3, timer_create@GLIBC_2.3.3) DCL_FUNC_VER (DCL_TIMER_CREATE, timer_create_2_2_5, timer_create@GLIBC_2.2.5) DCL_FUNC_VER (DCL_TIMER_CREATE, timer_create_2_2, timer_create@GLIBC_2.2) -DCL_TIMER_CREATE (timer_create, CALL_REAL (timer_create)) +DCL_TIMER_CREATE (timer_create) /*------------------------------------------------------------- setitimer */ int @@ -1055,19 +1064,19 @@ gprofng_pthread_sigmask (int (real_func) (), } -#define DCL_PTHREAD_SIGMASK(dcl_f, real_f) \ +#define DCL_PTHREAD_SIGMASK(dcl_f) \ int dcl_f (int how, const sigset_t *iset, sigset_t* oset) \ { \ - if ((real_f) == NULL) \ + if (__real_pthread_sigmask == NULL) \ init_interposition_intf (); \ - return gprofng_pthread_sigmask (real_f, how, iset, oset); \ + return gprofng_pthread_sigmask (__real_pthread_sigmask, how, iset, oset); \ } DCL_FUNC_VER (DCL_PTHREAD_SIGMASK, pthread_sigmask_2_32, pthread_sigmask@GLIBC_2.32) DCL_FUNC_VER (DCL_PTHREAD_SIGMASK, pthread_sigmask_2_17, pthread_sigmask@GLIBC_2.17) DCL_FUNC_VER (DCL_PTHREAD_SIGMASK, pthread_sigmask_2_2_5, pthread_sigmask@GLIBC_2.2.5) DCL_FUNC_VER (DCL_PTHREAD_SIGMASK, pthread_sigmask_2_0, pthread_sigmask@GLIBC_2.0) -DCL_PTHREAD_SIGMASK (pthread_sigmask, CALL_REAL(pthread_sigmask)) +DCL_PTHREAD_SIGMASK (pthread_sigmask) /*----------------------------------------------------------- pthread_create */ typedef struct _CollectorArgs @@ -1154,13 +1163,13 @@ gprofng_pthread_create (int (real_func) (), pthread_t *thread, } -#define DCL_PTHREAD_CREATE(dcl_f, real_f) \ +#define DCL_PTHREAD_CREATE(dcl_f) \ int dcl_f (pthread_t *thread, const pthread_attr_t *attr, \ void *(*func)(void*), void *arg) \ { \ - if ((real_f) == NULL) \ + if (__real_pthread_create == NULL) \ init_interposition_intf (); \ - return gprofng_pthread_create (real_f, thread, attr, func, arg); \ + return gprofng_pthread_create (__real_pthread_create, thread, attr, func, arg); \ } DCL_FUNC_VER (DCL_PTHREAD_CREATE, pthread_create_2_34, pthread_create@GLIBC_2.34) @@ -1168,7 +1177,7 @@ DCL_FUNC_VER (DCL_PTHREAD_CREATE, pthread_create_2_17, pthread_create@GLIBC_2.17 DCL_FUNC_VER (DCL_PTHREAD_CREATE, pthread_create_2_2_5, pthread_create@GLIBC_2.2.5) DCL_FUNC_VER (DCL_PTHREAD_CREATE, pthread_create_2_1, pthread_create@GLIBC_2.1) DCL_FUNC_VER (DCL_PTHREAD_CREATE, pthread_create_2_0, pthread_create@GLIBC_2.0) -DCL_PTHREAD_CREATE (pthread_create, CALL_REAL (pthread_create)) +DCL_PTHREAD_CREATE (pthread_create) int __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags, void *arg, diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c index d27f8524d7d..c0ea7497b09 100644 --- a/gprofng/libcollector/iotrace.c +++ b/gprofng/libcollector/iotrace.c @@ -450,6 +450,21 @@ init_io_intf () else __real_fgetpos64 = dlsym (dlflag, "fgetpos64"); + __real_fsetpos64_2_17 = dlvsym (dlflag, "fsetpos64", "GLIBC_2.17"); + __real_fsetpos64_2_2_5 = dlvsym (dlflag, "fsetpos64", "GLIBC_2.2.5"); + __real_fsetpos64_2_2 = dlvsym (dlflag, "fsetpos64", "GLIBC_2.2"); + __real_fsetpos64_2_1 = dlvsym (dlflag, "fsetpos64", "GLIBC_2.1"); + if (__real_fsetpos64_2_17) + __real_fsetpos64 = __real_fsetpos64_2_17; + else if (__real_fsetpos64_2_2_5) + __real_fsetpos64 = __real_fsetpos64_2_2_5; + else if (__real_fsetpos64_2_2) + __real_fsetpos64 = __real_fsetpos64_2_2; + else if (__real_fsetpos64_2_1) + __real_fsetpos64 = __real_fsetpos64_2_1; + else + __real_fsetpos64 = dlsym (dlflag, "fsetpos64"); + __real_pread_2_2 = dlvsym (dlflag, "pread", "GLIBC_2.2"); if (__real_pread_2_2) __real_pread = __real_pread_2_2; @@ -1001,21 +1016,21 @@ gprofng_open64 (int(real_open64) (const char *, int, ...), return fd; } -#define DCL_OPEN64(dcl_f, real_f) \ +#define DCL_OPEN64(dcl_f) \ int dcl_f (const char *path, int oflag, ...) \ { \ - if ((real_f) == NULL) \ + if (__real_open64 == NULL) \ init_io_intf (); \ mode_t mode; \ va_list ap; \ va_start (ap, oflag); \ mode = va_arg (ap, mode_t); \ va_end (ap); \ - return gprofng_open64 (real_f, path, oflag, mode); \ + return gprofng_open64 (__real_open64, path, oflag, mode); \ } DCL_FUNC_VER (DCL_OPEN64, open64_2_2, open64@GLIBC_2.2) -DCL_OPEN64 (open64, CALL_REAL(open64)) +DCL_OPEN64 (open64) #define F_ERROR_ARG 0 @@ -1516,19 +1531,19 @@ gprofng_fopen (FILE*(real_fopen) (), const char *filename, const char *mode) return fp; } -#define DCL_FOPEN(dcl_f, real_f) \ +#define DCL_FOPEN(dcl_f) \ FILE *dcl_f (const char *filename, const char *mode) \ { \ - if ((real_f) == NULL) \ + if (__real_fopen == NULL) \ init_io_intf (); \ - return gprofng_fopen (real_f, filename, mode); \ + return gprofng_fopen (__real_fopen, filename, mode); \ } DCL_FUNC_VER (DCL_FOPEN, fopen_2_17, fopen@GLIBC_2.17) DCL_FUNC_VER (DCL_FOPEN, fopen_2_2_5, fopen@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FOPEN, fopen_2_1, fopen@GLIBC_2.1) DCL_FUNC_VER (DCL_FOPEN, fopen_2_0, fopen@GLIBC_2.0) -DCL_FOPEN (fopen, CALL_REAL(fopen)) +DCL_FOPEN (fopen) /*------------------------------------------------------------- fclose */ static int @@ -1564,19 +1579,19 @@ gprofng_fclose (int(real_fclose) (), FILE *stream) return stat; } -#define DCL_FCLOSE(dcl_f, real_f) \ +#define DCL_FCLOSE(dcl_f) \ int dcl_f (FILE *stream) \ { \ - if ((real_f) == NULL) \ + if (__real_fclose == NULL) \ init_io_intf (); \ - return gprofng_fclose (real_f, stream); \ + return gprofng_fclose (__real_fclose, stream); \ } DCL_FUNC_VER (DCL_FCLOSE, fclose_2_17, fclose@GLIBC_2.17) DCL_FUNC_VER (DCL_FCLOSE, fclose_2_2_5, fclose@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FCLOSE, fclose_2_1, fclose@GLIBC_2.1) DCL_FUNC_VER (DCL_FCLOSE, fclose_2_0, fclose@GLIBC_2.0) -DCL_FCLOSE (fclose, CALL_REAL(fclose)) +DCL_FCLOSE (fclose) /*------------------------------------------------------------- fflush */ int @@ -1653,19 +1668,19 @@ gprofng_fdopen (FILE*(real_fdopen) (), int fildes, const char *mode) return fp; } -#define DCL_FDOPEN(dcl_f, real_f) \ +#define DCL_FDOPEN(dcl_f) \ FILE *dcl_f (int fildes, const char *mode) \ { \ - if ((real_f) == NULL) \ + if (__real_fdopen == NULL) \ init_io_intf (); \ - return gprofng_fdopen (real_f, fildes, mode); \ + return gprofng_fdopen (__real_fdopen, fildes, mode); \ } DCL_FUNC_VER (DCL_FDOPEN, fdopen_2_17, fdopen@GLIBC_2.17) DCL_FUNC_VER (DCL_FDOPEN, fdopen_2_2_5, fdopen@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FDOPEN, fdopen_2_1, fdopen@GLIBC_2.1) DCL_FUNC_VER (DCL_FDOPEN, fdopen_2_0, fdopen@GLIBC_2.0) -DCL_FDOPEN (fdopen, CALL_REAL(fdopen)) +DCL_FDOPEN (fdopen) /*------------------------------------------------------------- dup */ int @@ -2088,16 +2103,16 @@ gprofng_pread (ssize_t(real_pread) (int, void *, size_t, off_t), return ret; } -#define DCL_PREAD(dcl_f, real_f) \ +#define DCL_PREAD(dcl_f) \ ssize_t dcl_f (int fildes, void *buf, size_t nbyte, off_t offset) \ { \ - if ((real_f) == NULL) \ + if (__real_pread == NULL) \ init_io_intf (); \ - return gprofng_pread (real_f, fildes, buf, nbyte, offset); \ + return gprofng_pread (__real_pread, fildes, buf, nbyte, offset); \ } DCL_FUNC_VER (DCL_PREAD, pread_2_2, pread@GLIBC_2.2) -DCL_PREAD (pread, CALL_REAL(pread)) +DCL_PREAD (pread) /*------------------------------------------------------------- pwrite */ @@ -2914,19 +2929,19 @@ gprofng_fgetpos (int(real_fgetpos) (FILE *stream, fpos_t *pos), return ret; } -#define DCL_FGETPOS(dcl_f, real_f) \ +#define DCL_FGETPOS(dcl_f) \ int dcl_f (FILE *stream, fpos_t *pos) \ { \ - if ((real_f) == NULL) \ + if (__real_fgetpos == NULL) \ init_io_intf (); \ - return gprofng_fgetpos (real_f, stream, pos); \ + return gprofng_fgetpos (__real_fgetpos, stream, pos); \ } DCL_FUNC_VER (DCL_FGETPOS, fgetpos_2_17, fgetpos@GLIBC_2.17) DCL_FUNC_VER (DCL_FGETPOS, fgetpos_2_2_5, fgetpos@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FGETPOS, fgetpos_2_2, fgetpos@GLIBC_2.2) DCL_FUNC_VER (DCL_FGETPOS, fgetpos_2_0, fgetpos@GLIBC_2.0) -DCL_FGETPOS (fgetpos, CALL_REAL(fgetpos)) +DCL_FGETPOS (fgetpos) /*------------------------------------------------------------- fgetpos64 */ static int @@ -2962,19 +2977,19 @@ gprofng_fgetpos64 (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos) return ret; } -#define DCL_FGETPOS64(dcl_f, real_f) \ +#define DCL_FGETPOS64(dcl_f) \ int dcl_f (FILE *stream, fpos64_t *pos) \ { \ - if ((real_f) == NULL) \ + if (__real_fgetpos64 == NULL) \ init_io_intf (); \ - return gprofng_fgetpos64 (real_f, stream, pos); \ + return gprofng_fgetpos64 (__real_fgetpos64, stream, pos); \ } DCL_FUNC_VER (DCL_FGETPOS64, fgetpos64_2_17, fgetpos64@GLIBC_2.17) DCL_FUNC_VER (DCL_FGETPOS64, fgetpos64_2_2_5, fgetpos64@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FGETPOS64, fgetpos64_2_2, fgetpos64@GLIBC_2.2) DCL_FUNC_VER (DCL_FGETPOS64, fgetpos64_2_1, fgetpos64@GLIBC_2.1) -DCL_FGETPOS64 (fgetpos64, CALL_REAL(fgetpos64)) +DCL_FGETPOS64 (fgetpos64) /*------------------------------------------------------------- fsetpos */ static int @@ -3011,19 +3026,19 @@ gprofng_fsetpos (int(real_fsetpos) (FILE *, const fpos_t *), return ret; } -#define DCL_FSETPOS(dcl_f, real_f) \ +#define DCL_FSETPOS(dcl_f) \ int dcl_f (FILE *stream, const fpos_t *pos) \ { \ - if ((real_f) == NULL) \ + if (__real_fsetpos == NULL) \ init_io_intf (); \ - return gprofng_fsetpos (real_f, stream, pos); \ + return gprofng_fsetpos (__real_fsetpos, stream, pos); \ } DCL_FUNC_VER (DCL_FSETPOS, fsetpos_2_17, fsetpos@GLIBC_2.17) DCL_FUNC_VER (DCL_FSETPOS, fsetpos_2_2_5, fsetpos@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FSETPOS, fsetpos_2_2, fsetpos@GLIBC_2.2) DCL_FUNC_VER (DCL_FSETPOS, fsetpos_2_0, fsetpos@GLIBC_2.0) -DCL_FSETPOS (fsetpos, CALL_REAL(fsetpos)) +DCL_FSETPOS (fsetpos) /*------------------------------------------------------------- fsetpos64 */ static int @@ -3060,19 +3075,19 @@ gprofng_fsetpos64 (int(real_fsetpos64) (FILE *, const fpos64_t *), return ret; } -#define DCL_FSETPOS64(dcl_f, real_f) \ +#define DCL_FSETPOS64(dcl_f) \ int dcl_f (FILE *stream, const fpos64_t *pos) \ { \ - if ((real_f) == NULL) \ + if (__real_fsetpos64 == NULL) \ init_io_intf (); \ - return gprofng_fsetpos64 (real_f, stream, pos); \ + return gprofng_fsetpos64 (__real_fsetpos64, stream, pos); \ } DCL_FUNC_VER (DCL_FSETPOS64, fsetpos64_2_17, fsetpos64@GLIBC_2.17) DCL_FUNC_VER (DCL_FSETPOS64, fsetpos64_2_2_5, fsetpos64@GLIBC_2.2.5) DCL_FUNC_VER (DCL_FSETPOS64, fsetpos64_2_2, fsetpos64@GLIBC_2.2) DCL_FUNC_VER (DCL_FSETPOS64, fsetpos64_2_1, fsetpos64@GLIBC_2.1) -DCL_FSETPOS64 (fsetpos64, CALL_REAL(fsetpos64)) +DCL_FSETPOS64 (fsetpos64) /*------------------------------------------------------------- fsync */ int diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetrace.c index b29e0b93591..917bc95f6c9 100644 --- a/gprofng/libcollector/linetrace.c +++ b/gprofng/libcollector/linetrace.c @@ -682,8 +682,6 @@ init_lineage_intf () __real_execlp = dlsym (dlflag, "execlp"); __real_execl = dlsym (dlflag, "execl"); __real_clone = dlsym (dlflag, "clone"); - __real_posix_spawn = dlsym (dlflag, "posix_spawn"); - __real_posix_spawnp = dlsym (dlflag, "posix_spawnp"); __real_popen_2_17 = dlvsym (dlflag, "popen", "GLIBC_2.17"); __real_popen_2_2_5 = dlvsym (dlflag, "popen", "GLIBC_2.2.5"); @@ -704,11 +702,31 @@ init_lineage_intf () __real_posix_spawn_2_15 = dlvsym (dlflag, "posix_spawn", "GLIBC_2.15"); __real_posix_spawn_2_2_5 = dlvsym (dlflag, "posix_spawn", "GLIBC_2.2.5"); __real_posix_spawn_2_2 = dlvsym (dlflag, "posix_spawn", "GLIBC_2.2"); + if (__real_posix_spawn_2_17) + __real_posix_spawn = __real_posix_spawn_2_17; + else if (__real_posix_spawn_2_15) + __real_posix_spawn = __real_posix_spawn_2_15; + else if (__real_posix_spawn_2_2_5) + __real_posix_spawn = __real_posix_spawn_2_2_5; + else if (__real_posix_spawn_2_2) + __real_posix_spawn = __real_posix_spawn_2_2; + else + __real_posix_spawn = dlsym (dlflag, "posix_spawn"); __real_posix_spawnp_2_17 = dlvsym (dlflag, "posix_spawnp", "GLIBC_2.17"); __real_posix_spawnp_2_15 = dlvsym (dlflag, "posix_spawnp", "GLIBC_2.15"); __real_posix_spawnp_2_2_5 = dlvsym (dlflag, "posix_spawnp", "GLIBC_2.2.5"); __real_posix_spawnp_2_2 = dlvsym (dlflag, "posix_spawnp", "GLIBC_2.2"); + if (__real_posix_spawnp_2_17) + __real_posix_spawnp = __real_posix_spawnp_2_17; + else if (__real_posix_spawnp_2_15) + __real_posix_spawnp = __real_posix_spawnp_2_15; + else if (__real_posix_spawnp_2_2_5) + __real_posix_spawnp = __real_posix_spawnp_2_2_5; + else if (__real_posix_spawnp_2_2) + __real_posix_spawnp = __real_posix_spawnp_2_2; + else + __real_posix_spawnp = dlsym (dlflag, "posix_spawnp"); __real_grantpt = dlsym (dlflag, "grantpt"); __real_ptsname = dlsym (dlflag, "ptsname"); @@ -1427,16 +1445,16 @@ gprofng_posix_spawn (int(real_posix_spawn) (), return ret; } -#define DCL_POSIX_SPAWN(dcl_f, real_f) \ +#define DCL_POSIX_SPAWN(dcl_f) \ int dcl_f (pid_t *pidp, const char *path, \ const posix_spawn_file_actions_t *file_actions, \ const posix_spawnattr_t *attrp, \ char *const argv[], char *const envp[]) \ { \ - if ((real_f) == NULL) \ + if (__real_posix_spawn == NULL) \ init_lineage_intf (); \ - return gprofng_posix_spawn (real_f, pidp, path, file_actions, attrp, \ - argv, envp); \ + return gprofng_posix_spawn (__real_posix_spawn, pidp, path, file_actions, \ + attrp, argv, envp); \ } @@ -1444,7 +1462,7 @@ DCL_FUNC_VER (DCL_POSIX_SPAWN, posix_spawn_2_17, posix_spawn@GLIBC_2.17) DCL_FUNC_VER (DCL_POSIX_SPAWN, posix_spawn_2_15, posix_spawn@GLIBC_2.15) DCL_FUNC_VER (DCL_POSIX_SPAWN, posix_spawn_2_2_5, posix_spawn@GLIBC_2.2.5) DCL_FUNC_VER (DCL_POSIX_SPAWN, posix_spawn_2_2, posix_spawn@GLIBC_2.2) -DCL_POSIX_SPAWN (posix_spawn, CALL_REAL (posix_spawn)) +DCL_POSIX_SPAWN (posix_spawn) /*-------------------------------------------------------- posix_spawnp */ static int @@ -1484,15 +1502,15 @@ gprofng_posix_spawnp (int (real_posix_spawnp) (), return ret; } -#define DCL_POSIX_SPAWNP(dcl_f, real_f) \ +#define DCL_POSIX_SPAWNP(dcl_f) \ int dcl_f (pid_t *pidp, const char *path, \ const posix_spawn_file_actions_t *file_actions, \ const posix_spawnattr_t *attrp, \ char *const argv[], char *const envp[]) \ { \ - if ((real_f) == NULL) \ + if (__real_posix_spawnp == NULL) \ init_lineage_intf (); \ - return gprofng_posix_spawnp (real_f, pidp, path, \ + return gprofng_posix_spawnp (__real_posix_spawnp, pidp, path, \ file_actions, attrp, argv, envp); \ } @@ -1500,7 +1518,7 @@ DCL_FUNC_VER (DCL_POSIX_SPAWNP, posix_spawnp_2_17, posix_spawnp@GLIBC_2.17) DCL_FUNC_VER (DCL_POSIX_SPAWNP, posix_spawnp_2_15, posix_spawnp@GLIBC_2.15) DCL_FUNC_VER (DCL_POSIX_SPAWNP, posix_spawnp_2_2_5, posix_spawnp@GLIBC_2.2.5) DCL_FUNC_VER (DCL_POSIX_SPAWNP, posix_spawnp_2_2, posix_spawnp@GLIBC_2.2) -DCL_POSIX_SPAWNP (posix_spawnp, CALL_REAL (posix_spawnp)) +DCL_POSIX_SPAWNP (posix_spawnp) /*------------------------------------------------------------- system */ int system () __attribute__ ((weak, alias ("__collector_system"))); @@ -1529,10 +1547,10 @@ __collector_system (const char *cmd) /*------------------------------------------------------------- popen */ // map interposed symbol versions -#define DCL_POPEN(dcl_f, real_f) \ +#define DCL_POPEN(dcl_f) \ FILE *dcl_f (const char *cmd, const char *mode) \ { \ - if ((real_f) == NULL) \ + if (__real_popen == NULL) \ init_lineage_intf (); \ TprintfT (DBG_LT0, #dcl_f " (%s) interposing: line_mode=%d combo=%d\n", \ cmd ? cmd : "NULL", line_mode, get_combo_flag ()); \ @@ -1540,11 +1558,11 @@ __collector_system (const char *cmd) if (line_mode == LM_TRACK_LINEAGE) \ INIT_REENTRANCE (guard); \ if (guard == NULL) \ - return (real_f) (cmd, mode); \ + return __real_popen (cmd, mode); \ int following_combo = 0; \ linetrace_ext_combo_prologue ("popen", cmd, &following_combo); \ PUSH_REENTRANCE (guard); \ - FILE *ret = (real_f) (cmd, mode); \ + FILE *ret = __real_popen (cmd, mode); \ POP_REENTRANCE (guard); \ linetrace_ext_combo_epilogue ("popen", ret == NULL ? -1 : 0, \ &following_combo); \ @@ -1555,7 +1573,7 @@ DCL_FUNC_VER (DCL_POPEN, popen_2_17, popen@GLIBC_2.17) DCL_FUNC_VER (DCL_POPEN, popen_2_2_5, popen@GLIBC_2.2.5) DCL_FUNC_VER (DCL_POPEN, popen_2_1, popen@GLIBC_2.1) DCL_FUNC_VER (DCL_POPEN, popen_2_0, popen@GLIBC_2.0) -DCL_POPEN (popen, CALL_REAL (popen)) +DCL_POPEN (popen) /*------------------------------------------------------------- grantpt */ int grantpt () __attribute__ ((weak, alias ("__collector_grantpt"))); diff --git a/gprofng/libcollector/mmaptrace.c b/gprofng/libcollector/mmaptrace.c index f81ff8db1df..b7ad2dbe08f 100644 --- a/gprofng/libcollector/mmaptrace.c +++ b/gprofng/libcollector/mmaptrace.c @@ -1609,13 +1609,13 @@ gprofng_dlopen (void*(real_dlopen) (const char *, int), return ret; } -#define DCL_DLOPEN(dcl_f, real_f) \ +#define DCL_DLOPEN(dcl_f) \ void *dcl_f (const char *pathname, int mode) \ { \ - if ((real_f) == NULL) \ + if (__real_dlopen == NULL) \ init_mmap_intf (); \ void *caller = __builtin_return_address (0); \ - return gprofng_dlopen (real_f, caller, pathname, mode); \ + return gprofng_dlopen (__real_dlopen, caller, pathname, mode); \ } DCL_FUNC_VER (DCL_DLOPEN, dlopen_2_34, dlopen@GLIBC_2.34) @@ -1623,7 +1623,7 @@ DCL_FUNC_VER (DCL_DLOPEN, dlopen_2_17, dlopen@GLIBC_2.17) DCL_FUNC_VER (DCL_DLOPEN, dlopen_2_2_5, dlopen@GLIBC_2.2.5) DCL_FUNC_VER (DCL_DLOPEN, dlopen_2_1, dlopen@GLIBC_2.1) DCL_FUNC_VER (DCL_DLOPEN, dlopen_2_0, dlopen@GLIBC_2.0) -DCL_DLOPEN (dlopen, CALL_REAL (dlopen)) +DCL_DLOPEN (dlopen) /*------------------------------------------------------------- dlclose */ static int @@ -1651,16 +1651,16 @@ gprofng_dlclose (int (real_dlclose) (void *), void *handle) return ret; } -#define DCL_DLCLOSE(dcl_f, real_f) \ +#define DCL_DLCLOSE(dcl_f) \ int dcl_f (void *handle) \ { \ - if ((real_f) == NULL) \ + if (__real_dlclose == NULL) \ init_mmap_intf (); \ - return gprofng_dlclose (real_f, handle); \ + return gprofng_dlclose (__real_dlclose, handle); \ } DCL_FUNC_VER (DCL_DLCLOSE, dlclose_2_34, dlclose@GLIBC_2.34) DCL_FUNC_VER (DCL_DLCLOSE, dlclose_2_17, dlclose@GLIBC_2.17) DCL_FUNC_VER (DCL_DLCLOSE, dlclose_2_2_5, dlclose@GLIBC_2.2.5) DCL_FUNC_VER (DCL_DLCLOSE, dlclose_2_0, dlclose@GLIBC_2.0) -DCL_DLCLOSE (dlclose, CALL_REAL (dlclose)) +DCL_DLCLOSE (dlclose) diff --git a/gprofng/libcollector/synctrace.c b/gprofng/libcollector/synctrace.c index a00691fd958..565afbe742f 100644 --- a/gprofng/libcollector/synctrace.c +++ b/gprofng/libcollector/synctrace.c @@ -607,18 +607,18 @@ gprofng_pthread_mutex_lock (int (real_func) (pthread_mutex_t *), return ret; } -#define DCL_PTHREAD_MUTEX_LOCK(dcl_f, real_f) \ +#define DCL_PTHREAD_MUTEX_LOCK(dcl_f) \ int dcl_f (pthread_mutex_t *mp) \ { \ - if ((real_f) == NULL) \ + if (__real_pthread_mutex_lock == NULL) \ init_thread_intf (); \ - return gprofng_pthread_mutex_lock (real_f, mp); \ + return gprofng_pthread_mutex_lock (__real_pthread_mutex_lock, mp); \ } DCL_FUNC_VER (DCL_PTHREAD_MUTEX_LOCK, pthread_mutex_lock_2_17, pthread_mutex_lock@GLIBC_2.17) DCL_FUNC_VER (DCL_PTHREAD_MUTEX_LOCK, pthread_mutex_lock_2_2_5, pthread_mutex_lock@GLIBC_2.2.5) DCL_FUNC_VER (DCL_PTHREAD_MUTEX_LOCK, pthread_mutex_lock_2_0, pthread_mutex_lock@GLIBC_2.0) -DCL_PTHREAD_MUTEX_LOCK (pthread_mutex_lock, CALL_REAL (pthread_mutex_lock)) +DCL_PTHREAD_MUTEX_LOCK (pthread_mutex_lock) /*------------------------------------------------------------- pthread_cond_wait */ static int @@ -654,19 +654,19 @@ gprofng_pthread_cond_wait (int(real_func) (pthread_cond_t *, pthread_mutex_t *), return ret; } -#define DCL_PTHREAD_COND_WAIT(dcl_f, real_f) \ +#define DCL_PTHREAD_COND_WAIT(dcl_f) \ int dcl_f (pthread_cond_t *cond, pthread_mutex_t *mutex) \ { \ - if ((real_f) == NULL) \ + if (__real_pthread_cond_wait == NULL) \ init_thread_intf (); \ - return gprofng_pthread_cond_wait (real_f, cond, mutex); \ + return gprofng_pthread_cond_wait (__real_pthread_cond_wait, cond, mutex); \ } DCL_FUNC_VER (DCL_PTHREAD_COND_WAIT, pthread_cond_wait_2_17, pthread_cond_wait@GLIBC_2.17) DCL_FUNC_VER (DCL_PTHREAD_COND_WAIT, pthread_cond_wait_2_3_2, pthread_cond_wait@GLIBC_2.3.2) DCL_FUNC_VER (DCL_PTHREAD_COND_WAIT, pthread_cond_wait_2_2_5, pthread_cond_wait@GLIBC_2.2.5) DCL_FUNC_VER (DCL_PTHREAD_COND_WAIT, pthread_cond_wait_2_0, pthread_cond_wait@GLIBC_2.0) -DCL_PTHREAD_COND_WAIT (pthread_cond_wait, CALL_REAL (pthread_cond_wait)) +DCL_PTHREAD_COND_WAIT (pthread_cond_wait) /*---------------------------------------------------- pthread_cond_timedwait */ static int @@ -704,20 +704,20 @@ gprofng_pthread_cond_timedwait (int(real_func) (pthread_cond_t *, return ret; } -#define DCL_PTHREAD_COND_TIMEDWAIT(dcl_f, real_f) \ +#define DCL_PTHREAD_COND_TIMEDWAIT(dcl_f) \ int dcl_f (pthread_cond_t *cond, pthread_mutex_t *mutex, \ const struct timespec *abstime) \ { \ - if ((real_f) == NULL) \ + if (__real_pthread_cond_timedwait == NULL) \ init_thread_intf (); \ - return gprofng_pthread_cond_timedwait (real_f, cond, mutex, abstime); \ + return gprofng_pthread_cond_timedwait (__real_pthread_cond_timedwait, cond, mutex, abstime); \ } DCL_FUNC_VER (DCL_PTHREAD_COND_TIMEDWAIT, pthread_cond_timedwait_2_17, pthread_cond_timedwait@GLIBC_2.17) DCL_FUNC_VER (DCL_PTHREAD_COND_TIMEDWAIT, pthread_cond_timedwait_2_3_2, pthread_cond_timedwait@GLIBC_2.3.2) DCL_FUNC_VER (DCL_PTHREAD_COND_TIMEDWAIT, pthread_cond_timedwait_2_2_5, pthread_cond_timedwait@GLIBC_2.2.5) DCL_FUNC_VER (DCL_PTHREAD_COND_TIMEDWAIT, pthread_cond_timedwait_2_0, pthread_cond_timedwait@GLIBC_2.0) -DCL_PTHREAD_COND_TIMEDWAIT (pthread_cond_timedwait, CALL_REAL (pthread_cond_timedwait)) +DCL_PTHREAD_COND_TIMEDWAIT (pthread_cond_timedwait) /*------------------------------------------------------------- pthread_join */ @@ -753,19 +753,19 @@ gprofng_pthread_join (int(real_func) (pthread_t, void **), return ret; } -#define DCL_PTHREAD_JOIN(dcl_f, real_f) \ +#define DCL_PTHREAD_JOIN(dcl_f) \ int dcl_f (pthread_t target_thread, void **status) \ { \ - if ((real_f) == NULL) \ + if (__real_pthread_join == NULL) \ init_thread_intf (); \ - return gprofng_pthread_join (real_f, target_thread, status); \ + return gprofng_pthread_join (__real_pthread_join, target_thread, status); \ } DCL_FUNC_VER (DCL_PTHREAD_JOIN, pthread_join_2_34, pthread_join@GLIBC_2.34) DCL_FUNC_VER (DCL_PTHREAD_JOIN, pthread_join_2_17, pthread_join@GLIBC_2.17) DCL_FUNC_VER (DCL_PTHREAD_JOIN, pthread_join_2_2_5, pthread_join@GLIBC_2.2.5) DCL_FUNC_VER (DCL_PTHREAD_JOIN, pthread_join_2_0, pthread_join@GLIBC_2.0) -DCL_PTHREAD_JOIN (pthread_join, CALL_REAL (pthread_join)) +DCL_PTHREAD_JOIN (pthread_join) /*------------------------------------------------------------- sem_wait */ static int @@ -800,12 +800,12 @@ gprofng_sem_wait (int (real_func) (sem_t *), sem_t *sp) return ret; } -#define DCL_SEM_WAIT(dcl_f, real_f) \ +#define DCL_SEM_WAIT(dcl_f) \ int dcl_f (sem_t *sp) \ { \ - if ((real_f) == NULL) \ + if (__real_sem_wait == NULL) \ init_thread_intf (); \ - return gprofng_sem_wait (real_f, sp); \ + return gprofng_sem_wait (__real_sem_wait, sp); \ } DCL_FUNC_VER (DCL_SEM_WAIT, sem_wait_2_34, sem_wait@GLIBC_2.34) @@ -813,4 +813,4 @@ DCL_FUNC_VER (DCL_SEM_WAIT, sem_wait_2_17, sem_wait@GLIBC_2.17) DCL_FUNC_VER (DCL_SEM_WAIT, sem_wait_2_2_5, sem_wait@GLIBC_2.2.5) DCL_FUNC_VER (DCL_SEM_WAIT, sem_wait_2_0, sem_wait@GLIBC_2.0) DCL_FUNC_VER (DCL_SEM_WAIT, sem_wait_2_1, sem_wait@GLIBC_2.1) -DCL_SEM_WAIT (sem_wait, CALL_REAL (sem_wait)) +DCL_SEM_WAIT (sem_wait)