From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wIolA71DSWOMJwwAWB0awg (envelope-from ) for ; Fri, 14 Oct 2022 07:10:53 -0400 Received: by simark.ca (Postfix, from userid 112) id 08DE41E112; Fri, 14 Oct 2022 07:10:53 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=kDJwTW9i; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [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 B49EC1E0D5 for ; Fri, 14 Oct 2022 07:10:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45E2E385E012 for ; Fri, 14 Oct 2022 11:10:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45E2E385E012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665745851; bh=LwXqgnN9dVx5x2rd4WJ5CtssmfOGFXYA9zt5V0XzQ+Q=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kDJwTW9iwf++MzZiJ4g51wdw0Jc8A9KtwuG+1ux42AEprDrxkvseEj6BCiiKNg0Yx Xd3d4NX3cN5pkkws/c6DOMiUrm11bgEQYV9eYoovLkEX5G6HRy5f0Hbtmx4Y1+A11+ eQrCT6vy/2Ybb4RWm/LXUcGdz750qiwqO7tRXBVY= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 0600C385801C for ; Fri, 14 Oct 2022 11:10:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0600C385801C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 38A4D21F6E for ; Fri, 14 Oct 2022 11:10:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 251AA13451 for ; Fri, 14 Oct 2022 11:10:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vOPeB6NDSWNdWgAAMHmgww (envelope-from ) for ; Fri, 14 Oct 2022 11:10:27 +0000 Date: Fri, 14 Oct 2022 13:10:25 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Factor out with_PIE_multilib_flags_filtered Message-ID: <20221014111024.GA11135@delia.home> 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, Factor out new procs with_PIE_multilib_flags_filtered and with_multilib_flags_filtered from proc gdb_compile_shlib. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Factor out with_PIE_multilib_flags_filtered --- 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 "" } -# Build a shared library from SOURCES. Ignore target boards PIE-related -# multilib_flags. +# Ignore FLAGS in target board multilib_flags while executing BODY. -proc gdb_compile_shlib {sources dest options} { +proc with_multilib_flags_filtered { flags body } { global board - # 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 == "-pie" || $op == "-no-pie" \ - || $op == "-fPIE" || $op == "-fno-PIE"} { - } else { + if { [lsearch -exact $flags $op] == -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] }