* [PATCH 0/2] Sync with binutils for building binutils with LTO:
@ 2021-11-13 16:33 H.J. Lu
2021-11-13 16:33 ` [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB H.J. Lu
2021-11-13 16:33 ` [PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb H.J. Lu
0 siblings, 2 replies; 13+ messages in thread
From: H.J. Lu @ 2021-11-13 16:33 UTC (permalink / raw)
To: gcc-patches
Add the --enable-pgo-build[=lto] configure option. When binutils+gdb
is not built together with GCC, --enable-pgo-build enables the PGO build:
1. First build with -fprofile-generate.
2. Use "make maybe-check-*" to generate profiling data and pass -i to make
to ignore errors when generating profiling data.
3. Use "make clean" to remove the previous build.
4. Rebuild with -fprofile-use.
H.J. Lu (2):
Sync with binutils: GCC: Pass --plugin to AR and RANLIB
Sync with binutils: Support the PGO build for binutils+gdb
Makefile.in | 68 ++++++++++++++++++--
Makefile.tpl | 63 +++++++++++++++++--
config/gcc-plugin.m4 | 28 +++++++++
configure | 139 ++++++++++++++++++++++++++++++++++++++++-
configure.ac | 80 ++++++++++++++++++++++++
libiberty/Makefile.in | 5 +-
libiberty/aclocal.m4 | 1 +
libiberty/configure | 37 +++++++++++
libiberty/configure.ac | 12 ++++
libtool.m4 | 25 +++++++-
zlib/configure | 29 ++++++++-
11 files changed, 471 insertions(+), 16 deletions(-)
--
2.33.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-11-13 16:33 [PATCH 0/2] Sync with binutils for building binutils with LTO: H.J. Lu
@ 2021-11-13 16:33 ` H.J. Lu
2021-11-23 0:29 ` Jeff Law
` (2 more replies)
2021-11-13 16:33 ` [PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb H.J. Lu
1 sibling, 3 replies; 13+ messages in thread
From: H.J. Lu @ 2021-11-13 16:33 UTC (permalink / raw)
To: gcc-patches
Sync with binutils for building binutils with LTO:
From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 9 Jan 2021 06:43:11 -0800
Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
build.
* Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
* configure.ac: Include config/gcc-plugin.m4.
AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
RANLIB if possible.
* Makefile.in: Regenerated.
* configure: Likewise.
config/
* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
libiberty/
* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
(configure_deps): Depend on ../config/gcc-plugin.m4.
* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
RANLIB_PLUGIN_OPTION.
* aclocal.m4: Regenerated.
* configure: Likewise.
zlib/
* configure: Regenerated.
---
Makefile.in | 5 +++--
Makefile.tpl | 5 +++--
config/gcc-plugin.m4 | 28 ++++++++++++++++++++++++++++
configure | 39 +++++++++++++++++++++++++++++++++++++++
configure.ac | 15 +++++++++++++++
libiberty/Makefile.in | 5 +++--
libiberty/aclocal.m4 | 1 +
libiberty/configure | 37 +++++++++++++++++++++++++++++++++++++
libiberty/configure.ac | 12 ++++++++++++
libtool.m4 | 25 ++++++++++++++++++++++++-
zlib/configure | 29 ++++++++++++++++++++++++++---
11 files changed, 191 insertions(+), 10 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 860cf8f067b..13067e97327 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -415,7 +415,7 @@ MAKEINFOFLAGS = --split-size=5000000
# ---------------------------------------------
AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CXX = @CXX@
@@ -426,7 +426,7 @@ LIPO = @LIPO@
NM = @NM@
OBJDUMP = @OBJDUMP@
OTOOL = @OTOOL@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
READELF = @READELF@
STRIP = @STRIP@
WINDRES = @WINDRES@
@@ -63384,6 +63384,7 @@ AUTOCONF = autoconf
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
+ $(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
diff --git a/Makefile.tpl b/Makefile.tpl
index 213052f8226..f785b84ec9c 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -418,7 +418,7 @@ MAKEINFOFLAGS = --split-size=5000000
# ---------------------------------------------
AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CXX = @CXX@
@@ -429,7 +429,7 @@ LIPO = @LIPO@
NM = @NM@
OBJDUMP = @OBJDUMP@
OTOOL = @OTOOL@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
READELF = @READELF@
STRIP = @STRIP@
WINDRES = @WINDRES@
@@ -2027,6 +2027,7 @@ AUTOCONF = autoconf
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
+ $(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index 8f278719118..c5b72e9a13d 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -124,3 +124,31 @@ AC_DEFUN([GCC_ENABLE_PLUGINS],
fi
fi
])
+
+dnl
+dnl
+dnl GCC_PLUGIN_OPTION
+dnl (SHELL-CODE_HANDLER)
+dnl
+AC_DEFUN([GCC_PLUGIN_OPTION],[dnl
+AC_MSG_CHECKING([for -plugin option])
+
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+plugin_option=
+for plugin in $plugin_names; do
+ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
+ if test x$plugin_so = x$plugin; then
+ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
+ fi
+ if test x$plugin_so != x$plugin; then
+ plugin_option="--plugin $plugin_so"
+ break
+ fi
+done
+if test -n "$plugin_option"; then
+ $1="$plugin_option"
+ AC_MSG_RESULT($plugin_option)
+else
+ AC_MSG_RESULT([no])
+fi
+])
diff --git a/configure b/configure
index 58979d6e3b1..ea3111a8020 100755
--- a/configure
+++ b/configure
@@ -619,6 +619,8 @@ GFORTRAN_FOR_TARGET
GCC_FOR_TARGET
CXX_FOR_TARGET
CC_FOR_TARGET
+RANLIB_PLUGIN_OPTION
+AR_PLUGIN_OPTION
READELF
OTOOL
OBJDUMP
@@ -12600,6 +12602,43 @@ fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
+$as_echo_n "checking for -plugin option... " >&6; }
+
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+plugin_option=
+for plugin in $plugin_names; do
+ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
+ if test x$plugin_so = x$plugin; then
+ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
+ fi
+ if test x$plugin_so != x$plugin; then
+ plugin_option="--plugin $plugin_so"
+ break
+ fi
+done
+if test -n "$plugin_option"; then
+ PLUGIN_OPTION="$plugin_option"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_option" >&5
+$as_echo "$plugin_option" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+AR_PLUGIN_OPTION=
+RANLIB_PLUGIN_OPTION=
+if test -n "$PLUGIN_OPTION"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR_PLUGIN_OPTION="$PLUGIN_OPTION"
+ fi
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
+ fi
+fi
+
+
+
# Target tools.
# Check whether --with-build-time-tools was given.
diff --git a/configure.ac b/configure.ac
index 550e6993b59..1ca83d30a55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,7 @@ m4_include(config/override.m4)
m4_include(config/proginstall.m4)
m4_include(config/elf.m4)
m4_include(config/ax_cxx_compile_stdcxx.m4)
+m4_include(config/gcc-plugin.m4)
m4_include([libtool.m4])
m4_include([ltoptions.m4])
m4_include([ltsugar.m4])
@@ -3493,6 +3494,20 @@ AC_SUBST(CXX)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
+GCC_PLUGIN_OPTION(PLUGIN_OPTION)
+AR_PLUGIN_OPTION=
+RANLIB_PLUGIN_OPTION=
+if test -n "$PLUGIN_OPTION"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR_PLUGIN_OPTION="$PLUGIN_OPTION"
+ fi
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
+ fi
+fi
+AC_SUBST(AR_PLUGIN_OPTION)
+AC_SUBST(RANLIB_PLUGIN_OPTION)
+
# Target tools.
AC_ARG_WITH([build-time-tools],
[AS_HELP_STRING([--with-build-time-tools=PATH],
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 884cc6c4af2..6916b735df3 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -50,13 +50,13 @@ mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
# Some compilers can't handle cc -c blah.c -o foo/blah.o.
OUTPUT_OPTION = @OUTPUT_OPTION@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
MAKEINFO = @MAKEINFO@
PERL = @PERL@
@@ -505,6 +505,7 @@ aclocal_deps = \
$(srcdir)/../config/acx.m4 \
$(srcdir)/../config/cet.m4 \
$(srcdir)/../config/enable.m4 \
+ $(srcdir)/../config/gcc-plugin.m4 \
$(srcdir)/../config/no-executables.m4 \
$(srcdir)/../config/override.m4 \
$(srcdir)/../config/picflag.m4 \
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index 3378316dced..0757688d52a 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -15,6 +15,7 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun
m4_include([../config/acx.m4])
m4_include([../config/cet.m4])
m4_include([../config/enable.m4])
+m4_include([../config/gcc-plugin.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/picflag.m4])
m4_include([../config/warnings.m4])
diff --git a/libiberty/configure b/libiberty/configure
index 3c7e588b16b..4d793dbebeb 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -645,6 +645,8 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+RANLIB_PLUGIN_OPTION
+AR_PLUGIN_OPTION
RANLIB
AR
host_os
@@ -2929,6 +2931,41 @@ else
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
+$as_echo_n "checking for -plugin option... " >&6; }
+
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+plugin_option=
+for plugin in $plugin_names; do
+ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
+ if test x$plugin_so = x$plugin; then
+ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
+ fi
+ if test x$plugin_so != x$plugin; then
+ plugin_option="--plugin $plugin_so"
+ break
+ fi
+done
+if test -n "$plugin_option"; then
+ PLUGIN_OPTION="$plugin_option"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_option" >&5
+$as_echo "$plugin_option" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+if test -n "$PLUGIN_OPTION"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR_PLUGIN_OPTION="$PLUGIN_OPTION"
+
+ fi
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
+
+ fi
+fi
+
# Add --enable-multilib to configure.
# Default to --enable-multilib
# Check whether --enable-multilib was given.
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index 4b78c1830c7..3d26857cb9f 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -108,6 +108,18 @@ dnl to call AC_CHECK_PROG.
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
+GCC_PLUGIN_OPTION(PLUGIN_OPTION)
+if test -n "$PLUGIN_OPTION"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR_PLUGIN_OPTION="$PLUGIN_OPTION"
+ AC_SUBST(AR_PLUGIN_OPTION)
+ fi
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
+ AC_SUBST(RANLIB_PLUGIN_OPTION)
+ fi
+fi
+
dnl When switching to automake, replace the following with AM_ENABLE_MULTILIB.
# Add --enable-multilib to configure.
# Default to --enable-multilib
diff --git a/libtool.m4 b/libtool.m4
index 17f8e5f3074..efa62bfcbf0 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1325,8 +1325,26 @@ need_locks="$enable_libtool_lock"
# _LT_CMD_OLD_ARCHIVE
# -------------------
m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
+[plugin_option=
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+for plugin in $plugin_names; do
+ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
+ if test x$plugin_so = x$plugin; then
+ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
+ fi
+ if test x$plugin_so != x$plugin; then
+ plugin_option="--plugin $plugin_so"
+ break
+ fi
+done
+
+AC_CHECK_TOOL(AR, ar, false)
test -z "$AR" && AR=ar
+if test -n "$plugin_option"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR="$AR $plugin_option"
+ fi
+fi
test -z "$AR_FLAGS" && AR_FLAGS=cru
_LT_DECL([], [AR], [1], [The archiver])
_LT_DECL([], [AR_FLAGS], [1])
@@ -1337,6 +1355,11 @@ _LT_DECL([], [STRIP], [1], [A symbol stripping program])
AC_CHECK_TOOL(RANLIB, ranlib, :)
test -z "$RANLIB" && RANLIB=:
+if test -n "$plugin_option" && test "$RANLIB" != ":"; then
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB="$RANLIB $plugin_option"
+ fi
+fi
_LT_DECL([], [RANLIB], [1],
[Commands used to install an old-style archive])
diff --git a/zlib/configure b/zlib/configure
index f489f31bc70..8ce61b11119 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -4169,7 +4169,7 @@ case "$host" in
case "$enable_cet" in
auto)
# Check if target supports multi-byte NOPs
- # and if assembler supports CET insn.
+ # and if compiler and assembler support CET insn.
cet_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fcf-protection"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5502,6 +5502,19 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
+plugin_option=
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+for plugin in $plugin_names; do
+ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
+ if test x$plugin_so = x$plugin; then
+ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
+ fi
+ if test x$plugin_so != x$plugin; then
+ plugin_option="--plugin $plugin_so"
+ break
+ fi
+done
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
@@ -5595,6 +5608,11 @@ else
fi
test -z "$AR" && AR=ar
+if test -n "$plugin_option"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR="$AR $plugin_option"
+ fi
+fi
test -z "$AR_FLAGS" && AR_FLAGS=cru
@@ -5799,6 +5817,11 @@ else
fi
test -z "$RANLIB" && RANLIB=:
+if test -n "$plugin_option" && test "$RANLIB" != ":"; then
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB="$RANLIB $plugin_option"
+ fi
+fi
@@ -10735,7 +10758,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10748 "configure"
+#line 10761 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10841,7 +10864,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10854 "configure"
+#line 10867 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
--
2.33.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb
2021-11-13 16:33 [PATCH 0/2] Sync with binutils for building binutils with LTO: H.J. Lu
2021-11-13 16:33 ` [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB H.J. Lu
@ 2021-11-13 16:33 ` H.J. Lu
2021-12-15 20:25 ` Jeff Law
1 sibling, 1 reply; 13+ messages in thread
From: H.J. Lu @ 2021-11-13 16:33 UTC (permalink / raw)
To: gcc-patches
Sync with binutils for building binutils with LTO:
From af019bfde9b13d628202fe58054ec7ff08d92a0f Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 9 Jan 2021 06:51:15 -0800
Subject: [PATCH] Support the PGO build for binutils+gdb
Add the --enable-pgo-build[=lto] configure option. When binutils+gdb
is not built together with GCC, --enable-pgo-build enables the PGO build:
1. First build with -fprofile-generate.
2. Use "make maybe-check-*" to generate profiling data and pass -i to make
to ignore errors when generating profiling data.
3. Use "make clean" to remove the previous build.
4. Rebuild with -fprofile-use.
With --enable-pgo-build=lto, -flto=jobserver -ffat-lto-objects are used
together with -fprofile-generate and -fprofile-use. Add '+' to the command
line for recursive make to support -flto=jobserver -ffat-lto-objects.
NB: --enable-pgo-build=lto enables the PGO build with LTO while
--enable-lto enables LTO support in toolchain.
PR binutils/26766
* Makefile.tpl (BUILD_CFLAGS): New.
(CFLAGS): Append $(BUILD_CFLAGS).
(CXXFLAGS): Likewise.
(PGO_BUILD_GEN_FLAGS_TO_PASS): New.
(PGO_BUILD_TRAINING_CFLAGS): Likewise.
(PGO_BUILD_TRAINING_CXXFLAGS): Likewise.
(PGO_BUILD_TRAINING_FLAGS_TO_PASS): Likewise.
(PGO_BUILD_TRAINING_MFLAGS): Likewise.
(PGO_BUILD_USE_FLAGS_TO_PASS): Likewise.
(PGO-TRAINING-TARGETS): Likewise.
(PGO_BUILD_TRAINING): Likewise.
(all): Add '+' to the command line for recursive make. Support
the PGO build.
* configure.ac: Add --enable-pgo-build[=lto].
AC_SUBST PGO_BUILD_GEN_CFLAGS, PGO_BUILD_USE_CFLAGS and
PGO_BUILD_LTO_CFLAGS. Enable the PGO build in Makefile.
* Makefile.in: Regenerated.
* configure: Likewise.
---
Makefile.in | 63 ++++++++++++++++++++++++++++++--
Makefile.tpl | 58 ++++++++++++++++++++++++++++--
configure | 100 +++++++++++++++++++++++++++++++++++++++++++++++++--
configure.ac | 65 +++++++++++++++++++++++++++++++++
4 files changed, 280 insertions(+), 6 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 13067e97327..2b77a470694 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -444,6 +444,49 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
GDCFLAGS = $(CFLAGS)
+# Pass additional PGO and LTO compiler options to the PGO build.
+BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
+override CFLAGS += $(BUILD_CFLAGS)
+override CXXFLAGS += $(BUILD_CFLAGS)
+
+# Additional PGO and LTO compiler options to generate profiling data
+# for the PGO build.
+PGO_BUILD_GEN_FLAGS_TO_PASS = \
+ PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \
+ PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
+
+# NB: Filter out any compiler options which may fail PGO training runs.
+PGO_BUILD_TRAINING_CFLAGS:= \
+ $(filter-out -Werror=%,$(CFLAGS))
+PGO_BUILD_TRAINING_CXXFLAGS:=\
+ $(filter-out -Werror=%,$(CXXFLAGS))
+PGO_BUILD_TRAINING_CFLAGS:= \
+ $(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS))
+PGO_BUILD_TRAINING_CXXFLAGS:= \
+ $(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS))
+PGO_BUILD_TRAINING_CFLAGS:= \
+ $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS))
+PGO_BUILD_TRAINING_CXXFLAGS:= \
+ $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS))
+PGO_BUILD_TRAINING_FLAGS_TO_PASS = \
+ PGO_BUILD_TRAINING=yes \
+ CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \
+ CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)"
+
+# Ignore "make check" errors in PGO training runs.
+PGO_BUILD_TRAINING_MFLAGS = -i
+
+# Additional PGO and LTO compiler options to use profiling data for the
+# PGO build.
+PGO_BUILD_USE_FLAGS_TO_PASS = \
+ PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \
+ PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
+
+# PGO training targets for the PGO build. FIXME: Add gold tests to
+# training.
+PGO-TRAINING-TARGETS = binutils gas gdb ld sim
+PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS))
+
CREATE_GCOV = create_gcov
TFLAGS =
@@ -1091,6 +1134,12 @@ configure-target: \
# The target built for a native non-bootstrap build.
.PHONY: all
+
+# --enable-pgo-build enables the PGO build.
+# 1. First build with -fprofile-generate.
+# 2. Use "make maybe-check-*" to generate profiling data.
+# 3. Use "make clean" to remove the previous build.
+# 4. Rebuild with -fprofile-use.
all:
@if gcc-bootstrap
[ -f stage_final ] || echo stage3 > stage_final
@@ -1099,7 +1148,7 @@ all:
$(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
@endif gcc-bootstrap
@: $(MAKE); $(unstage)
- @r=`${PWD_COMMAND}`; export r; \
+ +@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@if gcc-bootstrap
if [ -f stage_last ]; then \
@@ -1107,7 +1156,17 @@ all:
$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
else \
@endif gcc-bootstrap
- $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
+ $(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \
+@if pgo-build
+ && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
+ $(PGO_BUILD_TRAINING_MFLAGS) \
+ $(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \
+ $(PGO_BUILD_TRAINING) \
+ && $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \
+ && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
+ $(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \
+@endif pgo-build
@if gcc-bootstrap
; \
fi \
diff --git a/Makefile.tpl b/Makefile.tpl
index f785b84ec9c..c8732178344 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -447,6 +447,45 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
GDCFLAGS = $(CFLAGS)
+# Pass additional PGO and LTO compiler options to the PGO build.
+BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
+override CFLAGS += $(BUILD_CFLAGS)
+override CXXFLAGS += $(BUILD_CFLAGS)
+
+# Additional PGO and LTO compiler options to generate profiling data
+# for the PGO build.
+PGO_BUILD_GEN_FLAGS_TO_PASS = \
+ PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \
+ PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
+
+# NB: Filter out any compiler options which may fail PGO training runs.
+PGO_BUILD_TRAINING_CFLAGS:= \
+ $(filter-out -Werror=%,$(CFLAGS))
+PGO_BUILD_TRAINING_CXXFLAGS:=\
+ $(filter-out -Werror=%,$(CXXFLAGS))
+PGO_BUILD_TRAINING_CFLAGS:= \
+ $(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS))
+PGO_BUILD_TRAINING_CXXFLAGS:= \
+ $(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS))
+PGO_BUILD_TRAINING_CFLAGS:= \
+ $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS))
+PGO_BUILD_TRAINING_CXXFLAGS:= \
+ $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS))
+PGO_BUILD_TRAINING_FLAGS_TO_PASS = \
+ CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \
+ CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)"
+
+# Additional PGO and LTO compiler options to use profiling data for the
+# PGO build.
+PGO_BUILD_USE_FLAGS_TO_PASS = \
+ PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \
+ PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
+
+# PGO training targets for the PGO build. FIXME: Add gold tests to
+# training.
+PGO-TRAINING-TARGETS = binutils gas gdb ld sim
+PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS))
+
CREATE_GCOV = create_gcov
TFLAGS =
@@ -776,6 +815,12 @@ configure-target: [+
# The target built for a native non-bootstrap build.
.PHONY: all
+
+# --enable-pgo-build enables the PGO build.
+# 1. First build with -fprofile-generate.
+# 2. Use "make maybe-check-*" to generate profiling data.
+# 3. Use "make clean" to remove the previous build.
+# 4. Rebuild with -fprofile-use.
all:
@if gcc-bootstrap
[ -f stage_final ] || echo stage3 > stage_final
@@ -784,7 +829,7 @@ all:
$(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
@endif gcc-bootstrap
@: $(MAKE); $(unstage)
- @r=`${PWD_COMMAND}`; export r; \
+ +@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@if gcc-bootstrap
if [ -f stage_last ]; then \
@@ -792,7 +837,16 @@ all:
$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
else \
@endif gcc-bootstrap
- $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
+ $(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \
+@if pgo-build
+ && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
+ $(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \
+ $(PGO_BUILD_TRAINING) \
+ && $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \
+ && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
+ $(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \
+@endif pgo-build
@if gcc-bootstrap
; \
fi \
diff --git a/configure b/configure
index ea3111a8020..bf0db18ec35 100755
--- a/configure
+++ b/configure
@@ -701,6 +701,9 @@ extra_mpc_gmp_configure_flags
extra_mpfr_configure_flags
gmpinc
gmplibs
+PGO_BUILD_LTO_CFLAGS
+PGO_BUILD_USE_CFLAGS
+PGO_BUILD_GEN_CFLAGS
HAVE_CXX11_FOR_BUILD
HAVE_CXX11
do_compare
@@ -804,6 +807,7 @@ enable_libssp
enable_libstdcxx
enable_liboffloadmic
enable_bootstrap
+enable_pgo_build
with_mpc
with_mpc_include
with_mpc_lib
@@ -1544,6 +1548,8 @@ Optional Features:
--enable-liboffloadmic=ARG
build liboffloadmic [ARG={no,host,target}]
--enable-bootstrap enable bootstrapping [yes if native build]
+ --enable-pgo-build[=lto]
+ enable the PGO build
--disable-isl-version-check
disable check for isl version
--enable-lto enable link time optimization support
@@ -7710,6 +7716,91 @@ $as_echo "#define HAVE_CXX11_FOR_BUILD 1" >>confdefs.h
fi
fi
+# Check whether --enable-pgo-build was given.
+if test "${enable_pgo_build+set}" = set; then :
+ enableval=$enable_pgo_build; enable_pgo_build=$enableval
+else
+ enable_pgo_build=no
+fi
+
+
+# Issue errors and warnings for invalid/strange PGO build combinations.
+case "$have_compiler:$host:$target:$enable_pgo_build" in
+ *:*:*:no) ;;
+
+ # Allow the PGO build only if we aren't building a compiler and
+ # we are in a native configuration.
+ no:$build:$build:yes | no:$build:$build:lto) ;;
+
+ # Disallow the PGO bootstrap if we are building a compiler.
+ yes:*:*:yes | yes:*:*:lto)
+ as_fn_error $? "cannot perform the PGO bootstrap when building a compiler" "$LINENO" 5 ;;
+
+ *)
+ as_fn_error $? "invalid option for --enable-pgo-build" "$LINENO" 5
+ ;;
+esac
+
+if test "$enable_pgo_build" != "no"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fprofile-generate" >&5
+$as_echo_n "checking whether the compiler supports -fprofile-generate... " >&6; }
+ old_CFLAGS="$CFLAGS"
+ PGO_BUILD_GEN_CFLAGS="-fprofile-generate"
+ CFLAGS="$CFLAGS $PGO_BUILD_CFLAGS"
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ PGO_BUILD_GEN_CFLAGS=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$old_CFLAGS"
+ if test -n "$PGO_BUILD_GEN_CFLAGS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ PGO_BUILD_USE_CFLAGS="-fprofile-use"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "cannot perform the PGO build without -fprofile-generate" "$LINENO" 5
+ fi
+
+ if test "$enable_pgo_build" = "lto"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -flto=jobserver -ffat-lto-objects" >&5
+$as_echo_n "checking whether the compiler supports -flto=jobserver -ffat-lto-objects... " >&6; }
+ old_CFLAGS="$CFLAGS"
+ PGO_BUILD_LTO_CFLAGS="-flto=jobserver -ffat-lto-objects"
+ CFLAGS="$CFLAGS $PGO_BUILD_LTO_CFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ PGO_BUILD_LTO_CFLAGS=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$old_CFLAGS"
+ if test -n "$PGO_BUILD_LTO_CFLAGS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: LTO is disabled for the PGO build" >&5
+$as_echo "$as_me: WARNING: LTO is disabled for the PGO build" >&2;}
+ fi
+ fi
+fi
+
+
+
+
# Used for setting $lt_cv_objdir
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
$as_echo_n "checking for objdir... " >&6; }
@@ -7899,8 +7990,7 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
# Check for the recommended and required versions of GMP.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of gmp.h" >&5
$as_echo_n "checking for the correct version of gmp.h... " >&6; }
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "gmp.h"
int
@@ -9639,6 +9729,12 @@ extrasub_target="$extrasub_target
/^@unless /d
/^@endunless /d"
+if test "$enable_pgo_build" != "no"; then
+ extrasub_build="$extrasub_build
+/^@if pgo-build\$/d
+/^@endif pgo-build\$/d"
+fi
+
# Create the serialization dependencies. This uses a temporary file.
# Check whether --enable-serial-configure was given.
diff --git a/configure.ac b/configure.ac
index 1ca83d30a55..a2815f2218b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1465,6 +1465,65 @@ elif test "$have_compiler" = yes; then
fi
fi
+AC_ARG_ENABLE([pgo-build],
+[AS_HELP_STRING([--enable-pgo-build[[=lto]]],
+ [enable the PGO build])],
+[enable_pgo_build=$enableval],
+[enable_pgo_build=no])
+
+# Issue errors and warnings for invalid/strange PGO build combinations.
+case "$have_compiler:$host:$target:$enable_pgo_build" in
+ *:*:*:no) ;;
+
+ # Allow the PGO build only if we aren't building a compiler and
+ # we are in a native configuration.
+ no:$build:$build:yes | no:$build:$build:lto) ;;
+
+ # Disallow the PGO bootstrap if we are building a compiler.
+ yes:*:*:yes | yes:*:*:lto)
+ AC_MSG_ERROR([cannot perform the PGO bootstrap when building a compiler]) ;;
+
+ *)
+ AC_MSG_ERROR([invalid option for --enable-pgo-build])
+ ;;
+esac
+
+if test "$enable_pgo_build" != "no"; then
+ AC_MSG_CHECKING([whether the compiler supports -fprofile-generate])
+ old_CFLAGS="$CFLAGS"
+ PGO_BUILD_GEN_CFLAGS="-fprofile-generate"
+ CFLAGS="$CFLAGS $PGO_BUILD_CFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
+ [PGO_BUILD_GEN_CFLAGS=])
+ CFLAGS="$old_CFLAGS"
+ if test -n "$PGO_BUILD_GEN_CFLAGS"; then
+ AC_MSG_RESULT([yes])
+ PGO_BUILD_USE_CFLAGS="-fprofile-use"
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot perform the PGO build without -fprofile-generate])
+ fi
+
+ if test "$enable_pgo_build" = "lto"; then
+ AC_MSG_CHECKING([whether the compiler supports -flto=jobserver -ffat-lto-objects])
+ old_CFLAGS="$CFLAGS"
+ PGO_BUILD_LTO_CFLAGS="-flto=jobserver -ffat-lto-objects"
+ CFLAGS="$CFLAGS $PGO_BUILD_LTO_CFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
+ [PGO_BUILD_LTO_CFLAGS=])
+ CFLAGS="$old_CFLAGS"
+ if test -n "$PGO_BUILD_LTO_CFLAGS"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([LTO is disabled for the PGO build])
+ fi
+ fi
+fi
+AC_SUBST(PGO_BUILD_GEN_CFLAGS)
+AC_SUBST(PGO_BUILD_USE_CFLAGS)
+AC_SUBST(PGO_BUILD_LTO_CFLAGS)
+
# Used for setting $lt_cv_objdir
_LT_CHECK_OBJDIR
@@ -2957,6 +3016,12 @@ extrasub_target="$extrasub_target
/^@unless /d
/^@endunless /d"
+if test "$enable_pgo_build" != "no"; then
+ extrasub_build="$extrasub_build
+/^@if pgo-build\$/d
+/^@endif pgo-build\$/d"
+fi
+
# Create the serialization dependencies. This uses a temporary file.
AC_ARG_ENABLE([serial-configure],
--
2.33.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-11-13 16:33 ` [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB H.J. Lu
@ 2021-11-23 0:29 ` Jeff Law
2021-11-23 2:29 ` H.J. Lu
2021-12-15 17:33 ` Jeff Law
2021-12-16 3:37 ` Sandra Loosemore
2 siblings, 1 reply; 13+ messages in thread
From: Jeff Law @ 2021-11-23 0:29 UTC (permalink / raw)
To: H.J. Lu, gcc-patches
On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
> Sync with binutils for building binutils with LTO:
>
> From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Sat, 9 Jan 2021 06:43:11 -0800
> Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
>
> Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> build.
>
> * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> * configure.ac: Include config/gcc-plugin.m4.
> AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> RANLIB if possible.
> * Makefile.in: Regenerated.
> * configure: Likewise.
>
> config/
>
> * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
>
> libiberty/
>
> * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> (configure_deps): Depend on ../config/gcc-plugin.m4.
> * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> RANLIB_PLUGIN_OPTION.
> * aclocal.m4: Regenerated.
> * configure: Likewise.
>
> zlib/
>
> * configure: Regenerated.
I thought the plugins were automatically loaded if they're in the right
place in the filesystem. Wouldn't that make this patch unnecessary? Am
I missing something?
jeff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-11-23 0:29 ` Jeff Law
@ 2021-11-23 2:29 ` H.J. Lu
2021-12-14 23:30 ` Jeff Law
0 siblings, 1 reply; 13+ messages in thread
From: H.J. Lu @ 2021-11-23 2:29 UTC (permalink / raw)
To: Jeff Law; +Cc: GCC Patches
On Mon, Nov 22, 2021 at 4:29 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
> > Sync with binutils for building binutils with LTO:
> >
> > From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> > From: "H.J. Lu" <hjl.tools@gmail.com>
> > Date: Sat, 9 Jan 2021 06:43:11 -0800
> > Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
> >
> > Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> > build.
> >
> > * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> > (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> > * configure.ac: Include config/gcc-plugin.m4.
> > AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> > * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> > RANLIB if possible.
> > * Makefile.in: Regenerated.
> > * configure: Likewise.
> >
> > config/
> >
> > * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
> >
> > libiberty/
> >
> > * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> > (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> > (configure_deps): Depend on ../config/gcc-plugin.m4.
> > * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> > RANLIB_PLUGIN_OPTION.
> > * aclocal.m4: Regenerated.
> > * configure: Likewise.
> >
> > zlib/
> >
> > * configure: Regenerated.
> I thought the plugins were automatically loaded if they're in the right
> place in the filesystem. Wouldn't that make this patch unnecessary? Am
> I missing something?
>
It only works for system GCC and binutils. It doesn't work for non-system
GCC nor binutils since either GCC plugin isn't installed in the binutils plugin
search patch.
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-11-23 2:29 ` H.J. Lu
@ 2021-12-14 23:30 ` Jeff Law
2021-12-15 0:29 ` H.J. Lu
0 siblings, 1 reply; 13+ messages in thread
From: Jeff Law @ 2021-12-14 23:30 UTC (permalink / raw)
To: H.J. Lu; +Cc: GCC Patches
On 11/22/2021 7:29 PM, H.J. Lu wrote:
> On Mon, Nov 22, 2021 at 4:29 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>>
>>
>> On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
>>> Sync with binutils for building binutils with LTO:
>>>
>>> From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
>>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>> Date: Sat, 9 Jan 2021 06:43:11 -0800
>>> Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
>>>
>>> Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
>>> build.
>>>
>>> * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
>>> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
>>> * configure.ac: Include config/gcc-plugin.m4.
>>> AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
>>> * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
>>> RANLIB if possible.
>>> * Makefile.in: Regenerated.
>>> * configure: Likewise.
>>>
>>> config/
>>>
>>> * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
>>>
>>> libiberty/
>>>
>>> * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
>>> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
>>> (configure_deps): Depend on ../config/gcc-plugin.m4.
>>> * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
>>> RANLIB_PLUGIN_OPTION.
>>> * aclocal.m4: Regenerated.
>>> * configure: Likewise.
>>>
>>> zlib/
>>>
>>> * configure: Regenerated.
>> I thought the plugins were automatically loaded if they're in the right
>> place in the filesystem. Wouldn't that make this patch unnecessary? Am
>> I missing something?
>>
> It only works for system GCC and binutils. It doesn't work for non-system
> GCC nor binutils since either GCC plugin isn't installed in the binutils plugin
> search patch.
Ah. So this is primarily useful if GCC was installed into a path
different than the system binutils expects to find the plugin? Does it
work properly in cross environments or at least do no harm in those
kinds of builds?
Jeff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-12-14 23:30 ` Jeff Law
@ 2021-12-15 0:29 ` H.J. Lu
0 siblings, 0 replies; 13+ messages in thread
From: H.J. Lu @ 2021-12-15 0:29 UTC (permalink / raw)
To: Jeff Law; +Cc: GCC Patches
On Tue, Dec 14, 2021 at 3:30 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 11/22/2021 7:29 PM, H.J. Lu wrote:
> > On Mon, Nov 22, 2021 at 4:29 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> >>
> >>
> >> On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
> >>> Sync with binutils for building binutils with LTO:
> >>>
> >>> From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> >>> From: "H.J. Lu" <hjl.tools@gmail.com>
> >>> Date: Sat, 9 Jan 2021 06:43:11 -0800
> >>> Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
> >>>
> >>> Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> >>> build.
> >>>
> >>> * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> >>> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> >>> * configure.ac: Include config/gcc-plugin.m4.
> >>> AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> >>> * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> >>> RANLIB if possible.
> >>> * Makefile.in: Regenerated.
> >>> * configure: Likewise.
> >>>
> >>> config/
> >>>
> >>> * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
> >>>
> >>> libiberty/
> >>>
> >>> * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> >>> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> >>> (configure_deps): Depend on ../config/gcc-plugin.m4.
> >>> * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> >>> RANLIB_PLUGIN_OPTION.
> >>> * aclocal.m4: Regenerated.
> >>> * configure: Likewise.
> >>>
> >>> zlib/
> >>>
> >>> * configure: Regenerated.
> >> I thought the plugins were automatically loaded if they're in the right
> >> place in the filesystem. Wouldn't that make this patch unnecessary? Am
> >> I missing something?
> >>
> > It only works for system GCC and binutils. It doesn't work for non-system
> > GCC nor binutils since either GCC plugin isn't installed in the binutils plugin
> > search patch.
> Ah. So this is primarily useful if GCC was installed into a path
> different than the system binutils expects to find the plugin? Does it
Yes.
> work properly in cross environments or at least do no harm in those
> kinds of builds?
>
I believe so.
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-11-13 16:33 ` [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB H.J. Lu
2021-11-23 0:29 ` Jeff Law
@ 2021-12-15 17:33 ` Jeff Law
2021-12-16 3:37 ` Sandra Loosemore
2 siblings, 0 replies; 13+ messages in thread
From: Jeff Law @ 2021-12-15 17:33 UTC (permalink / raw)
To: H.J. Lu, gcc-patches
On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
> Sync with binutils for building binutils with LTO:
>
> From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Sat, 9 Jan 2021 06:43:11 -0800
> Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
>
> Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> build.
>
> * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> * configure.ac: Include config/gcc-plugin.m4.
> AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> RANLIB if possible.
> * Makefile.in: Regenerated.
> * configure: Likewise.
>
> config/
>
> * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
>
> libiberty/
>
> * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> (configure_deps): Depend on ../config/gcc-plugin.m4.
> * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> RANLIB_PLUGIN_OPTION.
> * aclocal.m4: Regenerated.
> * configure: Likewise.
>
> zlib/
>
> * configure: Regenerated.
OK. Thanks for your patience.
Jeff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb
2021-11-13 16:33 ` [PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb H.J. Lu
@ 2021-12-15 20:25 ` Jeff Law
0 siblings, 0 replies; 13+ messages in thread
From: Jeff Law @ 2021-12-15 20:25 UTC (permalink / raw)
To: H.J. Lu, gcc-patches
On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
> Sync with binutils for building binutils with LTO:
>
> From af019bfde9b13d628202fe58054ec7ff08d92a0f Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Sat, 9 Jan 2021 06:51:15 -0800
> Subject: [PATCH] Support the PGO build for binutils+gdb
>
> Add the --enable-pgo-build[=lto] configure option. When binutils+gdb
> is not built together with GCC, --enable-pgo-build enables the PGO build:
>
> 1. First build with -fprofile-generate.
> 2. Use "make maybe-check-*" to generate profiling data and pass -i to make
> to ignore errors when generating profiling data.
> 3. Use "make clean" to remove the previous build.
> 4. Rebuild with -fprofile-use.
>
> With --enable-pgo-build=lto, -flto=jobserver -ffat-lto-objects are used
> together with -fprofile-generate and -fprofile-use. Add '+' to the command
> line for recursive make to support -flto=jobserver -ffat-lto-objects.
>
> NB: --enable-pgo-build=lto enables the PGO build with LTO while
> --enable-lto enables LTO support in toolchain.
>
> PR binutils/26766
> * Makefile.tpl (BUILD_CFLAGS): New.
> (CFLAGS): Append $(BUILD_CFLAGS).
> (CXXFLAGS): Likewise.
> (PGO_BUILD_GEN_FLAGS_TO_PASS): New.
> (PGO_BUILD_TRAINING_CFLAGS): Likewise.
> (PGO_BUILD_TRAINING_CXXFLAGS): Likewise.
> (PGO_BUILD_TRAINING_FLAGS_TO_PASS): Likewise.
> (PGO_BUILD_TRAINING_MFLAGS): Likewise.
> (PGO_BUILD_USE_FLAGS_TO_PASS): Likewise.
> (PGO-TRAINING-TARGETS): Likewise.
> (PGO_BUILD_TRAINING): Likewise.
> (all): Add '+' to the command line for recursive make. Support
> the PGO build.
> * configure.ac: Add --enable-pgo-build[=lto].
> AC_SUBST PGO_BUILD_GEN_CFLAGS, PGO_BUILD_USE_CFLAGS and
> PGO_BUILD_LTO_CFLAGS. Enable the PGO build in Makefile.
> * Makefile.in: Regenerated.
> * configure: Likewise.
My understanding is this is just syncing us with binutils. So OK.
jeff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-11-13 16:33 ` [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB H.J. Lu
2021-11-23 0:29 ` Jeff Law
2021-12-15 17:33 ` Jeff Law
@ 2021-12-16 3:37 ` Sandra Loosemore
2021-12-16 4:28 ` H.J. Lu
2 siblings, 1 reply; 13+ messages in thread
From: Sandra Loosemore @ 2021-12-16 3:37 UTC (permalink / raw)
To: H.J. Lu, gcc-patches
On 11/13/21 9:33 AM, H.J. Lu via Gcc-patches wrote:
> Sync with binutils for building binutils with LTO:
>
> From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Sat, 9 Jan 2021 06:43:11 -0800
> Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
>
> Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> build.
>
> * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> * configure.ac: Include config/gcc-plugin.m4.
> AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> RANLIB if possible.
> * Makefile.in: Regenerated.
> * configure: Likewise.
>
> config/
>
> * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
>
> libiberty/
>
> * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> (configure_deps): Depend on ../config/gcc-plugin.m4.
> * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> RANLIB_PLUGIN_OPTION.
> * aclocal.m4: Regenerated.
> * configure: Likewise.
>
> zlib/
>
> * configure: Regenerated.
This patch appears to have broken my nios2-linux-gnu target,
x86_64-linux-gnu host cross build:
x86_64-linux-gnu-ar --plugin
/usr/local/tools/gcc-2021/bin/../libexec/gcc/x86_64-linux-gnu/9.3.1/liblto_plugin.so
--plugin
/usr/local/tools/gcc-2021/bin/../libexec/gcc/x86_64-linux-gnu/9.3.1/liblto_plugin.so
rc ./libiberty.a \
./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o
./argv.o ./bsearch_r.o ./choose-temp.o ./concat.o ./cp-demint.o
./crc32.o ./d-demangle.o ./dwarfnames.o ./dyn-string.o ./fdmatch.o
./fibheap.o ./filedescriptor.o ./filename_cmp.o ./floatformat.o
./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o
./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o
./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o
./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o
./pex-unix.o ./vprintf-support.o ./rust-demangle.o ./safe-ctype.o
./simple-object.o ./simple-object-coff.o ./simple-object-elf.o
./simple-object-mach-o.o ./simple-object-xcoff.o ./sort.o ./spaces.o
./splay-tree.o ./stack-limit.o ./strerror.o ./strsignal.o
./timeval-utils.o ./unlink-if-ordinary.o ./xasprintf.o ./xatexit.o
./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o
./xvasprintf.o ./setproctitle.o
x86_64-linux-gnu-ar: no operation specified
This is ar version 2.32.51. I also tried with an older set of host
tools using ar 2.25.51 and saw the same failure.
-Sandra
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-12-16 3:37 ` Sandra Loosemore
@ 2021-12-16 4:28 ` H.J. Lu
2021-12-16 4:38 ` H.J. Lu
2021-12-16 5:34 ` Sandra Loosemore
0 siblings, 2 replies; 13+ messages in thread
From: H.J. Lu @ 2021-12-16 4:28 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: GCC Patches
On Wed, Dec 15, 2021 at 7:38 PM Sandra Loosemore
<sandra@codesourcery.com> wrote:
>
> On 11/13/21 9:33 AM, H.J. Lu via Gcc-patches wrote:
> > Sync with binutils for building binutils with LTO:
> >
> > From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> > From: "H.J. Lu" <hjl.tools@gmail.com>
> > Date: Sat, 9 Jan 2021 06:43:11 -0800
> > Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
> >
> > Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> > build.
> >
> > * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> > (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> > * configure.ac: Include config/gcc-plugin.m4.
> > AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> > * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> > RANLIB if possible.
> > * Makefile.in: Regenerated.
> > * configure: Likewise.
> >
> > config/
> >
> > * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
> >
> > libiberty/
> >
> > * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> > (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> > (configure_deps): Depend on ../config/gcc-plugin.m4.
> > * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> > RANLIB_PLUGIN_OPTION.
> > * aclocal.m4: Regenerated.
> > * configure: Likewise.
> >
> > zlib/
> >
> > * configure: Regenerated.
>
> This patch appears to have broken my nios2-linux-gnu target,
> x86_64-linux-gnu host cross build:
>
> x86_64-linux-gnu-ar --plugin
> /usr/local/tools/gcc-2021/bin/../libexec/gcc/x86_64-linux-gnu/9.3.1/liblto_plugin.so
> --plugin
> /usr/local/tools/gcc-2021/bin/../libexec/gcc/x86_64-linux-gnu/9.3.1/liblto_plugin.so
> rc ./libiberty.a \
> ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o
> ./argv.o ./bsearch_r.o ./choose-temp.o ./concat.o ./cp-demint.o
> ./crc32.o ./d-demangle.o ./dwarfnames.o ./dyn-string.o ./fdmatch.o
> ./fibheap.o ./filedescriptor.o ./filename_cmp.o ./floatformat.o
> ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o
> ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o
> ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o
> ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o
> ./pex-unix.o ./vprintf-support.o ./rust-demangle.o ./safe-ctype.o
> ./simple-object.o ./simple-object-coff.o ./simple-object-elf.o
> ./simple-object-mach-o.o ./simple-object-xcoff.o ./sort.o ./spaces.o
> ./splay-tree.o ./stack-limit.o ./strerror.o ./strsignal.o
> ./timeval-utils.o ./unlink-if-ordinary.o ./xasprintf.o ./xatexit.o
> ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o
> ./xvasprintf.o ./setproctitle.o
> x86_64-linux-gnu-ar: no operation specified
>
> This is ar version 2.32.51. I also tried with an older set of host
> tools using ar 2.25.51 and saw the same failure.
>
> -Sandra
I built nios2-linux-gnu cross compiler using glibc build-many-glibcs.py
script:
/usr/bin/time /export/project/tools-build/glibc-many/src/glibc/scripts/build-man
y-glibcs.py -j 96 /export/project/tools-build/glibc-many \
compilers nios2-linux-gnu
make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu check-host-libraries
PASS: compilers-nios2-linux-gnu binutils rm
PASS: compilers-nios2-linux-gnu binutils mkdir
PASS: compilers-nios2-linux-gnu binutils configure
make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu binutils build
PASS: compilers-nios2-linux-gnu binutils install
make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu binutils cleanup
PASS: compilers-nios2-linux-gnu linux rm
PASS: compilers-nios2-linux-gnu linux mkdir
make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu linux install-headers
make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu linux cleanup
PASS: compilers-nios2-linux-gnu gcc-first rm
PASS: compilers-nios2-linux-gnu gcc-first mkdir
PASS: compilers-nios2-linux-gnu gcc-first configure
make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu gcc-first build
PASS: compilers-nios2-linux-gnu gcc-first install
make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu gcc-first cleanup
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu rm
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu mkdir
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu configure
make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu build
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu install
make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu mkdir-lib
PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu cleanup
PASS: compilers-nios2-linux-gnu gcc rm
PASS: compilers-nios2-linux-gnu gcc mkdir
PASS: compilers-nios2-linux-gnu gcc configure
make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu gcc build
PASS: compilers-nios2-linux-gnu gcc install
make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
PASS: compilers-nios2-linux-gnu gcc cleanup
PASS: compilers-nios2-linux-gnu done
make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
using glibc master, binutils master and gcc master. Is there a way
to reproduce it with build-many-glibcs.py?
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-12-16 4:28 ` H.J. Lu
@ 2021-12-16 4:38 ` H.J. Lu
2021-12-16 5:34 ` Sandra Loosemore
1 sibling, 0 replies; 13+ messages in thread
From: H.J. Lu @ 2021-12-16 4:38 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: GCC Patches
On Wed, Dec 15, 2021 at 8:28 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Dec 15, 2021 at 7:38 PM Sandra Loosemore
> <sandra@codesourcery.com> wrote:
> >
> > On 11/13/21 9:33 AM, H.J. Lu via Gcc-patches wrote:
> > > Sync with binutils for building binutils with LTO:
> > >
> > > From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
> > > From: "H.J. Lu" <hjl.tools@gmail.com>
> > > Date: Sat, 9 Jan 2021 06:43:11 -0800
> > > Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB
> > >
> > > Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
> > > build.
> > >
> > > * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
> > > (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> > > * configure.ac: Include config/gcc-plugin.m4.
> > > AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
> > > * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
> > > RANLIB if possible.
> > > * Makefile.in: Regenerated.
> > > * configure: Likewise.
> > >
> > > config/
> > >
> > > * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
> > >
> > > libiberty/
> > >
> > > * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
> > > (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
> > > (configure_deps): Depend on ../config/gcc-plugin.m4.
> > > * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
> > > RANLIB_PLUGIN_OPTION.
> > > * aclocal.m4: Regenerated.
> > > * configure: Likewise.
> > >
> > > zlib/
> > >
> > > * configure: Regenerated.
> >
> > This patch appears to have broken my nios2-linux-gnu target,
> > x86_64-linux-gnu host cross build:
> >
> > x86_64-linux-gnu-ar --plugin
> > /usr/local/tools/gcc-2021/bin/../libexec/gcc/x86_64-linux-gnu/9.3.1/liblto_plugin.so
> > --plugin
> > /usr/local/tools/gcc-2021/bin/../libexec/gcc/x86_64-linux-gnu/9.3.1/liblto_plugin.so
Let me revert this patch for now since this doesn't work with GCC bootstrap
which needs to pass the newly built plugin to AR and RANLIB.
> > rc ./libiberty.a \
> > ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o
> > ./argv.o ./bsearch_r.o ./choose-temp.o ./concat.o ./cp-demint.o
> > ./crc32.o ./d-demangle.o ./dwarfnames.o ./dyn-string.o ./fdmatch.o
> > ./fibheap.o ./filedescriptor.o ./filename_cmp.o ./floatformat.o
> > ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o
> > ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o
> > ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o
> > ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o
> > ./pex-unix.o ./vprintf-support.o ./rust-demangle.o ./safe-ctype.o
> > ./simple-object.o ./simple-object-coff.o ./simple-object-elf.o
> > ./simple-object-mach-o.o ./simple-object-xcoff.o ./sort.o ./spaces.o
> > ./splay-tree.o ./stack-limit.o ./strerror.o ./strsignal.o
> > ./timeval-utils.o ./unlink-if-ordinary.o ./xasprintf.o ./xatexit.o
> > ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o
> > ./xvasprintf.o ./setproctitle.o
> > x86_64-linux-gnu-ar: no operation specified
> >
> > This is ar version 2.32.51. I also tried with an older set of host
> > tools using ar 2.25.51 and saw the same failure.
> >
> > -Sandra
>
> I built nios2-linux-gnu cross compiler using glibc build-many-glibcs.py
> script:
>
> /usr/bin/time /export/project/tools-build/glibc-many/src/glibc/scripts/build-man
> y-glibcs.py -j 96 /export/project/tools-build/glibc-many \
> compilers nios2-linux-gnu
> make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu check-host-libraries
> PASS: compilers-nios2-linux-gnu binutils rm
> PASS: compilers-nios2-linux-gnu binutils mkdir
> PASS: compilers-nios2-linux-gnu binutils configure
> make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu binutils build
> PASS: compilers-nios2-linux-gnu binutils install
> make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu binutils cleanup
> PASS: compilers-nios2-linux-gnu linux rm
> PASS: compilers-nios2-linux-gnu linux mkdir
> make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu linux install-headers
> make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu linux cleanup
> PASS: compilers-nios2-linux-gnu gcc-first rm
> PASS: compilers-nios2-linux-gnu gcc-first mkdir
> PASS: compilers-nios2-linux-gnu gcc-first configure
> make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu gcc-first build
> PASS: compilers-nios2-linux-gnu gcc-first install
> make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu gcc-first cleanup
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu rm
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu mkdir
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu configure
> make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu build
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu install
> make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu mkdir-lib
> PASS: compilers-nios2-linux-gnu glibc nios2-linux-gnu cleanup
> PASS: compilers-nios2-linux-gnu gcc rm
> PASS: compilers-nios2-linux-gnu gcc mkdir
> PASS: compilers-nios2-linux-gnu gcc configure
> make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu gcc build
> PASS: compilers-nios2-linux-gnu gcc install
> make[1]: Entering directory '/export/project/tools-build/glibc-many/build'
> PASS: compilers-nios2-linux-gnu gcc cleanup
> PASS: compilers-nios2-linux-gnu done
> make[1]: Leaving directory '/export/project/tools-build/glibc-many/build'
>
> using glibc master, binutils master and gcc master. Is there a way
> to reproduce it with build-many-glibcs.py?
>
> --
> H.J.
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB
2021-12-16 4:28 ` H.J. Lu
2021-12-16 4:38 ` H.J. Lu
@ 2021-12-16 5:34 ` Sandra Loosemore
1 sibling, 0 replies; 13+ messages in thread
From: Sandra Loosemore @ 2021-12-16 5:34 UTC (permalink / raw)
To: H.J. Lu; +Cc: GCC Patches
On 12/15/21 9:28 PM, H.J. Lu wrote:
> I built nios2-linux-gnu cross compiler using glibc build-many-glibcs.py
> script:
>
> [snip]
>
> using glibc master, binutils master and gcc master. Is there a way
> to reproduce it with build-many-glibcs.py?
If it requires host tools built from binutils master, that is no good.
We build our cross-tools using a host toolchain built from an older,
stable branch. Some other developers build GCC cross-compilers using
whatever version of the host tools are provided by their OS distro.
FWIW, the --help output for both ar 2.32.51 and 2.25.51 indicates that
--plugin is supposed to come *after* the command options, not before,
which is where your Makefile changes are putting it. E.g.
$ x86_64-linux-gnu-ar --help
Usage: x86_64-linux-gnu-ar [emulation options]
[-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name]
[count] archive-file file...
x86_64-linux-gnu-ar -M [<mri-script]
-Sandra
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-12-16 5:34 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 16:33 [PATCH 0/2] Sync with binutils for building binutils with LTO: H.J. Lu
2021-11-13 16:33 ` [PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB H.J. Lu
2021-11-23 0:29 ` Jeff Law
2021-11-23 2:29 ` H.J. Lu
2021-12-14 23:30 ` Jeff Law
2021-12-15 0:29 ` H.J. Lu
2021-12-15 17:33 ` Jeff Law
2021-12-16 3:37 ` Sandra Loosemore
2021-12-16 4:28 ` H.J. Lu
2021-12-16 4:38 ` H.J. Lu
2021-12-16 5:34 ` Sandra Loosemore
2021-11-13 16:33 ` [PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb H.J. Lu
2021-12-15 20:25 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).