From patchwork Fri Oct 26 13:31:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 149592 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp773459ljp; Fri, 26 Oct 2018 06:32:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5czMZt7ba/cypNpmL9QUw3eOyOBBkVWPQaSJXBJK6ev6J1vH4ETiZSj3kKcM9bEx3oyTumG X-Received: by 2002:a17:902:5a09:: with SMTP id q9-v6mr3580035pli.186.1540560750274; Fri, 26 Oct 2018 06:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540560750; cv=none; d=google.com; s=arc-20160816; b=hqi1YY4edkKQJujAZjibw47e+3cOHSIW3uYTw9KpoQRL2aiBVhfet8TYiQwGvhmCoL rYKn+IZ9+4IxScuWJpiDr3DBbGGrHZo5YxG2359eFPQYUnBkKSPwKpMXwmMzIfIrb7ti /f11cHQ76AhTZqojJF4cScfiOHrdYkCPuFUZ3vm5w/zEgmX2oMgyaX7TR2DfGYVMxQXh LLNXKRpE6nISKecnVpXFMx6ICWTh3gZb5CSFc1J9GZRx/t8ntL2NcU9+jCza0mxjDMoD az+TKyxV63cx6UEzBIYC0uqDS6C+IZO8aPVa+91mvhKGuTAfXAv1zUVMKNwB0RuEEA4P e79Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ufdbG2yuJikMxfze1Ufd7/3+1tr1zm0uvas3OVvYadg=; b=W029gANYfBHcBXN6zNk9rVw1P9rHLZQjSDW1NODB4bNJkd5U/lzg7clRbyw0Wgg37L XariUwrh7XWoyBOp6belJEkXsn/oJ5Q8Rd8V19Dpqya+QyExqcjOIKfi64OSurMJo1hi /efjbKzd291/gFWjQEQ/Wck+LbQ4ysMFAW2/wss3lEUpbFHhMIlzUTlPZTbeiaUasayg C6Tw/HSK+/ZZ5MAPANtYH6Qkg2yIPfHMvIoJnFfXoMvy1IrKwSINWZJqZ4ycClAhvw8J V7h3K5j8HkvsCB/uCQK3oaGQKUq4n5MCHymBP1hBuvYUgiSPWvnUQgI6c/jk7+dV2cXx 4oyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=X41EgPu0; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jq96RW0Q; spf=pass (google.com: domain of binutils-return-104005-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-104005-patch=linaro.org@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i12-v6si4440152pgl.83.2018.10.26.06.32.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 06:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-104005-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=X41EgPu0; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jq96RW0Q; spf=pass (google.com: domain of binutils-return-104005-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-104005-patch=linaro.org@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; q=dns; s=default; b=RFYpjFi SlE4iN6iixyol15LqHJdpqOLUVzRIoEE59C4JnyeohocTnK7YOrGVdyqrO25C8YO NP18WR52c6RZC+w31QelUt87EoOIFK1ZdginJpcN1NmplATCKjOpxoWwLoJgI1Cz EgFO3+qTZRnZNODxSy9nOsXbIeODFWwCbAGk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=default; bh=ISn7LWhBXuWkz bRGKkkphDjkM2M=; b=X41EgPu0MtVp0jQZ6t7xuD7uE9tlNFM6KlwLkmVz/7mlx umOuQWPNLmee8IeTyytEVdi4dML6h7t7tUXBPG4N7HCcjBXFKuUqNniT5EsMNnqq ciXXlXLTmXMPeedEagL5hYG1UsTsgCwQNDpZjgHkjV6iUXqMxPPZix0OgEisjY= Received: (qmail 71354 invoked by alias); 26 Oct 2018 13:31:41 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 71217 invoked by uid 89); 26 Oct 2018 13:31:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-it1-f181.google.com Received: from mail-it1-f181.google.com (HELO mail-it1-f181.google.com) (209.85.166.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Oct 2018 13:31:37 +0000 Received: by mail-it1-f181.google.com with SMTP id k206-v6so1534857ite.0 for ; Fri, 26 Oct 2018 06:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=mOFTysLsSAlh4tmwAQ1TgHbV2XmpPW09OjYRWjOgCYc=; b=Jq96RW0Q43fMEZSZTKSCXPPEAsGK+Fn+8znk0OHZCa/PvX7Nlu+6Bpj4Rk4lCtD1Yz Os1GC2ATgW69KtAOMoBG+6BXfGSb+Wsfz//oE30lw9TLr3qM356DITitEHm4ifar+Xtg UFDppnrH1axajtKt8JGBfmf8sZiltybOaJe0M= MIME-Version: 1.0 References: In-Reply-To: From: Thomas Preudhomme Date: Fri, 26 Oct 2018 14:31:24 +0100 Message-ID: Subject: [PATCH] [testsuite] Fix ld action in run_dump_test To: Nick Clifton , Alan Modra , binutils@sourceware.org X-IsSubscribed: yes [Resending with proper subject tag] On Fri, 26 Oct 2018 at 14:28, Thomas Preudhomme wrote: > > Hi, > > run_dump_test proposes an ld action but when trying to make use of it in > a gas test it gave me some Tcl error. It turns out that it references > the check_shared_lib_support procedure and ld_elf_shared_opt variable > both only available in ld-lib.exp. I've thus moved the procedure in > binutils-common.exp and defined the variable needed in the various > default.exp of testsuite that seem to be using run_dump_test. > > Since check_shared_lib_support itself references the ld variable not > defined in binutils-common I've defined it from LD in run_dump_test and > fixed LD and LDFLAGS to be defined as expected by run_dump_test in the > various default.exp of testsuite using run_dump_test. > > ChangeLog entries are as follows: > > *** binutils/ChangeLog *** > > 2018-10-26 Thomas Preud'homme > > * testsuite/config/default.exp: Define LD, LDFLAGS and > ld_elf_shared_opt. > * testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved > from ld-lib.exp. > (run_dump_test): Set ld to $LD. > > *** gas/ChangeLog *** > > 2018-10-26 Thomas Preud'homme > > * testsuite/config/default.exp: Define LD, LDFLAGS and > ld_elf_shared_opt. > > *** ld/ChangeLog *** > > 2018-10-26 Thomas Preud'homme > > * testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to > binutils-common.exp. > > Testing: Successfully ran tests using the ld action in gas testsuite. No > regression in the testsuite when targeting arm-none-eabi. > > Is this ok for master? > > Best regards, > > Thomas >From f95da8ba8149df5d79afc7cccc9db7d2e91db9f6 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 26 Oct 2018 11:43:33 +0100 Subject: [PATCH 1/2] [testsuite] Fix ld action in run_dump_test Hi, run_dump_test proposes an ld action but when trying to make use of it in a gas test it gave me some Tcl error. It turns out that it references the check_shared_lib_support procedure and ld_elf_shared_opt variable both only available in ld-lib.exp. I've thus moved the procedure in binutils-common.exp and defined the variable needed in the various default.exp of testsuite that seem to be using run_dump_test. Since check_shared_lib_support itself references the ld variable not defined in binutils-common I've defined it from LD in run_dump_test and fixed LD and LDFLAGS to be defined as expected by run_dump_test in the various default.exp of testsuite using run_dump_test. ChangeLog entries are as follows: *** binutils/ChangeLog *** 2018-10-26 Thomas Preud'homme * testsuite/config/default.exp: Define LD, LDFLAGS and ld_elf_shared_opt. * testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved from ld-lib.exp. (run_dump_test): Set ld to $LD. *** gas/ChangeLog *** 2018-10-26 Thomas Preud'homme * testsuite/config/default.exp: Define LD, LDFLAGS and ld_elf_shared_opt. *** ld/ChangeLog *** 2018-10-26 Thomas Preud'homme * testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to binutils-common.exp. Testing: Successfully ran tests using the ld action in gas testsuite. No regression in the testsuite when targeting arm-none-eabi. Is this ok for master? Best regards, Thomas --- binutils/testsuite/config/default.exp | 8 ++++++++ binutils/testsuite/lib/binutils-common.exp | 19 +++++++++++++++++++ gas/testsuite/config/default.exp | 8 ++++++++ ld/testsuite/lib/ld-lib.exp | 17 ----------------- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp index 6c55be66f5..1bfe72e8c8 100644 --- a/binutils/testsuite/config/default.exp +++ b/binutils/testsuite/config/default.exp @@ -28,6 +28,14 @@ if ![info exists ASFLAGS] then { set ASFLAGS "" } +if ![info exists LD] then { + set LD [findfile $base_dir/../ld/ld-new $base_dir/../ld/ld-new [transform ld]] +} +if ![info exists LDFLAGS] then { + set LDFLAGS "" +} +set ld_elf_shared_opt "-z norelro" + if ![info exists NM] then { set NM [findfile $base_dir/nm-new $base_dir/nm-new [transform nm]] } diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 08d57ae963..fcd2c8ee0c 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -248,6 +248,23 @@ proc is_bad_symtab {} { return 0; } +# Returns true if -shared is supported on the target + +proc check_shared_lib_support { } { + global shared_available_saved + global ld + + if {![info exists shared_available_saved]} { + set ld_output [remote_exec host $ld "-shared"] + if { [ string first "not supported" $ld_output ] >= 0 } { + set shared_available_saved 0 + } else { + set shared_available_saved 1 + } + } + return $shared_available_saved +} + # Compare two files line-by-line. FILE_1 is the actual output and FILE_2 # is the expected output. Ignore blank lines in either file. # @@ -1002,6 +1019,8 @@ proc run_dump_test { name {extra_options {}} } { catch "exec rm -f $objfile" exec_output set ld_extra_opt "" + global ld + set ld "$LD" if { [is_elf_format] && [check_shared_lib_support] } { set ld_extra_opt "$ld_elf_shared_opt" } diff --git a/gas/testsuite/config/default.exp b/gas/testsuite/config/default.exp index 888e90d178..b76c5baa44 100644 --- a/gas/testsuite/config/default.exp +++ b/gas/testsuite/config/default.exp @@ -26,6 +26,14 @@ if ![info exists ASFLAGS] then { set ASFLAGS "" } +if ![info exists LD] then { + set LD [findfile $base_dir/../../ld/ld-new $base_dir/../../ld/ld-new [transform ld]] +} +if ![info exists LDFLAGS] then { + set LDFLAGS "" +} +set ld_elf_shared_opt "-z norelro" + if ![info exists OBJDUMP] then { set OBJDUMP [findfile $base_dir/../../binutils/objdump \ $base_dir/../../binutils/objdump \ diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index d6453f1995..3fb1e58a0c 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1069,23 +1069,6 @@ proc check_gc_sections_available { } { return $gc_sections_available_saved } -# Returns true if -shared is supported on the target - -proc check_shared_lib_support { } { - global shared_available_saved - global ld - - if {![info exists shared_available_saved]} { - set ld_output [remote_exec host $ld "-shared"] - if { [ string first "not supported" $ld_output ] >= 0 } { - set shared_available_saved 0 - } else { - set shared_available_saved 1 - } - } - return $shared_available_saved -} - # Return true if target uses genelf.em (assuming it is ELF). proc is_generic_elf { } { if { [istarget "d30v-*-*"] -- 2.19.1