From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117129 invoked by alias); 10 Mar 2017 16:24:44 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 117019 invoked by uid 89); 10 Mar 2017 16:24:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=3276 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Mar 2017 16:24:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6408C28 for ; Fri, 10 Mar 2017 08:24:40 -0800 (PST) Received: from [10.2.206.198] (e104437-lin.cambridge.arm.com [10.2.206.198]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6F5AE3F575 for ; Fri, 10 Mar 2017 08:24:40 -0800 (PST) Subject: [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler To: Binutils References: <7a7efa33-82bd-4865-c5c2-787eaed089b0@foss.arm.com> From: Jiong Wang Message-ID: <4ac291e6-1baf-361d-6ce2-238a33064b79@foss.arm.com> Date: Fri, 10 Mar 2017 16:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <7a7efa33-82bd-4865-c5c2-787eaed089b0@foss.arm.com> Content-Type: multipart/mixed; boundary="------------F994865D1976ECCAE448C4DC" X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00143.txt.bz2 This is a multi-part message in MIME format. --------------F994865D1976ECCAE448C4DC Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 888 This is the following error on arm bare-metal FAIL: Build rdynamic-1 "-rdynamic" is not supported by most bare-metal GCC, the only bare-metal I am aware of is https://gcc.gnu.org/ml/gcc-patches/2011-02/msg00567.html This patch implemented a -rdynamic availability check and gated "rdynamic-1" build test. GCC testsuite has added similar checks this week. https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00258.html No regression on X86-64/AArch64 native ld check. OK for master? Thanks. ld/ 2017-03-10 Jiong Wang * testsuite/lib/ld-lib.exp (check_rdynamic_available): New function. * testsuite/ld-elf/shared.exp (build_tests): Split tests which require GCC "-rdynamic" option support into "rdynamic_build_tests". (rdynamic_build_tests): New and only run it when check_rdynamic_available returns true. --------------F994865D1976ECCAE448C4DC Content-Type: text/x-diff; name="rdynamic-check.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rdynamic-check.patch" Content-length: 2351 diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 070915a791d6055e1ebc29262c8bccfbb7f9d764..dcbb52e0cdd4aa24c09ed2a5a21084f1bcca7eac 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -327,9 +327,6 @@ set build_tests { {"Build libpr2404b.a" "" "" {pr2404b.c} {} "libpr2404b.a"} - {"Build rdynamic-1" - "-rdynamic -Wl,--gc-sections" "-ffunction-sections" - {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"} {"Build dynamic-1" "-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections" {dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"} @@ -370,6 +367,17 @@ set build_tests { run_cc_link_tests $build_tests +set rdynamic_build_tests { + {"Build rdynamic-1" + "-rdynamic -Wl,--gc-sections" "-ffunction-sections" + {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"} +} + +# Only build them when -rdynamic is supported by compiler. +if [check_rdynamic_available] { + run_cc_link_tests $rdynamic_build_tests +} + set run_tests [list \ [list "Run normal with libfoo.so" \ "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" \ diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 42cfe1c824f7f40249baf694295f9f8e501e543a..7fb7efb2bc1297aca8228ee94aefd5dd2eec7bcc 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -2210,3 +2210,36 @@ proc check_libdl_available { } { } return $libdl_available_saved } + +# Return true if compiler driver support -rdynamic. + +proc check_rdynamic_available { } { + global rdynamic_available_saved + global CC + + if {![info exists rdynamic_available_saved]} { + if { [which $CC] == 0 } { + set rdynamic_available_saved 0 + return 0 + } + + set basename "tmpdir/rdynamic_avail_test[pid]" + set src ${basename}.c + set output ${basename}.out + set f [open $src "w"] + # Sample test file. + puts $f "int main (void)" + puts $f "{" + puts $f " return 0; " + puts $f "}" + close $f + if [is_remote host] { + set src [remote_download host $src] + } + set rdynamic_available_saved [run_host_cmd_yesno "$CC" "$src -o $output -rdynamic"] + remote_file host delete $src + remote_file host delete $output + file delete $src + } + return $rdynamic_available_saved +} --------------F994865D1976ECCAE448C4DC--