https://gcc.gnu.org/g:2e3d991ea1855d01b42a7661891c89c02cd6ba5e

commit r16-7956-g2e3d991ea1855d01b42a7661891c89c02cd6ba5e
Author: Dhruv Chawla <[email protected]>
Date:   Thu Feb 12 08:27:49 2026 +0000

    gcc-auto-profile: Force writing perf output to perf.data [PR124075]
    
    This is a partial fix for PR124075 which forces perf record to write the
    profile out to perf.data. This is required because I noticed on both
    aarch64 and x86 that it was writing out the profile to stdout at times,
    which would cause profile information to be dropped. This did not fail
    in the various create_fdas_for_* targets because they would only try and
    access the perf profiles if they existed at their paths.
    
    Further work for this patch is to plumb the PERF_DATA make variable into
    the perf record invocation, but that is a stage 1 thing.
    
    Autoprofilebootstrapped and regtested on aarch64-linux-gnu.
    
    Signed-off-by: Dhruv Chawla <[email protected]>
    
    gcc/ChangeLog:
            PR gcov-profile/124075
            * config/aarch64/gcc-auto-profile: Add "-o perf.data" to perf
            record invocation.
            * config/i386/gcc-auto-profile: Likewise.

Diff:
---
 gcc/config/aarch64/gcc-auto-profile | 4 ++--
 gcc/config/i386/gcc-auto-profile    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/config/aarch64/gcc-auto-profile 
b/gcc/config/aarch64/gcc-auto-profile
index fdf06dfeed03..b235e9660488 100755
--- a/gcc/config/aarch64/gcc-auto-profile
+++ b/gcc/config/aarch64/gcc-auto-profile
@@ -43,11 +43,11 @@ if [ "$use_brbe" = true ] ; then
     echo >&2 "Warning: branch profiling may not be functional in VMs"
   fi
   set -x
-  perf record --inherit -j any,$FLAGS "$@"
+  perf record --inherit -o perf.data -j any,$FLAGS "$@"
   set +x
 else
   echo >&2 "Warning: branch profiling may not be functional without BRBE"
   set -x
-  perf record --inherit "$@"
+  perf record --inherit -o perf.data "$@"
   set +x
 fi
diff --git a/gcc/config/i386/gcc-auto-profile b/gcc/config/i386/gcc-auto-profile
index 5cd4077826ba..c7772a2800f4 100755
--- a/gcc/config/i386/gcc-auto-profile
+++ b/gcc/config/i386/gcc-auto-profile
@@ -117,13 +117,13 @@ echo >&2 "AMD CPU without support for ex_ret_brn_tkn 
event"
         fi ;;
 esac
 set -x
-if ! perf record --inherit -e $E -b "$@" ; then
+if ! perf record --inherit -o perf.data -e $E -b "$@" ; then
   # PEBS may not actually be working even if the processor supports it
   # (e.g., in a virtual machine). Trying to run without /p.
   set +x
   echo >&2 "Retrying without /p."
   E="$(echo "${E}" | sed -e \'s/\/p/\//\ -e s/:p//)"
   set -x
-  exec perf record --inherit -e $E -b "$@"
+  exec perf record --inherit -o perf.data -e $E -b "$@"
  set +x
 fi

Reply via email to