aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKugan Vivekanandarajah <kvivekananda@nvidia.com>2025-05-26 11:41:59 +1000
committerKugan Vivekanandarajah <kvivekananda@nvidia.com>2025-05-26 13:36:09 +1000
commit86dc974cf30f926a014438a5fccdc9d41e26282b (patch)
treef200896f00cc10cdea5e0d84f2db40bba73629fe
parentf9e63ebcf60964fdc3b84c9b7fd7f19a9bf35b04 (diff)
downloadgcc-86dc974cf30f926a014438a5fccdc9d41e26282b.zip
gcc-86dc974cf30f926a014438a5fccdc9d41e26282b.tar.gz
gcc-86dc974cf30f926a014438a5fccdc9d41e26282b.tar.bz2
[AUTOFDO][AARCH64] Add support for profilebootstrap
Add support for autoprofiledbootstrap in aarch64. This is similar to what is done for i386. Added gcc/config/aarch64/gcc-auto-profile for aarch64 profile creation. How to run: configure --with-build-config=bootstrap-lto make autoprofiledbootstrap ChangeLog: * Makefile.def: AUTO_PROFILE based on cpu_type. * Makefile.in: Likewise. * configure: Regenerate. * configure.ac: Set autofdo_target. gcc/ChangeLog: * config/aarch64/gcc-auto-profile: New file. Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
-rw-r--r--Makefile.def2
-rw-r--r--Makefile.in69
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac3
-rw-r--r--gcc/config/aarch64/gcc-auto-profile53
5 files changed, 96 insertions, 35 deletions
diff --git a/Makefile.def b/Makefile.def
index 3f980bc..b038271 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -758,7 +758,7 @@ bootstrap_stage = {
bootstrap_target=profiledbootstrap ; };
bootstrap_stage = {
id=autoprofile ; prev=1 ;
- autoprofile="$$s/gcc/config/i386/$(AUTO_PROFILE)" ; };
+ autoprofile="$$s/gcc/config/@cpu_typet@/$(AUTO_PROFILE)" ; };
bootstrap_stage = {
id=autofeedback ; prev=autoprofile ;
bootstrap_target=autoprofiledbootstrap ;
diff --git a/Makefile.in b/Makefile.in
index b1ed67d..931507c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -38,6 +38,7 @@ build_alias=@build_noncanonical@
build_vendor=@build_vendor@
build_os=@build_os@
build=@build@
+cpu_type=@cpu_type@
host_alias=@host_noncanonical@
host_vendor=@host_vendor@
host_os=@host_os@
@@ -4271,7 +4272,7 @@ all-stageautoprofile-bfd: configure-stageautoprofile-bfd
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/bfd && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -5411,7 +5412,7 @@ all-stageautoprofile-opcodes: configure-stageautoprofile-opcodes
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/opcodes && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -6551,7 +6552,7 @@ all-stageautoprofile-binutils: configure-stageautoprofile-binutils
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/binutils && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -10037,7 +10038,7 @@ all-stageautoprofile-fixincludes: configure-stageautoprofile-fixincludes
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/fixincludes && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -11617,7 +11618,7 @@ all-stageautoprofile-gas: configure-stageautoprofile-gas
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/gas && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -12766,7 +12767,7 @@ all-stageautoprofile-gcc: configure-stageautoprofile-gcc
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/gcc && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -13915,7 +13916,7 @@ all-stageautoprofile-gmp: configure-stageautoprofile-gmp
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/gmp && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -15052,7 +15053,7 @@ all-stageautoprofile-mpfr: configure-stageautoprofile-mpfr
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/mpfr && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -16189,7 +16190,7 @@ all-stageautoprofile-mpc: configure-stageautoprofile-mpc
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/mpc && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -17326,7 +17327,7 @@ all-stageautoprofile-isl: configure-stageautoprofile-isl
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/isl && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -18454,7 +18455,7 @@ all-stageautoprofile-gold: configure-stageautoprofile-gold
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/gold && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -20539,7 +20540,7 @@ all-stageautoprofile-gettext: configure-stageautoprofile-gettext
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/gettext && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -22449,7 +22450,7 @@ all-stageautoprofile-ld: configure-stageautoprofile-ld
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/ld && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -23589,7 +23590,7 @@ all-stageautoprofile-libbacktrace: configure-stageautoprofile-libbacktrace
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libbacktrace && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -24729,7 +24730,7 @@ all-stageautoprofile-libcpp: configure-stageautoprofile-libcpp
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libcpp && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -25869,7 +25870,7 @@ all-stageautoprofile-libcody: configure-stageautoprofile-libcody
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libcody && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -26858,7 +26859,7 @@ all-stageautoprofile-libdecnumber: configure-stageautoprofile-libdecnumber
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libdecnumber && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -28460,7 +28461,7 @@ all-stageautoprofile-libiberty: configure-stageautoprofile-libiberty
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libiberty && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -29609,7 +29610,7 @@ all-stageautoprofile-libiberty-linker-plugin: configure-stageautoprofile-libiber
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libiberty-linker-plugin && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -30758,7 +30759,7 @@ all-stageautoprofile-libiconv: configure-stageautoprofile-libiconv
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libiconv && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -34130,7 +34131,7 @@ all-stageautoprofile-zlib: configure-stageautoprofile-zlib
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/zlib && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -40321,7 +40322,7 @@ all-stageautoprofile-lto-plugin: configure-stageautoprofile-lto-plugin
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/lto-plugin && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -42397,7 +42398,7 @@ all-stageautoprofile-libctf: configure-stageautoprofile-libctf
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libctf && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -43537,7 +43538,7 @@ all-stageautoprofile-libsframe: configure-stageautoprofile-libsframe
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libsframe && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -44677,7 +44678,7 @@ all-stageautoprofile-libgrust: configure-stageautoprofile-libgrust
$(HOST_EXPORTS) \
$(POSTSTAGE1_HOST_EXPORTS) \
cd $(HOST_SUBDIR)/libgrust && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(STAGEautoprofile_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \
@@ -45939,7 +45940,7 @@ all-stageautoprofile-target-libstdc++-v3: configure-stageautoprofile-target-libs
$(RAW_CXX_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libstdc++-v3 && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -47209,7 +47210,7 @@ all-stageautoprofile-target-libsanitizer: configure-stageautoprofile-target-libs
$(RAW_CXX_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libsanitizer && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -48479,7 +48480,7 @@ all-stageautoprofile-target-libvtv: configure-stageautoprofile-target-libvtv
$(RAW_CXX_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libvtv && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -50719,7 +50720,7 @@ all-stageautoprofile-target-libgcc: configure-stageautoprofile-target-libgcc
$(NORMAL_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libgcc && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -51951,7 +51952,7 @@ all-stageautoprofile-target-libbacktrace: configure-stageautoprofile-target-libb
$(NORMAL_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libbacktrace && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -55128,7 +55129,7 @@ all-stageautoprofile-target-libphobos: configure-stageautoprofile-target-libphob
$(NORMAL_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libphobos && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -58258,7 +58259,7 @@ all-stageautoprofile-target-zlib: configure-stageautoprofile-target-zlib
$(NORMAL_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/zlib && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -60983,7 +60984,7 @@ all-stageautoprofile-target-libgomp: configure-stageautoprofile-target-libgomp
$(NORMAL_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libgomp && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -62738,7 +62739,7 @@ all-stageautoprofile-target-libatomic: configure-stageautoprofile-target-libatom
$(NORMAL_TARGET_EXPORTS) \
\
cd $(TARGET_SUBDIR)/libatomic && \
- $$s/gcc/config/i386/$(AUTO_PROFILE) \
+ $$s/gcc/config/$(cpu_type)/$(AUTO_PROFILE) \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
diff --git a/configure b/configure
index 3f85b6c..ed1e5a4 100755
--- a/configure
+++ b/configure
@@ -730,6 +730,7 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+cpu_type
target_subdir
host_subdir
build_subdir
@@ -3395,6 +3396,9 @@ case "${target}" in
;;
esac
+cpu_type=`echo ${host} | sed 's/-.*$//'`
+
+
# Disable libssp for some systems.
case "${target}" in
avr-*-*)
diff --git a/configure.ac b/configure.ac
index d6c3fb5..33c130f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -621,6 +621,9 @@ case "${target}" in
;;
esac
+cpu_type=`echo ${host} | sed 's/-.*$//'`
+AC_SUBST(cpu_type)
+
# Disable libssp for some systems.
case "${target}" in
avr-*-*)
diff --git a/gcc/config/aarch64/gcc-auto-profile b/gcc/config/aarch64/gcc-auto-profile
new file mode 100644
index 0000000..4d5c2e3
--- /dev/null
+++ b/gcc/config/aarch64/gcc-auto-profile
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Profile workload for gcc profile feedback (autofdo) using Linux perf.
+# Copyright The GNU Toolchain Authors.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+
+# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>. */
+
+# Run perf record with branch stack sampling and check for
+# specific error message to see if it is supported.
+use_brbe=true
+output=$(perf record -j any,u /bin/true 2>&1)
+case "$output" in
+ *"PMU Hardware or event type doesn't support branch stack sampling."*)
+ use_brbe=false;;
+ *)
+ use_brbe=true;;
+esac
+
+FLAGS=u
+if [ "$1" = "--kernel" ] ; then
+ FLAGS=k
+ shift
+elif [ "$1" = "--all" ] ; then
+ FLAGS=u,k
+ shift
+fi
+
+if [ "$use_brbe" = true ] ; then
+ if grep -q hypervisor /proc/cpuinfo ; then
+ echo >&2 "Warning: branch profiling may not be functional in VMs"
+ fi
+ set -x
+ perf record -j any,$FLAGS "$@"
+ set +x
+else
+ echo >&2 "Warning: branch profiling may not be functional without BRBE"
+ set -x
+ perf record "$@"
+ set +x
+fi