From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2RuAJ80dzl9CQgAAWB0awg (envelope-from ) for ; Mon, 07 Dec 2020 07:19:25 -0500 Received: by simark.ca (Postfix, from userid 112) id 99A0E1F096; Mon, 7 Dec 2020 07:19:25 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 283A01EFBB for ; Mon, 7 Dec 2020 07:19:25 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF7553894C31; Mon, 7 Dec 2020 12:19:24 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 1A4D9385783D for ; Mon, 7 Dec 2020 12:19:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1A4D9385783D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3186FACF9; Mon, 7 Dec 2020 12:19:21 +0000 (UTC) Date: Mon, 7 Dec 2020 13:19:19 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp Message-ID: <20201207121918.GA14252@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, There's a single test-case in the testsuite that explicitly calls gnatbind and gnatlink: gdb.ada/catch_ex_std.exp. Instead, use gnatmake and pass specific gnatbind and gnatlink options using gnatmake passthrough options -bargs and -largs. Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp gdb/testsuite/ChangeLog: 2020-12-07 Tom de Vries * gdb.ada/catch_ex_std.exp: Use gnatmake -bargs and -largs instead of calling gnatbind and gnatlink. --- gdb/testsuite/gdb.ada/catch_ex_std.exp | 70 +++++++++++----------------------- 1 file changed, 22 insertions(+), 48 deletions(-) diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp index c3339c3492..31f062425b 100644 --- a/gdb/testsuite/gdb.ada/catch_ex_std.exp +++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp @@ -23,8 +23,6 @@ if { [skip_ada_tests] } { return -1 } standard_ada_testfile foo -set ofile ${binfile}.o - set srcfile2 [file join [file dirname $srcfile] some_package.adb] set ofile2 [standard_output_file some_package.o] set sofile [standard_output_file libsome_package.so] @@ -51,56 +49,32 @@ if {[gdb_compile_shlib $ofile2 $sofile \ return -1 } -# Now we can compile the main program to an object file; but again, we -# can't compile directly using gnatmake. -if {[target_compile_ada_from_dir $outdir $srcfile $ofile object debug] != ""} { - return -1 +# Set linkarg such that the executable can find the shared library. +if {[istarget "*-*-mingw*"] + || [istarget *-*-cygwin*] + || [istarget *-*-pe*] + || [istarget arm*-*-symbianelf*]} { + # Do not need anything. + set linkarg "" +} elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} { + set linkarg "-Wl,-rpath,$outdir" +} else { + set linkarg "-Wl,-rpath,\\\$ORIGIN" } -set gnatbind [find_ada_tool gnatbind] -set gnatlink [find_ada_tool gnatlink] +# Make sure we link against the shared GNAT run time. +set gnatbind_options "-shared" -with_cwd $outdir { - # Test if gnatbind is supported - set status [remote_exec host "$gnatbind --version"] - if {[lindex $status 0] == -1} { - unsupported "gnatbind foo" - return -1 - } - # Bind. - set status [remote_exec host "$gnatbind -shared foo"] - if {[lindex $status 0] == 0} { - pass "gnatbind foo" - } else { - fail "gnatbind foo" - return -1 - } +# Link against the shared library. +set gnatlink_options "$linkarg -Wl,-lsome_package" - # Test if gnatlink is supported - set status [remote_exec host "$gnatlink --version"] - if {[lindex $status 0] == -1} { - unsupported "gnatlink foo" - return -1 - } - # Finally, link. - if {[istarget "*-*-mingw*"] - || [istarget *-*-cygwin*] - || [istarget *-*-pe*] - || [istarget arm*-*-symbianelf*]} { - # Do not need anything. - set linkarg "" - } elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} { - set linkarg "-Wl,-rpath,$outdir" - } else { - set linkarg "-Wl,-rpath,\\\$ORIGIN" - } - set status [remote_exec host "$gnatlink foo $linkarg -Wl,-lsome_package"] - if {[lindex $status 0] == 0} { - pass "gnatlink foo" - } else { - fail "gnatlink foo" - return -1 - } +# Create executable. +set options [list \ + -bargs $gnatbind_options -margs \ + -largs $gnatlink_options -margs \ + debug] +if {[gdb_compile_ada $srcfile $binfile executable $options] != ""} { + return -1 } clean_restart ${testfile}