From patchwork Tue Jan 31 11:28:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 50777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2695154wrn; Tue, 31 Jan 2023 03:29:03 -0800 (PST) X-Google-Smtp-Source: AK7set+OtwaM6AbxkW9JaEXAz63EM0lWI5b6xCUKg4zPliUDtMbN0T7HodtobNPkXGPcCJjAzvFz X-Received: by 2002:a17:906:c2d3:b0:87b:3d29:2990 with SMTP id ch19-20020a170906c2d300b0087b3d292990mr15937505ejb.9.1675164543598; Tue, 31 Jan 2023 03:29:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675164543; cv=none; d=google.com; s=arc-20160816; b=ZZM7oRhN1B5bvFG18tawtZrzy1Eb6O4utDzQFTTaCyHl5Qbz5nML8B6dUycCpGEYbg D2GZcX9AajL6cil+u562aPXCFyPiDQ2uxU2T7h5/I5QjxW0+QwNuota/IcW6BOcJPCiV 7wswH1WdLyquw5jI/tx0BvXj8NH8Z3NoQAiKoPbfiDMNeXBEpdZYpy2C6j+h5+0Vn4jZ TPaKFTAiZ7zTRRAKIgUenjTvn1fxeHZFSQiQXcOmJAab9VBL22/e7a1fkOhQhHKTFOwx A/Rbybd6bUZ9JY7ZuB+ZdUUK7ryUXeMuqXCHd6ZBKAizSF7vq1i6wm9xI47zNP1VqT7p GmEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=BD2c/S0+JFqeuyuGFwNKzadIMMYPWpnErWO5ShuLQHE=; b=iuto3ny9epzzOcTWwLxYkywJZyWhQ9nDH7Tr6RFtQ6Qh+CFeytQK3TTrxjYWSdtYoD cVaN5KFWHkubE90o1JpKew38U+9pyLFGItDboojRfKWZbH9r3pcCkCnRxsllH3amyxfy 17OEn9fmInRvo72A9CE9vITB0+v6hclIi6zItHLVIGQkeV5pJVa7Veo87c+Egm189383 WSLZUHDCfOtWBF7h1dAKwuHXSlGtKQqQ8lzsKVjag6349OFfP39vnnXQS3D7rWbIWd+J gAM/4ttw09FhMkBCGolE5kamSkVzUTfjP3XrTWDTz55kres94vMf4+4ZMVHD/oHKgm9c +gPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c12-20020a1709063f0c00b0088720c8fc78si8830902ejj.64.2023.01.31.03.29.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 03:29:03 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50E0A38582BE for ; Tue, 31 Jan 2023 11:28:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 5F76F3858D28 for ; Tue, 31 Jan 2023 11:28:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F76F3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.97,261,1669104000"; d="scan'208,223";a="99014330" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 31 Jan 2023 03:28:32 -0800 IronPort-SDR: jeEM91MDBLnzMIw3bDZNfjuDj85pAQ9xir3Il1HntL0bQ7MLCr/pN8DzWe4jAyb5BtQ8VA22H0 i9+1mteelSgzJcvcXNTckb1Q6p+Yi+vt7Lx55p4NBXHbGI9cbOjyFWttlS9bJOfr2JDz0GFKA/ saBf2KmTPm+aN5NLMB2gd35+Q+JgJ7oFBFw6SvbwjCQATw7thxoDQwom9jT5FrKUSE+5/BSvNO 9SUf7On3iswl3UJkrAMK0jwhFCydm5CZu/LkESL2kEflS0ziOmplSrzIHqZ1qtpijRU4ki6A6m dlo= From: Thomas Schwinge To: Gaius Mulley , , Rainer Orth , Mike Stump Subject: For Modula-2 build-tree testing, also set up paths to compiler libraries (was: [PATCH] 17/19 modula2 front end: dejagnu expect library scripts) In-Reply-To: References: User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Tue, 31 Jan 2023 12:28:23 +0100 Message-ID: <87zg9zaqp4.fsf@dem-tschwing-1.ger.mentorg.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756537336491744060?= X-GMAIL-MSGID: =?utf-8?q?1756537336491744060?= Hi! On 2022-10-10T16:31:26+0100, Gaius Mulley via Gcc-patches wrote: > Here are the dejagnu expect library scripts for the gm2 > testsuite. This (or some variant thereof; haven't checked), became part of commit r13-4704-g1eee94d351774cdc2efc8ee508b82d065184c6ee "Merge modula-2 front end onto gcc". For build-tree testing ('$gccpath != ""'; such as standard 'make check'), 'gm2_link_flags' takes care to set up paths to a number of libraries that may be necessary: > --- /dev/null 2022-08-24 16:22:16.888000070 +0100 > +++ gcc-git-devel-modula2/gcc/testsuite/lib/gm2.exp 2022-10-07 20:21:18.718097775 +0100 > +set gm2_link_libraries "m2pim m2iso"; > +# gm2_link_flags - detects the whereabouts of libraries (-lstdc++). > +# > + > +proc gm2_link_flags { paths } { > + global srcdir; > + global ld_library_path; > + global gccpath; > + global gm2_link_libraries; > + > + set gccpath ${paths} > + set libio_dir "" > + set flags "" > + set ld_library_path "." > + > + set shlib_ext [get_shlib_extension] > + verbose "shared lib extension: $shlib_ext" > + > + if { $gccpath == "" } { > + global tool_root_dir > + > + set libstdcpp [lookfor_file ${tool_root_dir} libstdc++] > + if { $libstdcpp != "" } { > + append flags "-L${libstdcpp} " > + append ld_library_path ":${libstdcpp}" > + } > + } else { > + if [file exists "${gccpath}/lib/libstdc++.a"] { > + append ld_library_path ":${gccpath}/lib" > + } > + if [file exists "${gccpath}/libstdc++/libstdc++.a"] { > + append flags "-L${gccpath}/libstdc++ " > + append ld_library_path ":${gccpath}/libstdc++" > + } > + if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] { > + append flags " -L${gccpath}/libstdc++-v3/src/.libs " > + append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs" > + } > + # Look for libstdc++.${shlib_ext}. > + if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] { > + append flags " -L${gccpath}/libstdc++-v3/src/.libs " > + append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs" > + } > + > + # puts stderr "${gm2_link_libraries} before foreach" > + foreach d [list {*}${gm2_link_libraries}] { > + # puts stderr "${d} XXXX" > + send_log "ld_library_path was ${ld_library_path}\n" > + send_log "looking for ${gccpath}/lib${d}/.libs/lib${d}.a\n" > + if [file exists "${gccpath}/libgm2/lib${d}/.libs/lib${d}.a"] { > + send_log "good found ${gccpath}/libgm2/lib${d}/.libs/lib${d}.a\n" > + # append flags " -L${gccpath}/libgm2/lib${d}/.libs -l${d}" > + append flags " ${gccpath}/libgm2/lib${d}/.libs/lib${d}.a" > + append ld_library_path ":${gccpath}/libgm2/lib${d}/.libs" > + } > + send_log "ld_library_path is ${ld_library_path}\n" > + } > + } > + > + set_ld_library_path_env_vars > + return "$flags" > +} However, this misses compiler libraries (such as libgcc, which libstdc++ may depend on). For example, I see my x86_64-pc-linux-gnu '-m32' testing not pick up the build-tree libgcc, but instead some random system one, which (expectedly) doesn't satisfy requirements of other build-tree libraries: [...]/build-gcc/gcc/testsuite/gm225/m.x0: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by [...]/build-gcc/x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6) ..., and thus a lot of execution FAILs. To cure that, OK to push the attached "For Modula-2 build-tree testing, also set up paths to compiler libraries"? Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 5d9c8bf1a5352317fc7fd3fffe66ba690d412a4f Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 31 Jan 2023 11:38:15 +0100 Subject: [PATCH] For Modula-2 build-tree testing, also set up paths to compiler libraries Currently, 'gcc/testsuite/lib/gm2.exp:gm2_link_flags' doesn't set up paths to compiler libraries (such as libgcc, which libstdc++ may depend on). For example, I see my x86_64-pc-linux-gnu '-m32' testing not pick up the build-tree libgcc, but instead some random system one, which (expectedly) doesn't satisfy requirements of other build-tree libraries: [...]/build-gcc/gcc/testsuite/gm225/m.x0: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by [...]/build-gcc/x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6) ..., and thus a lot of execution FAILs. As seen in a number of other '[...]_link_flags' procedures, the standard idiom seems to be to also consider 'gcc-set-multilib-library-path' for 'ld_library_path'. gcc/testsuite/ * lib/gm2.exp (gm2_link_flags) [$gccpath != ""]: Also consider 'gcc-set-multilib-library-path' for 'ld_library_path'. --- gcc/testsuite/lib/gm2.exp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp index 15e3729e5a3..560cb719a15 100644 --- a/gcc/testsuite/lib/gm2.exp +++ b/gcc/testsuite/lib/gm2.exp @@ -316,6 +316,9 @@ proc gm2_link_flags { paths } { } send_log "ld_library_path is ${ld_library_path}\n" } + + global GCC_UNDER_TEST + append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] } set_ld_library_path_env_vars -- 2.25.1