From patchwork Tue May 14 21:49:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1099757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500702-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="sCPSFMp8"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="Y+9iLziV"; dkim=pass (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="KOAmK1nH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WYQ1kWrz9sB8 for ; Wed, 15 May 2019 07:49:30 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-id:content-transfer-encoding:mime-version; q=dns; s=default; b=JSxzA+zpIbTSGv8DLMjNcEXFqrVcp4G4O2giQsLXBIL mWkK7tt3WSI/jjmp6Tgv+6SekddYhzuK78gmlCZxIdEo73fExkcfyRP/EFCX0zQ7 /yhQciX+OuQbjVE3wlC38lJj13rfDWWzr8urMGiwzqtbNmUpWYn89Z4HP+Xt2GOk = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-id:content-transfer-encoding:mime-version; s=default; bh=jV7BfKQI7hyzsa/geTnb6qdUZbg=; b=sCPSFMp895zKyZfMf 8UZjgkjjlU+5XXj55aMviGg/oxoegvIQqlnzdEbdsWhOHgR6uzZiYC6VMEp4C5Rh 6iGKMJnSJgTKLfGxGR05LwNFmesTE6WA0TpBqzNWPcZqETcIOdS/tsIcWRXrsiWs VlGl2kSs4+RMaDds17Sdc6BRd4= Received: (qmail 74607 invoked by alias); 14 May 2019 21:49:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 74598 invoked by uid 89); 14 May 2019 21:49:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa3.hgst.iphmx.com Received: from esa3.hgst.iphmx.com (HELO esa3.hgst.iphmx.com) (216.71.153.141) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:49:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1557870559; x=1589406559; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=ZJdbC/+Xwz7faykM6MnNmQEx0SQ84wcHJXmRSQGxQr4=; b=Y+9iLziVz08D/twRStEbrJ5d5hGOhamw1hAB1xzb3tR721G+p3PlJngW l4ws5oP9f4q75QmKh0StdvhCpwm9+bNxx8JaK22rLBZhR12cCEB0NJ8kn 2DzhjvtpfIMW3+bxUdx2Xpbn41zKJMTGcXSu3Ei3MgNCL/CFFrapdvQ0L dK0vb+YojETv3N6JNIFUbbHBUtVcPjtYlIXkPU0dvP/dBTuhRy4tm4N8d gN09kMbdU2gbsnR/FBzHjXoa5QD5YTeFk1g3yYv8aAfu2CDhftYChTq5T skDFE2my7Cy9oEACQaz95PEOcjS3h/776G1uwr7NjXemNedPtwP+ffLPl Q==; Received: from mail-bn3nam01lp2056.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.56]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2019 05:49:17 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ewGa0KrRfH/77o8eLfCpZRWhNx9dqPQFHu2Go5T4avs=; b=KOAmK1nHczheS7ghvgOk6yZBSgZrxjGMz/dgsqaui7cFvP/1+r0wtGQAy5Vik7Bc/9tgTt1GFUvbPVGN9HpLoPf8JADtvAtRGU/b5VlWtq+jE/h9hbK08rj7yXltIufcGcRKxGJ9wVlJj6nw3unG5rK2unFwvKUJOvicreWctPM= Received: from BYAPR04MB6262.namprd04.prod.outlook.com (20.178.235.160) by BYAPR04MB4856.namprd04.prod.outlook.com (52.135.232.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 21:49:15 +0000 Received: from BYAPR04MB6262.namprd04.prod.outlook.com ([fe80::31ee:c691:33ca:b46b]) by BYAPR04MB6262.namprd04.prod.outlook.com ([fe80::31ee:c691:33ca:b46b%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 21:49:15 +0000 From: "Maciej W. Rozycki" To: "gcc-patches@gcc.gnu.org" , "dejagnu@gnu.org" CC: Arnaud Charlet , Eric Botcazou , Pierre-Marie de Rodat Subject: [PATCH 3/3][DejaGNU] target: Wrap linker flags into `-largs'/`-margs' for Ada Date: Tue, 14 May 2019 21:49:15 +0000 Message-ID: References: In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=macro@wdc.com; wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 Content-ID: <1AB7B94D00F9AB4F989FB126DE48D12D@namprd04.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED Unrecognized `gnatmake' switches are not implicitly passed on to the linker, so just pasting board `ldflags' and any other linker flags verbatim into `add_flags' to use for the invocation line of `gnatmake' will make them ignored at best. For example in a GCC test environment that has: set_board_info ldflags "-Wl,-dynamic-linker,.../sysroot/lib/ld-linux-riscv64-lp64d.so.1 -Wl,-rpath,.../sysroot/lib64/lp64d -Wl,-rpath,.../sysroot/usr/lib64/lp64d" so that sysroot paths are correctly embedded with the binaries linked for use with the dynamic loader and shared library dependencies, the setting will be ignored for the GNAT test suite making all the execution tests fail, e.g.: PASS: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors) spawn qemu-riscv64 ./abstract_with_anonymous_result.exe /lib/ld-linux-riscv64-lp64d.so.1: No such file or directory FAIL: gnat.dg/abstract_with_anonymous_result.adb execution test For `gnatmake' to pass switches on to the linker the `-largs' switch has to be used, which affects all the switches that follow until a switch is seen that changes the selection, like `-margs', which resets to the initial state of the switch interpretation machine. Wrap linker flags into `-largs'/`-margs' for Ada then, carefully preserving the place these flags are placed within `add_flags', as surely someone will have depended on that, correcting test failures like above: PASS: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors) spawn qemu-riscv64 ./abstract_with_anonymous_result.exe PASS: gnat.dg/abstract_with_anonymous_result.adb execution test * lib/target.exp (default_target_compile): Wrap linker flags into `-largs'/`-margs' for Ada. Signed-off-by: Maciej W. Rozycki --- Hi, My WDC copyright paperwork has not been sorted with FSF yet, however I have not contributed to DejaGNU on behalf of WDC so far and I believe this change falls within the limit of roughly 15 lines to be considered legally insignificant given that: "A regular series of repeated changes, such as renaming a symbol, is not legally significant even if the symbol has to be renamed in many places." Please apply then; this does not rely on 2/3 in any way, as we ought to handle Ada compilations correctly regardless of whether our caller does the right thing there. Maciej --- lib/target.exp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) dejagnu-target-ada-ldflags.diff Index: dejagnu/lib/target.exp =================================================================== --- dejagnu.orig/lib/target.exp +++ dejagnu/lib/target.exp @@ -518,11 +518,12 @@ proc default_target_compile {source dest } if { $type eq "executable" } { + set extra_ldflags "" if {[board_info $dest exists ldflags]} { - append add_flags " [board_info $dest ldflags]" + append extra_ldflags " [board_info $dest ldflags]" } if { $compiler_type eq "c++" } { - append add_flags " [g++_link_flags]" + append extra_ldflags " [g++_link_flags]" } if {[isnative]} { # This is a lose. @@ -530,16 +531,23 @@ proc default_target_compile {source dest if { $tmp ne "" } { if {[regexp ".*solaris2.*" $target_triplet]} { # Solaris 2 - append add_flags " -R$tool_root_dir/libstdc++" + append extra_ldflags " -R$tool_root_dir/libstdc++" } elseif {[regexp ".*(osf|irix5|linux).*" $target_triplet]} { # OSF/1 or IRIX 5 - append add_flags " -Wl,-rpath,$tool_root_dir/libstdc++" + append extra_ldflags " -Wl,-rpath,$tool_root_dir/libstdc++" } elseif {[regexp ".*hppa.*" $target_triplet]} { # HP-UX - append add_flags " -Wl,-a,shared_archive" + append extra_ldflags " -Wl,-a,shared_archive" } } } + if { $extra_ldflags ne "" } { + if { $compiler_type eq "ada" } { + append add_flags " -largs $extra_ldflags -margs" + } else { + append add_flags " $extra_ldflags" + } + } } if {![info exists ldscript]} { @@ -561,7 +569,11 @@ proc default_target_compile {source dest } if { $type eq "executable" } { - append add_flags " $ldflags" + if { $compiler_type eq "ada" } { + append add_flags " -largs $ldflags -margs" + } else { + append add_flags " $ldflags" + } foreach x $libs { if {[file exists $x]} { append source " $x"