From patchwork Wed Apr 17 20:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 88613 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 476213870886 for ; Wed, 17 Apr 2024 20:26:46 +0000 (GMT) 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 450AF3858D39 for ; Wed, 17 Apr 2024 20:21:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 450AF3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 450AF3858D39 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713385322; cv=pass; b=b62xLFbQm5f5UOW0h0yRcRU9Sh2nFRw5KLGJHuwTzGAK7qCwCnzGlPb3m3fMA3GnV2VSWQByVP0TeXjpWHrtIiRV31wX/wNe0BMsEsgEh2Y2nZ5xU291yzqKaQEF9Iq2YtnrICkgC25K06a1o92z3x303PGAJGgxN4YMEuDw+AQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713385322; c=relaxed/simple; bh=qdQo5k5ef05WmaQUX3ZiR3A+QL1FAZpkkllyxrGlNOw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=nr8kpa2PGpH1evaPo695uf07I25z/K5TNG1WL/i/1IhhLqCr01rWnigWcER85vtjFG1xAIXnVMH197KADT5f2yinDY8DMzF1S5Y5gKt7par0k+dAcuziSvge6C/GTx0F+DCzsKufQM5e1wi0qsVXF/RrV17yKIcZSRi96yIWVU8= ARC-Authentication-Results: i=2; server2.sourceware.org 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 43HHiV0u011079; Wed, 17 Apr 2024 20:21:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=jQzjz07EcJT5PzMrIkL9/6WUuth/ZD9hSQcBMApaq0E=; b=O+D6kW8+41EHBtjgGNETBw+NUwdQ5RwbzZ4N0hqGpyLmzvqE3bpDrUh4BfLH6ndmjUXK 76xd6cdPi3stXUbpuF1XFxA1y85c3/IbobY7hXfIQLNHCwemPhdk7zz8kObLkpXQblOh 5z1IRSpv+0XHEUHFihVgGd5+lzgXyGnhmDJdQQ3ojaALuFMJb/Q27M4vuh1ECD/vvo0S 6n+Y1khsmjoVmZPOfKZtDa4/91X3XOCsXs7Mis88uf52JIP05fIPvRvATF0bepLix82W FBP6z8Aim9XSmocc+x9PAAHPceBU6jA+nycR3EcE2BQazMwgP8MUdv3rOeUVof4iXecN Uw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xfgycrvcg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Apr 2024 20:21:56 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43HKCH0Y004289; Wed, 17 Apr 2024 20:21:54 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xfggfnrhg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Apr 2024 20:21:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N0+pmnP4oxFfj5Z8vyRIgBoU+q1G5fUEIaq7UdNhn81kH0axOlFboCe+3AKhngC8hzMI7x1fvuL0mC9G2uZ4hxTPPpmBJJJjEadvWFBWxDUWqlwB3X3g78SxiEBNVI4Qd4zZAlzkjFsOsPQkFu47YXzZlr7mTOMjATbBJntBc4DfjAw4KeH79ChWbb365z386PMLq/Ivn0gMOSYwQo0phcCXTJcDaozg+vOIKlsttU4olgIVPPw8vBwkt9AZbljrMJAWybZFpHJ2k94fibWplu9bS/Dw7uYPP/wfD0PQdKwYDSqTBeAZIiM5+QxXvvbdP5ZqxxOASdqJgHUqF99rug== 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=jQzjz07EcJT5PzMrIkL9/6WUuth/ZD9hSQcBMApaq0E=; b=mSiZccXNE2FO31PDuENCtpTx5Epmf5nMd44JDAm42/UgTeCoQdVDslLULKg5N4oATlmxtIEWH4oC20N2CIYLnG8TzteRiXGIJkMGh9QzPMGjjMl6W4e0aw5xnB9GMZKxBHgOeLYOIQIlEQDsHoIoSbV+nX7uMDOnG8MQ7f/12ZwaRSC7BOL/3gqh882HAaNO6L4mN4nbal3s9aAh5wNTnYJWZaeeVaEfG6mZ5NKNOU6jrkPBs7vKZSpi6Ye7lZ5DCbfRhxujX615UnaI8M6ELAHtKlLajrL02V4t8anhLLDIzfaLZwk6ocCq3+Em38z4bzNuEcZFnki8n4dNf6YBHg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jQzjz07EcJT5PzMrIkL9/6WUuth/ZD9hSQcBMApaq0E=; b=cnpIjTYFRIpy4FA7LB2nbZCHlVuUPhX0nZNTmLModDczM0FhPDHmu6gWvTCLwtqS55IyrUwI0UvWYXveEFiYw7BXPTXKEE8PXLjR+ZCdnIZ5UY1SMEP80NsGHtiIecyx5EcCrEmOKkub75i8YgXppxT/ReEsXUzxMIK2ytdtadI= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by MW4PR10MB6678.namprd10.prod.outlook.com (2603:10b6:303:22c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.50; Wed, 17 Apr 2024 20:21:52 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::67a4:9544:7249:7751]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::67a4:9544:7249:7751%7]) with mapi id 15.20.7472.037; Wed, 17 Apr 2024 20:21:52 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: Nicholas Vinson Subject: [PATCH 22/22] libctf: do not include undefined functions in libctf.ver Date: Wed, 17 Apr 2024 21:20:18 +0100 Message-ID: <20240417202018.34966-23-nick.alcock@oracle.com> X-Mailer: git-send-email 2.44.0.273.ge0bd14271f In-Reply-To: <20240417202018.34966-1-nick.alcock@oracle.com> References: <20240417202018.34966-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0688.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:37b::17) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|MW4PR10MB6678:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cb1831b-64e3-459c-4c39-08dc5f1c0485 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0SKC9dfWPzO7OoTjcx8+zrAaU+2XW9dRrOdjeihkWq6nOmZgjMYKhO+c0jTKGXcuCgVRkffS1SzUEPi/22sBeDkR/Q47WUsxMmE+okYLDrno/tpwG3FJZZlGxKby03LsgYyeRUr3SHojY9xHifgwUDsamnr4fYNeUvT7mcwbp4vwOptliovfSNlr5FLKGlu3HbaC06+BKl2Crtaw1sg7Hns06/au4oSeOKmNwn6DF4phmpnuVs6lHxYVZplZZIT3IGUrCBn6eiQJ7n7D5WydqGQ2Rrr1gUqWL2357zS0KIuBvepfUdXCVFEq39206mY5+hjLQTI8/KyqBuxryoi7FEVJMRWwWDhYhZdThbTuzQ0c6uSx9sarzD+9Dmzs9R2+lTkHryp0Nu8RNwa/9Q95UQKsnmDapm+qN9h7sECL4bDsrJ3gBF/OrndI5G96il9nOaSN4ke6gb5jK6n3NsphARZ+8+5E/b2avsi7CTmsv5RnUFDmqsO3rgE5gpaWIUFlFDKC/eNU+u/Qx7Yf5DBuHxtvnbgSPcuQzUY7paq10YCTZmiY8EfAuUS5GHs0TtUkSjI1GZhZdtNwejzswpYqqM1RpQl/SgOX9nUV6qMwRdUMCLfumf4PladvOU+UJB//4lrGddaPiJBOPOALr0AtDOgV9VgbVeZ3KC32T2dbh/U= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zSyKTvk30t1yrUQ/zSYfT441AOu2HfttFw+fOsmhiR3VyYmg73O0iv9s/dGzqBJKOjR58e1qIbdtogrRYSTvxJhz3QrbfzkWPEiK+RPZdxKO5XwWB8/pgLYRrb0xQWZHKa2/2+Z1jk28aD+686aZcDZOK2R4BOykzCuVBxp4c8lClvccNCV5Sty0RnFIPP8lPvtTwe2I4IcJkBvm0wF67Y8WPWdefasBGXb7WTqsRKo85PICqy/5h03dSD1KiD1zQNNrbIN0kTgH9nF0adpsVZ3Z+QuTiQEMNmKRL5Z9WNHsKcngBAbYgTo7REYLfiZKcosSIjH/mVNhrRnoOc1ui8rVFjTbkOob+KXXZmf6i38eST02W2KDIbA77o62fNsqRnmpFfoC9HWDp1Ygo/55uEb1/xR8azzptfFg1qJpGdURc2zk4uZwBDAz6gUL3PdVf7rJVl/8lizdr0PAXejatm9df/7lRo31qIlMOkP7ayZoqwuI2RFClTPfs6UyZvTrrNpvzx9Xs5hG7h0cV6KYoFsOybJaO0tkhcLIUxYY7KgNntn/nhoxgd0hZvH5U1gzbXv3AfLWXEiay8SGP3klemHV6GozdKQUEpAw5JXxHTVpW7L10ZryDT3r5xqMIgG2Fqk4ESU0Lh5HHRXyf76WepqLsTQ769Jj2MHCAgz/QwD2UEA0+lI/Xw95N31x0NOyDExTzwCBsi90LM3mP/rb5C9+Yr9tk93pdAMhqUV6buvoHQE6+LSDeZaC7QujN6a0YCjJQzU8K4goawosswR+9amWLlJ7syHQDlO98pLmORYUUFkUIOJxvO6zZ1SB54Z4CIUfbTLtsnQEFC6qL7VLzAOl6aHQ7L/0BSPtDPEz8U3TF4V6JpBiyfL5RWDE/w+w3ECmiTKCBxCrPqc2KxPU5/QBX67kDjA61JBVmWSSofAC2w76Xf92eX1SwD6E1LDOxtq+MFtp1cN4uybwy/2JyR/zaGhocmzifomi2G6sWLEiVkzMZY7b+CR0q9Yx7mhPQkT0mK3RIXnfoiFkQ3aDnNvDmZrIfyisj5clic8Vkt4dO5Y4Iv8C0cADWsaZhY4/7d6R2Zqew5p/rduoHOZctItpgOLA33feB3t40OFAGkJnJh8E+VtVmIRi6/iP1alaL1bZ+PVQNidmFnEehVyfwol7sUN+z/dUi6U7dIKkKLByEPtEEhfJr84kiexfF6Vt+NHwdEeMU2DbxnmYWHuPCRxAbUvSVoPgDH+i60hezieU740AxgPV56DXP3UnIi+YNuq5Gz9B/hP7f40Wx1Re8UWbXqfWataymy3eRu829Bzz+BFIzaj8hultQhGYExemKSU1gIwby5ax+T8OBM6okvxiItWW8iUvTakj1PijE9D9cCGpgLTjbgG/OFAihU2hDL5yrMpx253Ki4dy1Rwd4AJaJRH1ugmOFdSfx46DX2Dn2f13cmhH/R8bcARTuBJo4uznw0wdA4aLZ0/j5ZL92tAULih0iKvFDEdYMOwNGQQI6kFOWb/mpvD0c/O5cng+OeOz7g9mfHoS6fcoIvKHGAT5vrgli0ir82yDjdATgbXyilx8Bhtv2Y2ABBFKgr/3ENNgkE2VzMae/YYx03Igqw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: K0vhlkc031c/peZDmHyCv4NOiaLsxD6G5h1h4HYVwN4wpSvf07hfaVbapZitDgFoP3aEEmX91FckDcCWQnKD4wk9qVB8QYj+P2JANLvZ+6cPIrX+Xieulx8NfYmBSr0aoAkrLwpM8AAM9v26M435i1EDEqjGGSnEX591M8rZ3RvOxIKrTFY/WAb0gN926tmKNB9pZsb2hNfEFVC6CyzdcemHDhL+TEdR26vbAnNLZwPdUs0Lunng9HG91JMi8lmtlOi+825mvSrjnOtM+jwAJVfbi0rltLYR0LdYYbe46ii1rvtyIspNhwongwPRVCODls7L+nrI56pkBcSsIx/nk4z3L+XZdhMx/ts3IR86JnvKhDZDpTxL8QA/W2TkzLFEYaulz1WU3jnBUeLdRNFRLZ6vN64e15jLgrz78aJf2YPBKNHLn1cx68cGJdjJg9kzEX6T06930vKB/dWrHu+vV1S9bZYyHdLM9A8W5YfGFFeLwn5NUuzyKpCMJBxr5Zm8Tz+kszikcvOQRnmKch9TDcb/0qX7A72MkbCdHR+wFOcKQH4/xIos/uBBmfzKn3PEwxlCQvv9azc0+MZ4hyAoq3Xx43tJQqPPjeBGrJAFCzI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8cb1831b-64e3-459c-4c39-08dc5f1c0485 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2024 20:21:52.1722 (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: uzKLaZ8CuhvTvjaNgiaNcCglq1TNEJ23Nfu2aAU0Z7i5GOLb51C3chdWDf11OYh862kySChARv79KdYV1KnLeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB6678 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-17_17,2024-04-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404170143 X-Proofpoint-ORIG-GUID: MXtpPNe4srRPbAZyuC51L5kRES53TfdD X-Proofpoint-GUID: MXtpPNe4srRPbAZyuC51L5kRES53TfdD 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org libctf's version script is applied to two libraries: libctf.so, and libctf-nobfd.so. The latter library is a subset of the former which does not link to libbfd and does not include a few public entry points that use it (found in libctf-open-bfd.c). This means that some of the symbols in this version script only exist in one of the libraries it's applied to. A number of linkers dislike this: before now, only Solaris's linker caused serious problems, introducing NOTYPE-typed symbols when such things were found, but now LLD has started to complain as well: ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_arc_open' failed: symbol not defined ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_fdopen' failed: symbol not defined ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_open' failed: symbol not defined ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen' failed: symbol not defined ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen_ctfsect' failed: symbol not defined Rather than adding more and more whack-a-mole fixes for every linker we encounter that does this, simply exclude such symbols unconditionally, using the same trick we used to use for Solaris. (Well, unconditionally if we can use version scripts with this linker at all, which is not always the case.) Thanks to Nicholas Vinson for the original report and a fix very similar to this one (but not quite identical). Cc: Nicholas Vinson libctf/ * configure.ac: Always exclude libctf symbols from libctf-nobfd's version script. * configure: Regenerated. --- libctf/configure | 21 ++++++++++++++++----- libctf/configure.ac | 21 ++++++++++++++++----- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/libctf/configure b/libctf/configure index 778c141571e..1faadefa068 100755 --- a/libctf/configure +++ b/libctf/configure @@ -16952,7 +16952,10 @@ fi # Use a version script, if possible, or an -export-symbols-regex otherwise. +# First figure out the version script flag: then massage the script, if +# needed. decommented_version_script= +no_version_script= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker versioning flags" >&5 $as_echo_n "checking for linker versioning flags... " >&6; } if ${ac_cv_libctf_version_script+:} false; then : @@ -16969,7 +16972,7 @@ int ctf_foo (void) { return 0; } int main (void) { return ctf_foo(); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libctf_version_script="-Wl,--version-script='$srcdir/libctf.ver'" + ac_cv_libctf_version_script="-Wl,--version-script" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -16994,22 +16997,30 @@ rm -f core conftest.err conftest.$ac_objext \ if test -z "$ac_cv_libctf_version_script"; then ac_cv_libctf_version_script='-export-symbols-regex ctf_.*' + no_version_script=t fi rm -f conftest.ver fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libctf_version_script" >&5 $as_echo "$ac_cv_libctf_version_script" >&6; } + +# Ensure that no symbols exist in the version script for libctf-nobfd.so +# that do not exist in the shared library itself, since some linkers (Solaris) +# add such symbols with type NOTYPE, and others (LLVM) complain loudly +# and fail to link. +grep -v 'libctf only' $srcdir/libctf.ver > libctf-nobfd.ver + if test -n "$decommented_version_script"; then # Solaris's version scripts use shell-style comments rather than the C-style # used by GNU ld. Use cpp to strip the comments out. (cpp exists under this # name on all platforms that support ld -z gnu-version-script.) - # Also ensure that no symbols exist in the version script for libctf-nobfd.so - # that do not exist in the shared library itself, since some linkers add such - # symbols with type NOTYPE. /lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver - grep -v 'libctf only' $srcdir/libctf.ver | /lib/cpp > libctf-nobfd-decommented.ver + /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'" VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'" +elif test -z "$no_version_script"; then + VERSION_FLAGS="$ac_cv_libctf_version_script='$srcdir/libctf.ver'" + VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd.ver'" else VERSION_FLAGS="$ac_cv_libctf_version_script" VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script" diff --git a/libctf/configure.ac b/libctf/configure.ac index f327d48f249..ced1aeb7ccf 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac @@ -249,7 +249,10 @@ fi AC_SUBST(HAVE_TCL_TRY) # Use a version script, if possible, or an -export-symbols-regex otherwise. +# First figure out the version script flag: then massage the script, if +# needed. decommented_version_script= +no_version_script= AC_CACHE_CHECK([for linker versioning flags], [ac_cv_libctf_version_script], [echo 'FOO { global: mai*; local: ctf_fo*; };' > conftest.ver old_LDFLAGS="$LDFLAGS" @@ -258,7 +261,7 @@ AC_CACHE_CHECK([for linker versioning flags], [ac_cv_libctf_version_script], CFLAGS="$CFLAGS -fPIC" AC_LINK_IFELSE([AC_LANG_SOURCE([[int ctf_foo (void) { return 0; } int main (void) { return ctf_foo(); }]])], - [ac_cv_libctf_version_script="-Wl,--version-script='$srcdir/libctf.ver'"], + [ac_cv_libctf_version_script="-Wl,--version-script"], []) LDFLAGS="$old_LDFLAGS" @@ -275,19 +278,27 @@ AC_CACHE_CHECK([for linker versioning flags], [ac_cv_libctf_version_script], if test -z "$ac_cv_libctf_version_script"; then ac_cv_libctf_version_script='-export-symbols-regex ctf_.*' + no_version_script=t fi rm -f conftest.ver]) + +# Ensure that no symbols exist in the version script for libctf-nobfd.so +# that do not exist in the shared library itself, since some linkers (Solaris) +# add such symbols with type NOTYPE, and others (LLVM) complain loudly +# and fail to link. +grep -v 'libctf only' $srcdir/libctf.ver > libctf-nobfd.ver + if test -n "$decommented_version_script"; then # Solaris's version scripts use shell-style comments rather than the C-style # used by GNU ld. Use cpp to strip the comments out. (cpp exists under this # name on all platforms that support ld -z gnu-version-script.) - # Also ensure that no symbols exist in the version script for libctf-nobfd.so - # that do not exist in the shared library itself, since some linkers add such - # symbols with type NOTYPE. /lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver - grep -v 'libctf only' $srcdir/libctf.ver | /lib/cpp > libctf-nobfd-decommented.ver + /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'" VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'" +elif test -z "$no_version_script"; then + VERSION_FLAGS="$ac_cv_libctf_version_script='$srcdir/libctf.ver'" + VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd.ver'" else VERSION_FLAGS="$ac_cv_libctf_version_script" VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script"