From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YDoVMoznTGGFIQAAWB0awg (envelope-from ) for ; Thu, 23 Sep 2021 16:46:04 -0400 Received: by simark.ca (Postfix, from userid 112) id CB0391EE25; Thu, 23 Sep 2021 16:46:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 C62261EE14 for ; Thu, 23 Sep 2021 16:46:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52407385842B for ; Thu, 23 Sep 2021 20:46:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52407385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632429963; bh=pmmIxz3NAmLpZ9j+L+U+2FhfCdgwPkP/YPemKAvw4pg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QJTROfmycXma/w6i65r9BzfUKWH1r1iAY49WLAVDAa/bN95DYQZT1a9H6y9nXtw4b QWo3HKLgAUnp1rmUnEQmjzEfal3yZiL7rDkHkPuMk6XiDTHYgELvxjDaEiTPX9hkvR 2DrvL5mLjUQH/jnXyzKVNwzOHNvurK/iwe69PrIA= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 7DFB83857C7B for ; Thu, 23 Sep 2021 20:43:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7DFB83857C7B 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 ABD49223AF for ; Thu, 23 Sep 2021 20:43:46 +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 9897513EAA for ; Thu, 23 Sep 2021 20:43:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TxQkJALnTGEmGwAAMHmgww (envelope-from ) for ; Thu, 23 Sep 2021 20:43:46 +0000 Date: Thu, 23 Sep 2021 22:43:45 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Use pie instead of -fPIE -pie Message-ID: <20210923204343.GA32003@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: , 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, Replace {additional_flags=-fPIE ldflags=-pie} with {pie}. This makes sure that the test-cases properly error out when using target board unix/-fno-PIE/-no-pie. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Use pie instead of -fPIE -pie --- gdb/testsuite/gdb.base/attach-pie-misread.exp | 8 +++++--- gdb/testsuite/gdb.base/attach-pie-noexec.exp | 2 +- gdb/testsuite/gdb.base/jit-attach-pie.exp | 2 +- gdb/testsuite/gdb.base/jit-elf.exp | 3 +-- gdb/testsuite/gdb.base/pie-execl.exp | 2 +- gdb/testsuite/gdb.base/pie-fork.exp | 2 +- gdb/testsuite/gdb.base/reread.exp | 17 +++++------------ gdb/testsuite/gdb.threads/tls-nodebug-pie.exp | 2 +- 8 files changed, 16 insertions(+), 22 deletions(-) diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp index e1035765581..ad8175373c0 100644 --- a/gdb/testsuite/gdb.base/attach-pie-misread.exp +++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp @@ -25,7 +25,8 @@ standard_testfile .c set genfile [standard_output_file ${testfile}-gen.h] set executable $testfile -if {[build_executable_own_libs ${testfile}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} { +if {[build_executable_own_libs ${testfile}.exp $executable $srcfile \ + {pie}] == ""} { return -1 } @@ -95,7 +96,8 @@ if {$result == 0} { fail $test } -set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -DGEN=\"$genfile\"" "ldflags=-pie"]] +set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile \ + [list pie "additional_flags=-DGEN=\"$genfile\""]] if {$prelink_args == ""} { return -1 } @@ -118,7 +120,7 @@ verbose -log "first_offset is $first_offset" set test "first offset is non-zero" if {$first_offset == 0} { - fail "$test (-fPIE -pie in effect?)" + fail "$test (failing because PIE is not effect?)" } else { pass $test } diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp index 32e5c7ddc3a..ae3d0bc64d9 100644 --- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp +++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp @@ -20,7 +20,7 @@ if {![can_spawn_for_attach]} { standard_testfile .c set executable ${testfile} -if { [prepare_for_testing "failed to prepare" $executable "" [list debug "additional_flags=-fPIE" "ldflags=-pie"]] } { +if { [prepare_for_testing "failed to prepare" $executable "" [list debug pie]] } { return -1 } diff --git a/gdb/testsuite/gdb.base/jit-attach-pie.exp b/gdb/testsuite/gdb.base/jit-attach-pie.exp index 51269eb9132..4171584942b 100644 --- a/gdb/testsuite/gdb.base/jit-attach-pie.exp +++ b/gdb/testsuite/gdb.base/jit-attach-pie.exp @@ -21,7 +21,7 @@ standard_testfile .c set executable ${testfile} if { [build_executable ${testfile}.exp $executable $srcfile \ - [list debug pthreads "additional_flags=-fPIE" "ldflags=-pie"]] } { + [list debug pthreads pie]] } { return -1 } diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp index 2018814df7e..7e13f6ae9be 100644 --- a/gdb/testsuite/gdb.base/jit-elf.exp +++ b/gdb/testsuite/gdb.base/jit-elf.exp @@ -158,8 +158,7 @@ if {[can_spawn_for_attach]} { } } -if { [compile_jit_main ${main_srcfile} "${main_binfile}-pie" \ - {additional_flags=-fPIE ldflags=-pie}] == 0 } { +if { [compile_jit_main ${main_srcfile} "${main_binfile}-pie" pie] == 0 } { with_test_prefix PIE { one_jit_test [lindex $jit_solibs_target 0] "${hex} jit_function_0001" 0 } diff --git a/gdb/testsuite/gdb.base/pie-execl.exp b/gdb/testsuite/gdb.base/pie-execl.exp index 71bc8beebe7..33b3aa06e50 100644 --- a/gdb/testsuite/gdb.base/pie-execl.exp +++ b/gdb/testsuite/gdb.base/pie-execl.exp @@ -41,7 +41,7 @@ set binfile2_test_msg OBJDIR/${subdir}/${executable2} # Use conditional compilation according to `BIN' as GDB remembers the source # file name of the breakpoint. -set opts [list debug additional_flags=-fPIE ldflags=-pie] +set opts [list debug pie] if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == -1 || [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == -1} { return -1 diff --git a/gdb/testsuite/gdb.base/pie-fork.exp b/gdb/testsuite/gdb.base/pie-fork.exp index 54932fe39ab..d093c195da0 100644 --- a/gdb/testsuite/gdb.base/pie-fork.exp +++ b/gdb/testsuite/gdb.base/pie-fork.exp @@ -18,7 +18,7 @@ standard_testfile -set opts [list debug additional_flags=-fPIE ldflags=-pie] +set opts [list debug pie] if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] { return diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp index c74caf43dfc..7ab30f2fde0 100644 --- a/gdb/testsuite/gdb.base/reread.exp +++ b/gdb/testsuite/gdb.base/reread.exp @@ -14,9 +14,7 @@ # along with this program. If not, see . # Build programs in PIE mode, to reproduce PR 21555. -foreach_with_prefix opts { - { "" "" } - { "-fPIE" "ldflags=-pie" } } { +foreach_with_prefix opts { "" "pie" } { # build the first test case @@ -25,9 +23,7 @@ foreach_with_prefix opts { # Cygwin needs $EXEEXT. set binfile1 [standard_output_file ${testfile1}$EXEEXT] - set testfile1_opt [list debug nowarnings \ - additional_flags=[lindex $opts 0] \ - [lindex $opts 1] ] + set testfile1_opt [list debug nowarnings $opts] if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" \ executable ${testfile1_opt}] != "" } { untested "failed to compile first testcase" @@ -40,12 +36,9 @@ foreach_with_prefix opts { set srcfile2 ${testfile2}.c set binfile2 [standard_output_file ${testfile2}$EXEEXT] - set testfile2_opt1 [list debug nowarnings \ - additional_flags=[lindex $opts 0] \ - [lindex $opts 1]] - set testfile2_op2 [list debug nowarnings \ - "additional_flags=-DNO_SECTIONS [lindex $opts 0]" \ - [lindex $opts 1]] + set testfile2_opt1 [list debug nowarnings $opts] + set testfile2_op2 [list debug nowarnings $opts \ + "additional_flags=-DNO_SECTIONS"] if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ executable ${testfile2_opt1}] != "" && [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ diff --git a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp index 714a07e97d7..f0ba05f73db 100644 --- a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp +++ b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp @@ -16,7 +16,7 @@ standard_testfile if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ - [list "additional_flags=-fPIE -pie"]] != "" } { + {pie}] != "" } { return -1 }