Message ID | 20221105140233.1197237-1-jose.marchesi@oracle.com |
---|---|
State | Superseded |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 1AEF73858432 for <patchwork@sourceware.org>; Sat, 5 Nov 2022 13:59:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AEF73858432 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667656757; bh=VcCyAlfbn7Ta4wlC5fs7t1dRP4FUduzxsayr5VacGT8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=YBqWDWXy1wQoS+jtjIwyveaWP5y90c9mAzP2n+s9HmMzXG+xBsW9Ya3gbD0tzJh7a 7dpGzP7gw/bPuniuR23pqI6t77YdymFyRk57RnHGKnON+P6msdCitbFgcwPa2Ow/ig 1lnTFowSm5t5MO+FdM3VFn9kb5PmWQNPynQf7EdQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 307DD3858D26 for <gdb-patches@sourceware.org>; Sat, 5 Nov 2022 13:58:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 307DD3858D26 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A5Dlvdj017181; Sat, 5 Nov 2022 13:58:36 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 3kngregh29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 05 Nov 2022 13:58:36 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A5Auga8012822; Sat, 5 Nov 2022 13:58:35 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kne92233n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 05 Nov 2022 13:58:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkOS4jGaFOkVCuyL5CkLq1/RrmzqS7IXONNocWlx4nqehE/LB2RNyhuF2JXbSLyHTQzJcni3+rB16Ggn0EgNHUUyf9uUgW2J1MhVsZypqT/eMqGr6dy/83F2immG4eetxTlEz41tfEWIpL2N+eEQ0tLtHU1aAcNzTe8QPOuPeXg09e5uBoriTwFe6TCajz3IbqZRaCzVTKn5Ky1yEawyby13QAfx67yBGzNpwDx99oMpo3UGMbQePgDu3vAJEWTJGNcr6iuQIIcEDJ10I6X7ik7d2X3gMZEtDIaZUY7zvk43a9shKHRtGxlXH2BV1Yiw/V0cPQUS6qOCD0MgRpLQ0g== 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=VcCyAlfbn7Ta4wlC5fs7t1dRP4FUduzxsayr5VacGT8=; b=YtdfOZXhf4+TwvAub3UQimNZuYe7pXLp3p0DqpxW0yhy4ceNMViLMnFXHA6I4iIiNdTNZTkwD2tvUju4op1x3E+F2G1xGCvewi4XmPq4DkLAzWCUdU6pu3wqPE1GHcE/eGegUkkS74zny5+2QCua/VN1g7+XyXSad6A6QIjTjqZjQ6K+sBlRAGPlIwetc8BT22vFk1WynmrjZEkJVyu+aHoF/7H32JxY4DuIu64VCdpr1n5R1Uh8pq+7VCfdZ+kvKqNC1hByrcDOjEs82rnq/JRb8U39i04vx0LVdgFyonKzodxMqA78ImeSsgBozqgACfa+HP3k4CAkISnI/AcQJw== 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 BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) by SJ0PR10MB4559.namprd10.prod.outlook.com (2603:10b6:a03:2d0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.24; Sat, 5 Nov 2022 13:58:33 +0000 Received: from BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::5095:b148:8def:1049]) by BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::5095:b148:8def:1049%5]) with mapi id 15.20.5791.024; Sat, 5 Nov 2022 13:58:32 +0000 To: gdb-patches@sourceware.org Subject: [PATCH V2] gdb: link executables with libtool Date: Sat, 5 Nov 2022 15:02:33 +0100 Message-Id: <20221105140233.1197237-1-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.30.2 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: FR3P281CA0039.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::11) To BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB2888:EE_|SJ0PR10MB4559:EE_ X-MS-Office365-Filtering-Correlation-Id: dedbd94c-ce30-4c98-b85c-08dabf35d33f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cDojXbatWTTasthGBt3ufZDd3TdZ1RL2CVh0jw/YiBX4Rqa82HTQF0i8gn51Byb/kBtnwm1XGpSeCpnyf3MT5R4Zvclp4JQq+4XZ7w4Aq9t5LkjuAGGmXTZkPKAk4A7YWp4OD7mwkamYI1pvSk25jh9j6B6gxjcOAkcT0GxSoWXm9pNV1lmfy8bwS0377Xg9W6ENNPA6f0Zw/YD0uT4f7ZO8BGfW+KZeAmqF0p7FACrxCXGpEj7Y3aYHgfKAuBGqRb1jnoVEdTjzJQfm+DMDfZISKEhshUSCR2zzVeyVh926QVDVfz6kRKamGsK2tNpeCktW/aBJWZRfrC07aq6Uj8lztyHuazZypFjrjZGTzzY2j/qpovtqQ+kzLgZSVl2wbhEFuVDyaLF30By4tlgHkJvaAYzzgBueuDWyGWJVwMnSsS5aam4cfE7+ulr5rQB4mgLXjJcM5zBZZqlR1GiYNJReIy0iXUTG4WAte040Q7tsr0b7kRwLi0IA9V7441EHNzJ4abXpKqRnRPy2KH+Xd7hUlVFSEdMUlAMNl6d5FEZS2s5AJSsEBy4HEc/Js8UHbbCPsvSg0G0j4259PDLZY9yf7XtgpPCfdoXceghdxxJ74YVG4NeNYlQ3BhAttdPVI6WtNH89xxwNE+D/rvzsgJsOmC9jQ3kYYJpA0/+8/JtaSfu6nWhYQlSpgdFhv4NoFnVCIcGMtwsPJW6bb3N50QqHhXG8/hG/2goiWIMcgC5chAV7zyz+LAlw5mSRp3XRr7NztXkO9ZrH3sZ/sBBbmLPaGdUuvFfmHKhmZ41IrxpDawuBtfWr1tmSKGvwMhFEe4qCiS/HKFYWJg5DJQi3v4w11SIjrH2seLkndrCfIZU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2888.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(366004)(376002)(396003)(136003)(39860400002)(451199015)(478600001)(6486002)(38100700002)(107886003)(86362001)(84970400001)(2616005)(5660300002)(316002)(41300700001)(6506007)(186003)(6916009)(8936002)(36756003)(4001150100001)(6512007)(66476007)(4326008)(83380400001)(8676002)(66946007)(66556008)(1076003)(2906002)(26005)(21314003)(460985005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rZlsgVmvzSRLNqZgy0XlGhDa1p6+Xm8rphMKVzPtvibaHa9nlg+6kWlASHSQrIhbi503AC6AZJVOuHOIKiJm9BDRyv7xhi0MHBSIISbQcJJkVylPubpfK3/20PYWMHtrFDMJuLaX7f21Tjua7LUUb6pFZ2JjfaePpTrksS9n0HBZFJEzIeN80t5hkyhWT2/+HBn7TPAWQPp8jdB+ZYuWiThm2yvn1P8/M9jnEactt9Os7pC44qR8pOEmj5CG97clBVHv8h4OkRayzTPkjrNMR2hR+pJXra9LMBudDLH/l9XbBt3aTkYtuK6Lg3eOArtrUIHxyHCb7qNOWYt0TqhHl7dxiTBx5EJOxie09gvALidLkBdQ9KuZ4OHdxAL2J70myOEIvd3O18qn+fYcevySz3lduoCGrLhNw0voaXtb3K4HhD1hVFB77OtVa0QkIKGBuggxjmm1HTHZSMkbyDbw+W9HIduB/dEqP3vzMkAEAp8mD65XMmlVQJQnnJgMPx8uYl+2gTTJBY2T5AO64bdNC7mZ7zZIPtsH6F1GsiKHVvhdjco/5lF52El26JTScs6Ol9wPQxcGPzAo8qxXbKZ8OeOemG2hEWIR+SQ8tmaj72FYSAlMGpy5MUS38qF0yZrtOBIv4RxhZRydiAD+Hrix+Iu3LItB+n90fN6o0Wz6mOJyHWbQjvezJL3efSkfingE5Cw3i89BecObldVVTTh+kbO/nx68XGUKdMjLifSsyWdMVN+2pkt85cSVYeVhfJxkQ/NPZtgiiRLkwkmjkidsTC3NTKxFeYtEPPW4AkSooWi2ucwwc877eMaPNt/Ok77Sex2HOgHnGJ0lSnFM3ppw1K8xl3B7zq/qSeGvvlWDq5Yp6ck/G9Z5OjzKWfHt5cJUx/xZP3sSAHJRM+VXulCRTh+8/xZl53rmNaDod5WDwj22YDZuB45r7GuncB4WvRAotqSR6BGWF0s7aLQ9nNYQw8QYO1LB1hiDAJBu24xXQ0AOdXmrQNuGwUfL0iFgjqy4/F6+iFcV1IGi1WmvbI7Rnkxwi70ToutEAiHzQdokOP5/TjSYp2wdJF9n6Jwcm6rQkAYqOxXsThBLHzI2O4qN3YREW3vAjl+DoHJsrceWnSEhNm/VJSrm9tlBGNnUi33jHmWBkUCN0f0tS/OJoVH9jRExRv3yCKSCqsCigBMHRVGvQ4Q3upb0GS9Gqv/IGVlbks/Dt8Mo+JJDN2VnDhgygu7mHQt6AwhnwUS5O3xpZO7ax0j3PWeeo0wIYqZ1fumVbMFeWOIRsfU/gjri36I1ekoCDjnrW/rssaw5b1lUR5g4cM0DSohrXug/1E+KvwHuPrTB/+1xKpxjyZNkY80GFEGUu8jbOIcY6N3137B+2vMI6yiP0sW4kmKcfnAQ1b8uQ9LWT7+mz/GFJjJ2IH05J/1dGncjOUNk2qM0b2EIVYwJ492lzvfUnjOxyiDsz5D93l9UrUy4NXti1FwlxaXCTukl4JCa9oDJY2VRvXs/UdytL+lZKglRYcCTGzMlRcvxcldhPETSmoMpC7WN5iCtVQCbNWSULW1BwvTM1BvYs7Xw4rumnsPJzW1dTuZ35vcnd4oktwxqt2arHUc4m12cVQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dedbd94c-ce30-4c98-b85c-08dabf35d33f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2888.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2022 13:58:32.7030 (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: 5d6uwP60RE1vCb5wW7iwX52EgW5UXMVgWLIvD0nf8U0BvtKcVsI/8k0PrFHzp0ekrYGNtJ5XyVXDGp1AEokjIpeqtcYoB7LNs41v8XIpvJc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4559 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-05_07,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211050107 X-Proofpoint-ORIG-GUID: gAFLyFgu5BsGPQffFrBFWcHv-jDQjN9N X-Proofpoint-GUID: gAFLyFgu5BsGPQffFrBFWcHv-jDQjN9N 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_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: "Jose E. Marchesi via Gdb-patches" <gdb-patches@sourceware.org> Reply-To: "Jose E. Marchesi" <jose.marchesi@oracle.com> Cc: indu.bhagat@oracle.com, elena.zannoni@oracle.com Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
[V2] gdb: link executables with libtool
|
|
Commit Message
Jose E. Marchesi
Nov. 5, 2022, 2:02 p.m. UTC
This patch changes the GDB build system in order to use libtool to link the several built executables. This makes it possible to refer to libtool libraries (.la files) in CLIBS. As an application of the above, LIBBFD new refers to ../libbfd/libbfd.la LIBBACKTRACE_LIB now refers to ../libbacktrace/libbacktrace.la LIBCTF now refers to ../libctf/libctf.la NOTE1: The addition of libtool adds a few new configure-time options to GDB. Among these, --enable-shared and --disable-shared, which were previously ignored. Now GDB shall honor these options when linking, picking up the right version of the referred libtool libraries automagically. NOTE2: I have not tested the insight build. NOTE3: For regenerating configure I used an environment with Autoconf 2.69 and Automake 1.15.1. This should match the previously used version as announced in the configure script. NOTE4: Now the installed shared object libbfd.so is used by gdb if binutils is installed with --enable-shared. Testing performed: - --enable-shared and --disable-shared (the default in binutils) work as expected: the linked executables link with the archive or shared libraries transparently. - Makefile.in modified for EXEEXT = .exe. It installs the binaries just fine. The installed gdb.exe runs fine. - Native build regtested in x86_64. The installed gdb runs fine. In the regression testing I'm observing that the following tests doesn't seem to be deterministic: gdb.base/step-over-syscall.exp gdb.threads/process-dies-while-detaching.exp gdb.threads/process-dies-while-handling-bp.exp Sometimes some of the the tests in these files unexpectedly fail, like in: -PASS: gdb.threads/process-dies-while-detaching.exp: single-process: \ continue: detach: continue +FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: \ continue: detach: continue Sometimes they unexpectedly pass: -KFAIL: gdb.base/step-over-syscall.exp: clone: displaced=on: \ check_pc_after_cross_syscall: single step over clone \ final pc (PRMS: gdb/19675) +PASS: gdb.base/step-over-syscall.exp: clone: displaced=on: \ check_pc_after_cross_syscall: single step over clone final pc -KFAIL: gdb.threads/process-dies-while-handling-bp.exp: \ non_stop=on: cond_bp_target=0: inferior 1 exited \ (prompt) (PRMS: gdb/18749) +PASS: gdb.threads/process-dies-while-handling-bp.exp: \ non_stop=on: cond_bp_target=0: inferior 1 exited - Cross build for aarch64-linux-gnu built to exercise program_transform_name and friends. The installed aarch64-linux-gnu-gdb runs fine. 2022-11-05 Jose E. Marchesi <jose.marchesi@oracle.com> * gdb/aclocal.m4: include libtool macros from the top-level directory. * gdb/Makefile.in (LIBTOOL): Define. (CC_LD): Use libtool for linking. (install-only): Use libtool for installing GDB$(EXEEXT). (install-gdbtk): Likewise for insight$(EXEEXT). * gdb/configure.ac: Call LT_INIT. Refer to libctf.la and libbacktrace.la. * gdb/configure: Regenerate. * gdb/testsuite/lib/gdb.exp: Run uninstalled GDB with libtool --mode=execute. --- ChangeLog | 15 + gdb/Makefile.in | 12 +- gdb/aclocal.m4 | 5 + gdb/configure | 31544 ++++++++++++++++++++++++------------ gdb/configure.ac | 15 +- gdb/testsuite/lib/gdb.exp | 2 +- 6 files changed, 21142 insertions(+), 10451 deletions(-)
Comments
On 11/5/22 10:02, Jose E. Marchesi via Gdb-patches wrote: > This patch changes the GDB build system in order to use libtool to > link the several built executables. This makes it possible to refer > to libtool libraries (.la files) in CLIBS. > > As an application of the above, > > LIBBFD new refers to ../libbfd/libbfd.la new -> now > LIBBACKTRACE_LIB now refers to ../libbacktrace/libbacktrace.la > LIBCTF now refers to ../libctf/libctf.la The patch linked in this bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29372 also updated OPCODES to use $(OPCODES_DIR)/libopcodes.la, should you do it too? > > NOTE1: The addition of libtool adds a few new configure-time options > to GDB. Among these, --enable-shared and --disable-shared, > which were previously ignored. Now GDB shall honor these > options when linking, picking up the right version of the > referred libtool libraries automagically. > > NOTE2: I have not tested the insight build. > > NOTE3: For regenerating configure I used an environment with Autoconf > 2.69 and Automake 1.15.1. This should match the previously > used version as announced in the configure script. Your patch appears to be missing the changes to gdb/configure, however the diffstat in your email shows: gdb/configure | 31544 ++++++++++++++++++++++++------------ When running `autoreconf -f` in the gdb/ directory, I get some changes that revert your changes to gdb/aclocal.m4, and makes some changes to gdb/configure. But I don't think my changes are right, because LT_INIT stays unexpanded in the generated configure. Does the method of regenerating the build system change with this patch? If I run libtoolize in gdb/, it adds a bunch of .m4 files to $top_level/config, and then if I run autoreconf, LT_INIT gets properly expanded. But these .m4 files already exist at the top-level such as $top_level/libtool.m4, I guess we don't want them twice. Should gdb/configure.ac be modified to find the existing files? For instance, this makes it work for me: diff --git a/gdb/configure.ac b/gdb/configure.ac index 4fd77e485762..12561d4d2de6 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -19,7 +19,7 @@ dnl along with this program. If not, see <http://www.gnu.org/licenses/>. dnl Process this file with autoconf to produce a configure script. AC_INIT -AC_CONFIG_MACRO_DIRS([../config]) +AC_CONFIG_MACRO_DIRS([.. ../config]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h]) AM_MAINTAINER_MODE > NOTE4: Now the installed shared object libbfd.so is used by gdb > if binutils is installed with --enable-shared. Do you mean bfd instead of binutils? Or do you mean binutils in the sense that bfd is part of binutils? > Testing performed: > > - --enable-shared and --disable-shared (the default in binutils) work > as expected: the linked executables link with the archive or shared > libraries transparently. > > - Makefile.in modified for EXEEXT = .exe. It installs the binaries > just fine. The installed gdb.exe runs fine. > > - Native build regtested in x86_64. The installed gdb runs fine. > > In the regression testing I'm observing that the following tests > doesn't seem to be deterministic: > > gdb.base/step-over-syscall.exp > gdb.threads/process-dies-while-detaching.exp > gdb.threads/process-dies-while-handling-bp.exp > > Sometimes some of the the tests in these files unexpectedly fail, > like in: > > -PASS: gdb.threads/process-dies-while-detaching.exp: single-process: \ > continue: detach: continue > +FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: \ > continue: detach: continue > > Sometimes they unexpectedly pass: > > -KFAIL: gdb.base/step-over-syscall.exp: clone: displaced=on: \ > check_pc_after_cross_syscall: single step over clone \ > final pc (PRMS: gdb/19675) > +PASS: gdb.base/step-over-syscall.exp: clone: displaced=on: \ > check_pc_after_cross_syscall: single step over clone final pc > > -KFAIL: gdb.threads/process-dies-while-handling-bp.exp: \ > non_stop=on: cond_bp_target=0: inferior 1 exited \ > (prompt) (PRMS: gdb/18749) > +PASS: gdb.threads/process-dies-while-handling-bp.exp: \ > non_stop=on: cond_bp_target=0: inferior 1 exited It's unfortunately not the only ones. It's not good, but it's known. > - Cross build for aarch64-linux-gnu built to exercise > program_transform_name and friends. The installed > aarch64-linux-gnu-gdb runs fine. Great, thanks for the details on the testing. > > 2022-11-05 Jose E. Marchesi <jose.marchesi@oracle.com> > > * gdb/aclocal.m4: include libtool macros from the top-level > directory. > * gdb/Makefile.in (LIBTOOL): Define. > (CC_LD): Use libtool for linking. > (install-only): Use libtool for installing GDB$(EXEEXT). > (install-gdbtk): Likewise for insight$(EXEEXT). > * gdb/configure.ac: Call LT_INIT. > Refer to libctf.la and libbacktrace.la. > * gdb/configure: Regenerate. > * gdb/testsuite/lib/gdb.exp: Run uninstalled GDB with libtool > --mode=execute. Could you add the git trailer: Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29372 ? > --- > ChangeLog | 15 + I don't think you should add gdb changes to the top-level ChangeLog. We simply don't use ChangeLogs now. > gdb/Makefile.in | 12 +- > gdb/aclocal.m4 | 5 + > gdb/configure | 31544 ++++++++++++++++++++++++------------ > gdb/configure.ac | 15 +- > gdb/testsuite/lib/gdb.exp | 2 +- > 6 files changed, 21142 insertions(+), 10451 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 73c3a006881..fea3f7c6877 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,18 @@ > +2022-11-05 Jose E. Marchesi <jose.marchesi@oracle.com> > + > + * gdb/aclocal.m4: include libtool macros from the top-level > + directory. > + * gdb/Makefile.in (LIBTOOL): Define. > + (CC_LD): Use libtool for linking. > + (install-only): Use libtool for installing GDB$(EXEEXT). > + (install-gdbtk): Likewise for insight$(EXEEXT). > + Use libbfd.la instead of libbfd.a. > + * gdb/configure.ac: Call LT_INIT. > + Refer to libctf.la and libbacktrace.la. > + * gdb/configure: Regenerate. > + * gdb/testsuite/lib/gdb.exp: Run uninstalled GDB with libtool > + --mode=execute. > + > 2022-10-10 Nick Clifton <nickc@redhat.com> > > * src-release.sh: Add "-r <date>" option to create reproducible > diff --git a/gdb/Makefile.in b/gdb/Makefile.in > index c528ee5aa80..b03eedd4d2f 100644 > --- a/gdb/Makefile.in > +++ b/gdb/Makefile.in > @@ -143,10 +143,12 @@ MAKEINFO_CMD = $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS) > MAKEHTML = $(MAKEINFO_CMD) --html > MAKEHTMLFLAGS = > > +LIBTOOL = @LIBTOOL@ > + > # Set this up with gcc if you have gnu ld and the loader will print out > # line numbers for undefined references. > #CC_LD = g++ -static > -CC_LD = $(CXX) $(CXX_DIALECT) > +CC_LD = $(LIBTOOL) --mode=link $(CXX) $(CXX_DIALECT) > > # Where is our "include" directory? Typically $(srcdir)/../include. > # This is essentially the header file directory for the library > @@ -163,7 +165,7 @@ CTF_DEPS = @CTF_DEPS@ > > # Where is the BFD library? Typically in ../bfd. > BFD_DIR = ../bfd > -BFD = $(BFD_DIR)/libbfd.a > +BFD = $(BFD_DIR)/libbfd.la > BFD_SRC = $(srcdir)/$(BFD_DIR) > BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC) > > @@ -2017,7 +2019,8 @@ install-only: $(CONFIG_INSTALL) > true ; \ > fi ; \ > $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \ > - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdb$(EXEEXT) \ > + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \ > + gdb$(EXEEXT) \ > $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ > $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \ > $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h > @@ -2529,7 +2532,8 @@ install-gdbtk: > true ; \ > fi ; \ > $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \ > - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) insight$(EXEEXT) \ > + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \ > + insight$(EXEEXT) \ > $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ > $(SHELL) $(srcdir)/../mkinstalldirs \ > $(DESTDIR)$(GDBTK_LIBRARY) ; \ > diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 > index 3ed4a58d39f..4aac87b52ed 100644 > --- a/gdb/aclocal.m4 > +++ b/gdb/aclocal.m4 > @@ -212,4 +212,9 @@ m4_include([../config/override.m4]) > m4_include([../config/pkg.m4]) > m4_include([../config/plugins.m4]) > m4_include([../config/tcl.m4]) > +m4_include([../libtool.m4]) > +m4_include([../ltoptions.m4]) > +m4_include([../ltsugar.m4]) > +m4_include([../ltversion.m4]) > +m4_include([../lt~obsolete.m4]) > m4_include([acinclude.m4]) > diff --git a/gdb/configure.ac b/gdb/configure.ac > index fceb80e8c9d..4fd77e48576 100644 > --- a/gdb/configure.ac > +++ b/gdb/configure.ac > @@ -46,6 +46,10 @@ ACX_NONCANONICAL_TARGET > > AC_ARG_PROGRAM > > +# We require libtool to link with the in-tree libtool libraries > +# the proper way. > +LT_INIT > + > # We require a C++11 compiler. Check if one is available, and if > # necessary, set CXX_DIALECT to some -std=xxx switch. > AX_CXX_COMPILE_STDCXX(11, , mandatory) > @@ -2092,7 +2096,7 @@ AC_ARG_ENABLE([libbacktrace], > > if test "${enable_libbacktrace}" = "yes"; then > LIBBACKTRACE_INC="-I$srcdir/../libbacktrace/ -I../libbacktrace/" > - LIBBACKTRACE_LIB=../libbacktrace/.libs/libbacktrace.a > + LIBBACKTRACE_LIB=../libbacktrace/libbacktrace.la > AC_DEFINE(HAVE_LIBBACKTRACE, 1, [Define if libbacktrace is being used.]) > else > LIBBACKTRACE_INC= > @@ -2151,15 +2155,10 @@ AC_ARG_WITH(xxhash, > [], [with_xxhash=auto]) > > GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections]) > -if test x${enable_static} = xno; then > - LIBCTF="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so" > - CTF_DEPS="../libctf/.libs/libctf.so" > -else > - LIBCTF="../libctf/.libs/libctf.a" > - CTF_DEPS="$LIBCTF" > -fi > if test "${enable_libctf}" = yes; then > AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections]) > + LIBCTF="../libctf/libctf.la" > + CTF_DEPS="../libctf/libctf.la" > else > LIBCTF= > CTF_DEPS= > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index e2cda30b95a..63d57581d13 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -154,7 +154,7 @@ global GDB_DATA_DIRECTORY > global inferior_spawn_id > > if [info exists TOOL_EXECUTABLE] { > - set GDB $TOOL_EXECUTABLE > + set GDB "libtool --mode=execute $TOOL_EXECUTABLE" Can you explain why this is needed? My understanding is that TOOL_EXECUTABLE can be used to point to an arbitrary gdb executable to test. If it's a gdb that has been "make install"ed, then libtool doesn't have to be involved. If pointing to a gdb executable in its build directory, then "gdb" will be a libtool script that sets all the right runtime library paths. The only moment I can imagine this would be useful would be if TOOL_EXECUTABLE consists of a wrapper around gdb, e.g. "valgrind /path/to/build/gdb". Simon
On 05 Nov 2022 12:38, Simon Marchi via Gdb-patches wrote: > On 11/5/22 10:02, Jose E. Marchesi via Gdb-patches wrote: > > LIBBACKTRACE_LIB now refers to ../libbacktrace/libbacktrace.la > > LIBCTF now refers to ../libctf/libctf.la > > The patch linked in this bug: > > https://sourceware.org/bugzilla/show_bug.cgi?id=29372 > > also updated OPCODES to use $(OPCODES_DIR)/libopcodes.la, should you do > it too? yeah, and i think we can drop zlib & zstd logic too since they're in there only for bfd. less sure about gettext usage ... if gdb uses gettext, we want to keep it, but if it was pulled in only for bfd too, we can purge it from the gdb side. although i'm totally fine with doing the zlib & zstd cleanup as a followup commit since Jose's patch here improves the status quo. -mike
> On 11/5/22 10:02, Jose E. Marchesi via Gdb-patches wrote: >> This patch changes the GDB build system in order to use libtool to >> link the several built executables. This makes it possible to refer >> to libtool libraries (.la files) in CLIBS. >> >> As an application of the above, >> >> LIBBFD new refers to ../libbfd/libbfd.la > > new -> now > >> LIBBACKTRACE_LIB now refers to ../libbacktrace/libbacktrace.la >> LIBCTF now refers to ../libctf/libctf.la > > The patch linked in this bug: > > https://sourceware.org/bugzilla/show_bug.cgi?id=29372 > > also updated OPCODES to use $(OPCODES_DIR)/libopcodes.la, should you do > it too? Indeed I should. Thanks for pointing that out :) >> >> NOTE1: The addition of libtool adds a few new configure-time options >> to GDB. Among these, --enable-shared and --disable-shared, >> which were previously ignored. Now GDB shall honor these >> options when linking, picking up the right version of the >> referred libtool libraries automagically. >> >> NOTE2: I have not tested the insight build. >> >> NOTE3: For regenerating configure I used an environment with Autoconf >> 2.69 and Automake 1.15.1. This should match the previously >> used version as announced in the configure script. > > Your patch appears to be missing the changes to gdb/configure, however > the diffstat in your email shows: > > gdb/configure | 31544 ++++++++++++++++++++++++------------ > > When running `autoreconf -f` in the gdb/ directory, I get some changes > that revert your changes to gdb/aclocal.m4, and makes some changes to > gdb/configure. But I don't think my changes are right, because LT_INIT > stays unexpanded in the generated configure. > > Does the method of regenerating the build system change with this patch? > > If I run libtoolize in gdb/, it adds a bunch of .m4 files to > $top_level/config, and then if I run autoreconf, LT_INIT gets properly > expanded. But these .m4 files already exist at the top-level such as > $top_level/libtool.m4, I guess we don't want them twice. Should > gdb/configure.ac be modified to find the existing files? For instance, > this makes it work for me: > > > diff --git a/gdb/configure.ac b/gdb/configure.ac > index 4fd77e485762..12561d4d2de6 100644 > --- a/gdb/configure.ac > +++ b/gdb/configure.ac > @@ -19,7 +19,7 @@ dnl along with this program. If not, see <http://www.gnu.org/licenses/>. > dnl Process this file with autoconf to produce a configure script. > > AC_INIT > -AC_CONFIG_MACRO_DIRS([../config]) > +AC_CONFIG_MACRO_DIRS([.. ../config]) > AC_CONFIG_SRCDIR([main.c]) > AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h]) > AM_MAINTAINER_MODE Hmm, the libtool that is in the binutils tree (in the top-level .m4 files, which are macros that generate the actual `libtool' scripts at configure time) is actually: 1) A phantom release 2.2.7a that doesn't exist anyhwere else, or at least I haven't managed to find it. It certainly doesn't exist in ftp.gnu.org nor in alpha.gnu.org. 2) Locally patched. Indeed `autoreconf' runs libtoolize, so to avoid it to install other .m4 files your fix above makes sense. >> NOTE4: Now the installed shared object libbfd.so is used by gdb >> if binutils is installed with --enable-shared. > > Do you mean bfd instead of binutils? Or do you mean binutils in the > sense that bfd is part of binutils? > >> Testing performed: >> >> - --enable-shared and --disable-shared (the default in binutils) work >> as expected: the linked executables link with the archive or shared >> libraries transparently. >> >> - Makefile.in modified for EXEEXT = .exe. It installs the binaries >> just fine. The installed gdb.exe runs fine. >> >> - Native build regtested in x86_64. The installed gdb runs fine. >> >> In the regression testing I'm observing that the following tests >> doesn't seem to be deterministic: >> >> gdb.base/step-over-syscall.exp >> gdb.threads/process-dies-while-detaching.exp >> gdb.threads/process-dies-while-handling-bp.exp >> >> Sometimes some of the the tests in these files unexpectedly fail, >> like in: >> >> -PASS: gdb.threads/process-dies-while-detaching.exp: single-process: \ >> continue: detach: continue >> +FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: \ >> continue: detach: continue >> >> Sometimes they unexpectedly pass: >> >> -KFAIL: gdb.base/step-over-syscall.exp: clone: displaced=on: \ >> check_pc_after_cross_syscall: single step over clone \ >> final pc (PRMS: gdb/19675) >> +PASS: gdb.base/step-over-syscall.exp: clone: displaced=on: \ >> check_pc_after_cross_syscall: single step over clone final pc >> >> -KFAIL: gdb.threads/process-dies-while-handling-bp.exp: \ >> non_stop=on: cond_bp_target=0: inferior 1 exited \ >> (prompt) (PRMS: gdb/18749) >> +PASS: gdb.threads/process-dies-while-handling-bp.exp: \ >> non_stop=on: cond_bp_target=0: inferior 1 exited > > It's unfortunately not the only ones. It's not good, but it's known. Ah ok. I would say it it not bad at all, considering both the size and character of the GDB testsuite. >> - Cross build for aarch64-linux-gnu built to exercise >> program_transform_name and friends. The installed >> aarch64-linux-gnu-gdb runs fine. > > Great, thanks for the details on the testing. > >> >> 2022-11-05 Jose E. Marchesi <jose.marchesi@oracle.com> >> >> * gdb/aclocal.m4: include libtool macros from the top-level >> directory. >> * gdb/Makefile.in (LIBTOOL): Define. >> (CC_LD): Use libtool for linking. >> (install-only): Use libtool for installing GDB$(EXEEXT). >> (install-gdbtk): Likewise for insight$(EXEEXT). >> * gdb/configure.ac: Call LT_INIT. >> Refer to libctf.la and libbacktrace.la. >> * gdb/configure: Regenerate. >> * gdb/testsuite/lib/gdb.exp: Run uninstalled GDB with libtool >> --mode=execute. > > Could you add the git trailer: > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29372 > > ? Will do. > >> --- >> ChangeLog | 15 + > > I don't think you should add gdb changes to the top-level ChangeLog. We > simply don't use ChangeLogs now. Oops, that was Emacs C-x4a. I saw ChangeLog entries in the buffer with reasonably recent entries and assumed it was GDB's. Sorry about that :) > >> gdb/Makefile.in | 12 +- >> gdb/aclocal.m4 | 5 + >> gdb/configure | 31544 ++++++++++++++++++++++++------------ >> gdb/configure.ac | 15 +- >> gdb/testsuite/lib/gdb.exp | 2 +- >> 6 files changed, 21142 insertions(+), 10451 deletions(-) >> >> diff --git a/ChangeLog b/ChangeLog >> index 73c3a006881..fea3f7c6877 100644 >> --- a/ChangeLog >> +++ b/ChangeLog >> @@ -1,3 +1,18 @@ >> +2022-11-05 Jose E. Marchesi <jose.marchesi@oracle.com> >> + >> + * gdb/aclocal.m4: include libtool macros from the top-level >> + directory. >> + * gdb/Makefile.in (LIBTOOL): Define. >> + (CC_LD): Use libtool for linking. >> + (install-only): Use libtool for installing GDB$(EXEEXT). >> + (install-gdbtk): Likewise for insight$(EXEEXT). >> + Use libbfd.la instead of libbfd.a. >> + * gdb/configure.ac: Call LT_INIT. >> + Refer to libctf.la and libbacktrace.la. >> + * gdb/configure: Regenerate. >> + * gdb/testsuite/lib/gdb.exp: Run uninstalled GDB with libtool >> + --mode=execute. >> + >> 2022-10-10 Nick Clifton <nickc@redhat.com> >> >> * src-release.sh: Add "-r <date>" option to create reproducible >> diff --git a/gdb/Makefile.in b/gdb/Makefile.in >> index c528ee5aa80..b03eedd4d2f 100644 >> --- a/gdb/Makefile.in >> +++ b/gdb/Makefile.in >> @@ -143,10 +143,12 @@ MAKEINFO_CMD = $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS) >> MAKEHTML = $(MAKEINFO_CMD) --html >> MAKEHTMLFLAGS = >> >> +LIBTOOL = @LIBTOOL@ >> + >> # Set this up with gcc if you have gnu ld and the loader will print out >> # line numbers for undefined references. >> #CC_LD = g++ -static >> -CC_LD = $(CXX) $(CXX_DIALECT) >> +CC_LD = $(LIBTOOL) --mode=link $(CXX) $(CXX_DIALECT) >> >> # Where is our "include" directory? Typically $(srcdir)/../include. >> # This is essentially the header file directory for the library >> @@ -163,7 +165,7 @@ CTF_DEPS = @CTF_DEPS@ >> >> # Where is the BFD library? Typically in ../bfd. >> BFD_DIR = ../bfd >> -BFD = $(BFD_DIR)/libbfd.a >> +BFD = $(BFD_DIR)/libbfd.la >> BFD_SRC = $(srcdir)/$(BFD_DIR) >> BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC) >> >> @@ -2017,7 +2019,8 @@ install-only: $(CONFIG_INSTALL) >> true ; \ >> fi ; \ >> $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \ >> - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdb$(EXEEXT) \ >> + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \ >> + gdb$(EXEEXT) \ >> $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ >> $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \ >> $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h >> @@ -2529,7 +2532,8 @@ install-gdbtk: >> true ; \ >> fi ; \ >> $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \ >> - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) insight$(EXEEXT) \ >> + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \ >> + insight$(EXEEXT) \ >> $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ >> $(SHELL) $(srcdir)/../mkinstalldirs \ >> $(DESTDIR)$(GDBTK_LIBRARY) ; \ >> diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 >> index 3ed4a58d39f..4aac87b52ed 100644 >> --- a/gdb/aclocal.m4 >> +++ b/gdb/aclocal.m4 >> @@ -212,4 +212,9 @@ m4_include([../config/override.m4]) >> m4_include([../config/pkg.m4]) >> m4_include([../config/plugins.m4]) >> m4_include([../config/tcl.m4]) >> +m4_include([../libtool.m4]) >> +m4_include([../ltoptions.m4]) >> +m4_include([../ltsugar.m4]) >> +m4_include([../ltversion.m4]) >> +m4_include([../lt~obsolete.m4]) >> m4_include([acinclude.m4]) >> diff --git a/gdb/configure.ac b/gdb/configure.ac >> index fceb80e8c9d..4fd77e48576 100644 >> --- a/gdb/configure.ac >> +++ b/gdb/configure.ac >> @@ -46,6 +46,10 @@ ACX_NONCANONICAL_TARGET >> >> AC_ARG_PROGRAM >> >> +# We require libtool to link with the in-tree libtool libraries >> +# the proper way. >> +LT_INIT >> + >> # We require a C++11 compiler. Check if one is available, and if >> # necessary, set CXX_DIALECT to some -std=xxx switch. >> AX_CXX_COMPILE_STDCXX(11, , mandatory) >> @@ -2092,7 +2096,7 @@ AC_ARG_ENABLE([libbacktrace], >> >> if test "${enable_libbacktrace}" = "yes"; then >> LIBBACKTRACE_INC="-I$srcdir/../libbacktrace/ -I../libbacktrace/" >> - LIBBACKTRACE_LIB=../libbacktrace/.libs/libbacktrace.a >> + LIBBACKTRACE_LIB=../libbacktrace/libbacktrace.la >> AC_DEFINE(HAVE_LIBBACKTRACE, 1, [Define if libbacktrace is being used.]) >> else >> LIBBACKTRACE_INC= >> @@ -2151,15 +2155,10 @@ AC_ARG_WITH(xxhash, >> [], [with_xxhash=auto]) >> >> GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections]) >> -if test x${enable_static} = xno; then >> - LIBCTF="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so" >> - CTF_DEPS="../libctf/.libs/libctf.so" >> -else >> - LIBCTF="../libctf/.libs/libctf.a" >> - CTF_DEPS="$LIBCTF" >> -fi >> if test "${enable_libctf}" = yes; then >> AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections]) >> + LIBCTF="../libctf/libctf.la" >> + CTF_DEPS="../libctf/libctf.la" >> else >> LIBCTF= >> CTF_DEPS= >> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp >> index e2cda30b95a..63d57581d13 100644 >> --- a/gdb/testsuite/lib/gdb.exp >> +++ b/gdb/testsuite/lib/gdb.exp >> @@ -154,7 +154,7 @@ global GDB_DATA_DIRECTORY >> global inferior_spawn_id >> >> if [info exists TOOL_EXECUTABLE] { >> - set GDB $TOOL_EXECUTABLE >> + set GDB "libtool --mode=execute $TOOL_EXECUTABLE" > > Can you explain why this is needed? My understanding is that > TOOL_EXECUTABLE can be used to point to an arbitrary gdb executable to > test. If it's a gdb that has been "make install"ed, then libtool > doesn't have to be involved. If pointing to a gdb executable in its > build directory, then "gdb" will be a libtool script that sets all the > right runtime library paths. The only moment I can imagine this would > be useful would be if TOOL_EXECUTABLE consists of a wrapper around > gdb, e.g. "valgrind /path/to/build/gdb". Hm, I actually changed that to see if it would help with the failing tests, since these (related to forking etc) may have been sensible to the fact the libtool wrapper script introduced an additional process in the chain. I agree with you, will remove this thunk from the next version of the patch. Thanks for the review!
Hi Simon. >> NOTE4: Now the installed shared object libbfd.so is used by gdb >> if binutils is installed with --enable-shared. > > Do you mean bfd instead of binutils? Or do you mean binutils in the > sense that bfd is part of binutils? Sorry I failed to answer this: I mean the second.
diff --git a/ChangeLog b/ChangeLog index 73c3a006881..fea3f7c6877 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2022-11-05 Jose E. Marchesi <jose.marchesi@oracle.com> + + * gdb/aclocal.m4: include libtool macros from the top-level + directory. + * gdb/Makefile.in (LIBTOOL): Define. + (CC_LD): Use libtool for linking. + (install-only): Use libtool for installing GDB$(EXEEXT). + (install-gdbtk): Likewise for insight$(EXEEXT). + Use libbfd.la instead of libbfd.a. + * gdb/configure.ac: Call LT_INIT. + Refer to libctf.la and libbacktrace.la. + * gdb/configure: Regenerate. + * gdb/testsuite/lib/gdb.exp: Run uninstalled GDB with libtool + --mode=execute. + 2022-10-10 Nick Clifton <nickc@redhat.com> * src-release.sh: Add "-r <date>" option to create reproducible diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c528ee5aa80..b03eedd4d2f 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -143,10 +143,12 @@ MAKEINFO_CMD = $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS) MAKEHTML = $(MAKEINFO_CMD) --html MAKEHTMLFLAGS = +LIBTOOL = @LIBTOOL@ + # Set this up with gcc if you have gnu ld and the loader will print out # line numbers for undefined references. #CC_LD = g++ -static -CC_LD = $(CXX) $(CXX_DIALECT) +CC_LD = $(LIBTOOL) --mode=link $(CXX) $(CXX_DIALECT) # Where is our "include" directory? Typically $(srcdir)/../include. # This is essentially the header file directory for the library @@ -163,7 +165,7 @@ CTF_DEPS = @CTF_DEPS@ # Where is the BFD library? Typically in ../bfd. BFD_DIR = ../bfd -BFD = $(BFD_DIR)/libbfd.a +BFD = $(BFD_DIR)/libbfd.la BFD_SRC = $(srcdir)/$(BFD_DIR) BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC) @@ -2017,7 +2019,8 @@ install-only: $(CONFIG_INSTALL) true ; \ fi ; \ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdb$(EXEEXT) \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \ + gdb$(EXEEXT) \ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \ $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h @@ -2529,7 +2532,8 @@ install-gdbtk: true ; \ fi ; \ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) insight$(EXEEXT) \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \ + insight$(EXEEXT) \ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ $(SHELL) $(srcdir)/../mkinstalldirs \ $(DESTDIR)$(GDBTK_LIBRARY) ; \ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 index 3ed4a58d39f..4aac87b52ed 100644 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -212,4 +212,9 @@ m4_include([../config/override.m4]) m4_include([../config/pkg.m4]) m4_include([../config/plugins.m4]) m4_include([../config/tcl.m4]) +m4_include([../libtool.m4]) +m4_include([../ltoptions.m4]) +m4_include([../ltsugar.m4]) +m4_include([../ltversion.m4]) +m4_include([../lt~obsolete.m4]) m4_include([acinclude.m4]) diff --git a/gdb/configure.ac b/gdb/configure.ac index fceb80e8c9d..4fd77e48576 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -46,6 +46,10 @@ ACX_NONCANONICAL_TARGET AC_ARG_PROGRAM +# We require libtool to link with the in-tree libtool libraries +# the proper way. +LT_INIT + # We require a C++11 compiler. Check if one is available, and if # necessary, set CXX_DIALECT to some -std=xxx switch. AX_CXX_COMPILE_STDCXX(11, , mandatory) @@ -2092,7 +2096,7 @@ AC_ARG_ENABLE([libbacktrace], if test "${enable_libbacktrace}" = "yes"; then LIBBACKTRACE_INC="-I$srcdir/../libbacktrace/ -I../libbacktrace/" - LIBBACKTRACE_LIB=../libbacktrace/.libs/libbacktrace.a + LIBBACKTRACE_LIB=../libbacktrace/libbacktrace.la AC_DEFINE(HAVE_LIBBACKTRACE, 1, [Define if libbacktrace is being used.]) else LIBBACKTRACE_INC= @@ -2151,15 +2155,10 @@ AC_ARG_WITH(xxhash, [], [with_xxhash=auto]) GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections]) -if test x${enable_static} = xno; then - LIBCTF="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so" - CTF_DEPS="../libctf/.libs/libctf.so" -else - LIBCTF="../libctf/.libs/libctf.a" - CTF_DEPS="$LIBCTF" -fi if test "${enable_libctf}" = yes; then AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections]) + LIBCTF="../libctf/libctf.la" + CTF_DEPS="../libctf/libctf.la" else LIBCTF= CTF_DEPS= diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e2cda30b95a..63d57581d13 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -154,7 +154,7 @@ global GDB_DATA_DIRECTORY global inferior_spawn_id if [info exists TOOL_EXECUTABLE] { - set GDB $TOOL_EXECUTABLE + set GDB "libtool --mode=execute $TOOL_EXECUTABLE" } if ![info exists GDB] { if ![is_remote host] {