From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1585) id 413753858407; Mon, 11 Jul 2022 15:29:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 413753858407 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Luis Machado To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Try a couple PAuth compilation flags for gdb.arch/aarch64-pauth.exp X-Act-Checkin: binutils-gdb X-Git-Author: Luis Machado X-Git-Refname: refs/heads/master X-Git-Oldrev: 4cbe4ca5da5cd7e1e6331ce11f024bf3c07b9744 X-Git-Newrev: f58d9432cdf8a279ed584efdb9791f44bb4dcd9e Message-Id: <20220711152957.413753858407@sourceware.org> Date: Mon, 11 Jul 2022 15:29:57 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2022 15:29:57 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df58d9432cdf8= a279ed584efdb9791f44bb4dcd9e commit f58d9432cdf8a279ed584efdb9791f44bb4dcd9e Author: Luis Machado Date: Thu Jun 30 15:23:56 2022 +0100 Try a couple PAuth compilation flags for gdb.arch/aarch64-pauth.exp =20 The -msign-return-address switch has been dropped from GCC, but some older compiler may still support it. Make sure we try both -msign-return-address and -mbranch-protection before bailing out when running gdb.arch/aarch64-pauth.exp. Diff: --- gdb/testsuite/gdb.arch/aarch64-pauth.exp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.exp b/gdb/testsuite/gdb.a= rch/aarch64-pauth.exp index 76ffd22a7cb..901eb8212c9 100644 --- a/gdb/testsuite/gdb.arch/aarch64-pauth.exp +++ b/gdb/testsuite/gdb.arch/aarch64-pauth.exp @@ -25,9 +25,24 @@ if {![is_aarch64_target]} { # Build program with address signing forced on. standard_testfile set compile_flags {debug} -lappend compile_flags "additional_flags=3D-msign-return-address=3Dall" lappend compile_flags "additional_flags=3D-fno-inline" -if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${com= pile_flags}] } { + +# Records whether the compilation was successful or not. +set compilation_ok 0 + +# We need to try a couple compilation flags here because -msign-return-add= ress +# was dropped at some point, but could still be supported. +foreach pauth_flag "-mbranch-protection=3Dpac-ret+leaf -msign-return-addre= ss=3Dall" { + set flags $compile_flags + lappend flags "additional_flags=3D$pauth_flag" + + if {!$compilation_ok && ![prepare_for_testing "failed to prepare" ${te= stfile} ${srcfile} ${flags}] } { + set compilation_ok 1 + } +} + +# If we couldn't compile, just bail out. +if {!$compilation_ok} { return -1 }