From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id CF3FC3858283; Fri, 14 Oct 2022 11:10:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF3FC3858283 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665745805; bh=QqZUCfbOdXXhnNCnC31zTRjzOqyzoSl3GotQhTFq6UM=; h=From:To:Subject:Date:From; b=MPgzNNknVDLWf7FG9xFkXNTl93XEZ1JWUFkYKxBOyC+jVMkTeKQN8+dze5g4Cr8A3 AxreHGDlpeAbqdNEBMdBmjp1je6shMdQfk7jNw5gMLyryy6nXk06i7x2bB6HJOV69R luFc1dHL0JdYfklD2EpDBt9g9V9sfpjF+1KZXWlQ= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Factor out with_PIE_multilib_flags_filtered X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 1e4be05b752cc94019ed12d6d305e13e55530724 X-Git-Newrev: 1806054393e033dfac661fe4f68683a23646cb61 Message-Id: <20221014111005.CF3FC3858283@sourceware.org> Date: Fri, 14 Oct 2022 11:10:05 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D1806054393e0= 33dfac661fe4f68683a23646cb61 commit 1806054393e033dfac661fe4f68683a23646cb61 Author: Tom de Vries Date: Fri Oct 14 13:09:50 2022 +0200 [gdb/testsuite] Factor out with_PIE_multilib_flags_filtered =20 Factor out new procs with_PIE_multilib_flags_filtered and with_multilib_flags_filtered from proc gdb_compile_shlib. =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/lib/gdb.exp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3049a7392a4..7de8bb60c19 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4983,20 +4983,17 @@ proc gdb_compile_shlib_1 {sources dest options} { return "" } =20 -# Build a shared library from SOURCES. Ignore target boards PIE-related -# multilib_flags. +# Ignore FLAGS in target board multilib_flags while executing BODY. =20 -proc gdb_compile_shlib {sources dest options} { +proc with_multilib_flags_filtered { flags body } { global board =20 - # Ignore PIE-related setting in multilib_flags. + # Ignore flags in multilib_flags. set board [target_info name] set multilib_flags_orig [board_info $board multilib_flags] set multilib_flags "" foreach op $multilib_flags_orig { - if { $op =3D=3D "-pie" || $op =3D=3D "-no-pie" \ - || $op =3D=3D "-fPIE" || $op =3D=3D "-fno-PIE"} { - } else { + if { [lsearch -exact $flags $op] =3D=3D -1 } { append multilib_flags " $op" } } @@ -5004,6 +5001,24 @@ proc gdb_compile_shlib {sources dest options} { save_target_board_info { multilib_flags } { unset_board_info multilib_flags set_board_info multilib_flags "$multilib_flags" + set result [uplevel 1 $body] + } + + return $result +} + +# Ignore PIE-related flags in target board multilib_flags while executing = BODY. + +proc with_PIE_multilib_flags_filtered { body } { + set pie_flags [list "-pie" "-no-pie" "-fPIE" "-fno-PIE"] + return [uplevel 1 [list with_multilib_flags_filtered $pie_flags $body]] +} + +# Build a shared library from SOURCES. Ignore target boards PIE-related +# multilib_flags. + +proc gdb_compile_shlib {sources dest options} { + with_PIE_multilib_flags_filtered { set result [gdb_compile_shlib_1 $sources $dest $options] }