Re: PING^2: [PATCH] Add --enable-first-stage-cross configure option

2022-07-13 Thread Serge Belyshev via Gcc-patches
Jeff Law via Gcc-patches  writes:

> I'm not really sure we need a patch for this.  Isn't it sufficient to
> "make all-gcc && make all-target-libgcc"?  Folks have been doing that
> for decades.
>
> Jeff

Oh, I did not know that "make install-gcc install-target-libgcc" works in this 
case.

So in the end, patch simplifies quirky first stage cross tool build procedure 
from

  configure --target=$target  --enable-languages=c --disable-threads 
--disable-shared # plus --with-newlib when --with-sysroot=
  make all-gcc all-target-libgcc
  make install-gcc install-target-libgcc

to

  configure --target=$target --enable-first-stage-cross
  make
  make install

Either way is more or less okay for me, it just needs to be documented.


PING^3: [PATCH] Add --enable-first-stage-cross configure option

2022-01-16 Thread Serge Belyshev via Gcc-patches
Final ping before stage3 ends:

[PATCH] Add --enable-first-stage-cross configure option
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575318.html


PING^2: [PATCH] Add --enable-first-stage-cross configure option

2022-01-09 Thread Serge Belyshev
Ping: [PATCH] Add --enable-first-stage-cross configure option
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575318.html


Add --enable-first-stage-cross configure option

Build static-only, C-only compiler that is sufficient to cross compile
glibc.  This option disables various runtime libraries that require
libc to compile, turns on --with-newlib, --without-headers,
--disable-decimal-float, --disable-shared, --disable-threads, and sets
--enable-languages=c.

Rationale: current way of building first stage compiler of a cross
toolchain requires specifying a list of target libraries that are not
going to be compiled due to their dependency on target libc.  This
list is not documented in gccinstall.texi and sometimes changes.  To
simplify the procedure, it is better to maintain that list in the GCC
itself.

Usage example as a patch to glibc's scripts/build-many-libcs.py:

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 580d25e8ee..3a6a7be76b 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1446,17 +1446,7 @@ class Config(object):
 # required to define inhibit_libc (to stop some parts of
 # libgcc including libc headers); --without-headers is not
 # sufficient.
-cfg_opts += ['--enable-languages=c', '--disable-shared',
- '--disable-threads',
- '--disable-libatomic',
- '--disable-decimal-float',
- '--disable-libffi',
- '--disable-libgomp',
- '--disable-libitm',
- '--disable-libmpx',
- '--disable-libquadmath',
- '--disable-libsanitizer',
- '--without-headers', '--with-newlib',
+cfg_opts += ['--enable-first-stage-cross',
  '--with-glibc-version=%s' % self.ctx.glibc_version
  ]
 cfg_opts += self.first_gcc_cfg

Bootstrapped/regtested on x86_64-pc-linux-gnu, and
tested with build-many-glibcs.py with the above patch.

OK for mainline?


ChangeLog:

* configure.ac: Add --enable-first-stage-cross.
* configure: Regenerate.

gcc/ChangeLog:

* doc/install.texi: Document --enable-first-stage-cross.
---
 configure| 20 
 configure.ac | 15 +++
 gcc/doc/install.texi |  7 +++
 3 files changed, 42 insertions(+)

diff --git a/configure b/configure
index 9c2d7df1bb2..44f6ebcb947 100755
--- a/configure
+++ b/configure
@@ -794,6 +794,7 @@ ac_user_opts='
 enable_option_checking
 with_build_libsubdir
 with_system_zlib
+enable_first_stage_cross
 enable_as_accelerator_for
 enable_offload_targets
 enable_offload_defaulted
@@ -1522,6 +1523,9 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE   do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-first-stage-cross
+  Build a static-only compiler that is sufficient to
+  build glibc.
   --enable-as-accelerator-for=ARG
   build as offload target compiler. Specify offload
   host triple by ARG
@@ -2971,6 +2975,22 @@ case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
 esac
 
+# Check whether --enable-first-stage-cross was given.
+if test "${enable_first_stage_cross+set}" = set; then :
+  enableval=$enable_first_stage_cross; ENABLE_FIRST_STAGE_CROSS=$enableval
+else
+  ENABLE_FIRST_STAGE_CROSS=no
+fi
+
+case "${ENABLE_FIRST_STAGE_CROSS}" in
+  yes)
+noconfigdirs="$noconfigdirs target-libatomic target-libquadmath 
target-libgomp target-libssp"
+host_configargs="$host_configargs --disable-shared --disable-threads 
--disable-decimal-float --without-headers --with-newlib"
+target_configargs="$target_configargs --disable-shared"
+enable_languages=c
+;;
+esac
+
 # If both --with-headers and --with-libs are specified, default to
 # --without-newlib.
 if test x"${with_headers}" != x && test x"${with_headers}" != xno \
diff --git a/configure.ac b/configure.ac
index 68cc5cc31fe..84ae8210a72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,6 +268,21 @@ case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
 esac
 
+AC_ARG_ENABLE(first-stage-cross,
+[AS_HELP_STRING([--enable-first-stage-cross],
+   [Build a static-only compiler that is
+   sufficient to build glibc.])],
+ENABLE_FIRST_STAGE_CROSS=$enableval,
+ENABLE_FIRST_STAGE_CROSS=no)
+case "${ENABLE_FIRST_STAGE_CROSS}" in
+  yes)
+noconfigdirs="$noconfigdirs target-libatomic target-libquadmath 
target-libgomp target-libssp"
+host_configargs="$host_configargs --disable-shared --disable-threads 
--disable-decimal-float 

Ping: [PATCH] Add --enable-first-stage-cross configure option

2021-09-06 Thread Serge Belyshev
Ping?

[PATCH] Add --enable-first-stage-cross configure option
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575318.html


> Add --enable-first-stage-cross configure option
>
> Build static-only, C-only compiler that is sufficient to cross compile
> glibc.  This option disables various runtime libraries that require
> libc to compile, turns on --with-newlib, --without-headers,
> --disable-decimal-float, --disable-shared, --disable-threads, and sets
> --enable-languages=c.
> 
> Rationale: current way of building first stage compiler of a cross
> toolchain requires specifying a list of target libraries that are not
> going to be compiled due to their dependency on target libc.  This
> list is not documented in gccinstall.texi and sometimes changes.  To
> simplify the procedure, it is better to maintain that list in the GCC
> itself.
>
> Usage example as a patch to glibc's scripts/build-many-libcs.py:
>
> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index 580d25e8ee..3a6a7be76b 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -1446,17 +1446,7 @@ class Config(object):
>  # required to define inhibit_libc (to stop some parts of
>  # libgcc including libc headers); --without-headers is not
>  # sufficient.
> -cfg_opts += ['--enable-languages=c', '--disable-shared',
> - '--disable-threads',
> - '--disable-libatomic',
> - '--disable-decimal-float',
> - '--disable-libffi',
> - '--disable-libgomp',
> - '--disable-libitm',
> - '--disable-libmpx',
> - '--disable-libquadmath',
> - '--disable-libsanitizer',
> - '--without-headers', '--with-newlib',
> +cfg_opts += ['--enable-first-stage-cross',
>   '--with-glibc-version=%s' % self.ctx.glibc_version
>   ]
>  cfg_opts += self.first_gcc_cfg
>
>
> Bootstrapped/regtested on x86_64-pc-linux-gnu, and
> tested with build-many-glibcs.py with the above patch.
>
> OK for mainline?
>
>
> ChangeLog:
>
>   * configure.ac: Add --enable-first-stage-cross.
>   * configure: Regenerate.
>
> gcc/ChangeLog:
>
>   * doc/install.texi: Document --enable-first-stage-cross.
> ---
>  configure| 20 
>  configure.ac | 15 +++
>  gcc/doc/install.texi |  7 +++
>  3 files changed, 42 insertions(+)
>
> diff --git a/configure b/configure
> index 85ab9915402..df59036e258 100755
> --- a/configure
> +++ b/configure
> @@ -787,6 +787,7 @@ ac_user_opts='
>  enable_option_checking
>  with_build_libsubdir
>  with_system_zlib
> +enable_first_stage_cross
>  enable_as_accelerator_for
>  enable_offload_targets
>  enable_offload_defaulted
> @@ -1514,6 +1515,9 @@ Optional Features:
>--disable-option-checking  ignore unrecognized --enable/--with options
>--disable-FEATURE   do not include FEATURE (same as 
> --enable-FEATURE=no)
>--enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
> +  --enable-first-stage-cross
> +  Build a static-only compiler that is sufficient to
> +  build glibc.
>--enable-as-accelerator-for=ARG
>build as offload target compiler. Specify offload
>host triple by ARG
> @@ -2961,6 +2965,22 @@ case $is_cross_compiler in
>no) skipdirs="${skipdirs} ${cross_only}" ;;
>  esac
>  
> +# Check whether --enable-first-stage-cross was given.
> +if test "${enable_first_stage_cross+set}" = set; then :
> +  enableval=$enable_first_stage_cross; ENABLE_FIRST_STAGE_CROSS=$enableval
> +else
> +  ENABLE_FIRST_STAGE_CROSS=no
> +fi
> +
> +case "${ENABLE_FIRST_STAGE_CROSS}" in
> +  yes)
> +noconfigdirs="$noconfigdirs target-libatomic target-libquadmath 
> target-libgomp target-libssp"
> +host_configargs="$host_configargs --disable-shared --disable-threads 
> --disable-decimal-float --without-headers --with-newlib"
> +target_configargs="$target_configargs --disable-shared"
> +enable_languages=c
> +;;
> +esac
> +
>  # If both --with-headers and --with-libs are specified, default to
>  # --without-newlib.
>  if test x"${with_headers}" != x && test x"${with_headers}" != xno \
> diff --git a/configure.ac b/configure.ac
> index 1df038b04f3..53f920c1a2c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -268,6 +268,21 @@ case $is_cross_compiler in
>no) skipdirs="${skipdirs} ${cross_only}" ;;
>  esac
>  
> +AC_ARG_ENABLE(first-stage-cross,
> +[AS_HELP_STRING([--enable-first-stage-cross],
> + [Build a static-only compiler that is
> + sufficient to build glibc.])],
> +ENABLE_FIRST_STAGE_CROSS=$enableval,
> +ENABLE_FIRST_STAGE_CROSS=no)
> +case 

Re: [PATCH v3] gcc_update: use human readable name for revision string in gcc/REVISION

2021-09-06 Thread Serge Belyshev
Jakub Jelinek  writes:

> On Mon, Sep 06, 2021 at 12:49:18PM +0300, Serge Belyshev wrote:
>   * gcc_update: derive human readable name for HEAD using git describe
>
> After : start with upper case, ^^^ Derive
>
>   like "git gcc-descr" with short commit hash.  Drop "revision" from 
> gcc/REVISION.
>
> Too long line.
>
> Otherwise LGTM.

Thanks!  Changed and committed as r12-3370-g78b34cd8a80.


Re: [PATCH v3] gcc_update: use human readable name for revision string in gcc/REVISION

2021-09-06 Thread Serge Belyshev via Gcc-patches
Ping?

[PATCH v3] gcc_update: use human readable name for revision string in 
gcc/REVISION
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575556.html

>
> OK for mainline?
>
> ---
> contrib/Changelog:
>
>   * gcc_update: derive human readable name for HEAD using git describe
>   like "git gcc-descr" with short commit hash.  Drop "revision" from 
> gcc/REVISION.
> ---
>  contrib/gcc_update | 19 +--
>  1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/gcc_update b/contrib/gcc_update
> index 80fac9fc995..ce472545e25 100755
> --- a/contrib/gcc_update
> +++ b/contrib/gcc_update
> @@ -332,7 +332,22 @@ case $vcs_type in
>  exit 1
>   fi
>  
> - revision=`$GCC_GIT log -n1 --pretty=tformat:%p:%t:%H`
> + # Open-coded version of "git gcc-descr" from 
> contrib/gcc-git-customization.sh
> + revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
> + r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
> +| sed -n 
> 's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;
> + if test -n $r; then
> + o=`$GCC_GIT config --get gcc-config.upstream`;
> + rr=`echo $r | sed -n 
> 's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'`;
> + if $GCC_GIT rev-parse --verify --quiet 
> ${o:-origin}/releases/gcc-$rr >/dev/null; then
> + m=releases/gcc-$rr;
> + else
> + m=master;
> + fi;
> + if $GCC_GIT merge-base --is-ancestor HEAD ${o:-origin}/$m; then
> + revision=${r}-g${revision};
> + fi
> + fi
>   branch=`$GCC_GIT name-rev --name-only HEAD || :`
>   ;;
>  
> @@ -414,6 +429,6 @@ rm -f LAST_UPDATED gcc/REVISION
>  date
>  echo "`TZ=UTC date` (revision $revision)"
>  } > LAST_UPDATED
> -echo "[$branch revision $revision]" > gcc/REVISION
> +echo "[$branch $revision]" > gcc/REVISION
>  
>  touch_files_reexec


Re: [PATCH 0/4] drop version checks for in-tree gas [PR91602]

2021-08-20 Thread Serge Belyshev via Gcc-patches
Jeff Law  writes:

> This set is approved.    Push them to the trunk when it's convenient
> for you.
>
> Thanks for your patience,

Thanks! Committed as r12-3047 .. r12-3050.


Re: [PATCH 0/4] drop version checks for in-tree gas [PR91602]

2021-08-09 Thread Serge Belyshev via Gcc-patches
Jeff Law  writes:

> On 7/20/2021 9:44 AM, Serge Belyshev wrote:
>> Special-casing checks for in-tree gas features is unnecessary since
>> r17 which made configure-gcc depend on all-gas, and thus making
>> alternate code path in gcc_GAS_CHECK_FEATURE for in-tree gas
>> redundant.
>>
>> Along the way this fixes PR 91602, which is caused by incorrect guess
>> of leb128 support presense in RISC-V.
>>
>> First patch removes alternate code path in gcc_GAS_CHECK_FEATURE and
>> related code, the rest are further cleanups.  Patches 2 and 3 in
>> series make no functional changes, thus configure is unchanged.
>>
>> Bootstrapped/regtested on x86_64-pc-linux-gnu, riscv64-unknown-linux-gnu,
>> sparc-sun-solaris2.11 and powerpc-ibm-aix7.{1.5.0,2.4.0}, with and without
>> in-tree binutils (except on aix where combined tree does not appear to work
>> due to dynamic linker peculiarity).
>>
>> OK for mainline ?
>>
>> Serge Belyshev (4):
>>configure: drop version checks for in-tree gas [PR91602]
>>configure: remove version argument from gcc_GAS_CHECK_FEATURE
>>configure: fixup formatting from previous change
>>configure: remove gas versions from tls check
> So just be clear, the point here is to stop checking the version # and
> instead always do a real feature check by testing the behavior of the
> assembler, even an in-tree assembler, right?

That is correct, yes.


[PATCH 4/4] configure: remove gas versions from tls check

2021-07-21 Thread Serge Belyshev
configure: remove gas versions from tls check

gcc/ChangeLog:

* configure.ac (thread-local storage support): Remove tls_first_major
and tls_first_minor.  Use "$conftest_s" to check support.
* configure: Regenerate.
---
 gcc/configure| 58 +---
 gcc/configure.ac | 58 +---
 2 files changed, 2 insertions(+), 114 deletions(-)

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6b452904ce7..02211b376bf 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3653,8 +3653,6 @@ esac], [])
 
 # Thread-local storage - the check is heavily parameterized.
 conftest_s=
-tls_first_major=
-tls_first_minor=
 tls_as_opt=
 case "$target" in
 changequote(,)dnl
@@ -3677,15 +3675,11 @@ foo:.long   25
ldah$2,foo($29) !tprelhi
lda $3,foo($2)  !tprello
lda $4,foo($29) !tprel'
-   tls_first_major=2
-   tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
   arc*-*-*)
 conftest_s='
add_s r0,r0, @foo@tpoff'
-   tls_first_major=2
-   tls_first_minor=23
;;
   cris-*-*|crisv32-*-*)
 conftest_s='
@@ -3694,8 +3688,6 @@ x:  .long   25
 .text
move.d x:IE,$r10
nop'
-   tls_first_major=2
-   tls_first_minor=20
tls_as_opt=--fatal-warnings
;;
   frv*-*-*)
@@ -3704,8 +3696,6 @@ x:  .long   25
 x:  .long   25
 .text
 call#gettlsoff(x)'
-   tls_first_major=2
-   tls_first_minor=14
;;
   hppa*-*-linux*)
 conftest_s='
@@ -3732,8 +3722,6 @@ foo:  .long   25
mfctl %cr27,%t1 
addil LR%foo-$tls_leoff$,%t1
ldo RR%foo-$tls_leoff$(%r1),%t2'
-   tls_first_major=2
-   tls_first_minor=15
tls_as_opt=--fatal-warnings
;;
   arm*-*-*)
@@ -3746,8 +3734,6 @@ foo:  .long   25
 .word foo(tlsgd)
 .word foo(tlsldm)
 .word foo(tlsldo)'
-   tls_first_major=2
-   tls_first_minor=17
;;
   i[34567]86-*-* | x86_64-*-*)
 case "$target" in
@@ -3761,8 +3747,6 @@ foo:  .long   25
 if test x$on_solaris = xyes && test x$gas_flag = xno; then
   conftest_s='
.section .tdata,"awt",@progbits'
-  tls_first_major=0
-  tls_first_minor=0
   tls_section_flag=t
 changequote([,])dnl
   AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
@@ -3771,8 +3755,6 @@ changequote(,)dnl
 else
   conftest_s='
.section ".tdata","awT",@progbits'
-  tls_first_major=2
-  tls_first_minor=14
   tls_section_flag=T
   tls_as_opt="--fatal-warnings"
 fi
@@ -3831,8 +3813,6 @@ foo:  data8   25
addlr20 = @tprel(foo#), gp
addsr22 = @tprel(foo#), r13
movlr24 = @tprel(foo#)'
-   tls_first_major=2
-   tls_first_minor=13
tls_as_opt=--fatal-warnings
;;
   microblaze*-*-*)
@@ -3843,8 +3823,6 @@ x:
.text
addik r5,r20,x@TLSGD
addik r5,r20,x@TLSLDM'
-   tls_first_major=2
-   tls_first_minor=20
tls_as_opt='--fatal-warnings'
;;
   mips*-*-*)
@@ -3860,8 +3838,6 @@ x:
lw $4, %gottprel(x)($28)
lui $4, %tprel_hi(x)
addiu $4, $4, %tprel_lo(x)'
-   tls_first_major=2
-   tls_first_minor=16
tls_as_opt='-32 --fatal-warnings'
;;
   m68k-*-*)
@@ -3876,15 +3852,11 @@ foo:
move.l x@TLSLDO(%a5),%a0
move.l x@TLSIE(%a5),%a0
move.l x@TLSLE(%a5),%a0'
-   tls_first_major=2
-   tls_first_minor=19
tls_as_opt='--fatal-warnings'
;;
   nios2-*-*)
   conftest_s='
.section ".tdata","awT",@progbits'
-   tls_first_major=2
-   tls_first_minor=23
tls_as_opt="--fatal-warnings"
;;
   aarch64*-*-*)
@@ -3896,8 +3868,6 @@ foo:  .long   25
add   x0, x0, #:tlsgd_lo12:x
 bl__tls_get_addr
nop'
-   tls_first_major=2
-   tls_first_minor=20
tls_as_opt='--fatal-warnings'
;;
   or1k*-*-*)
@@ -3908,8 +3878,6 @@ foo:  .long   25
l.movhi r3, tpoffha(foo)
l.add   r3, r3, r10
l.lwz   r4, tpofflo(foo)(r3)'
-tls_first_major=2
-tls_first_minor=30
 tls_as_opt=--fatal-warnings
 ;;
   powerpc-ibm-aix*)
@@ -3927,8 +3895,6 @@ LC..1:
.csect a[TL],4
 a:
.space 4'
-   tls_first_major=0
-   tls_first_minor=0
;;
   powerpc64*-*-*)
 conftest_s='
@@ -3960,8 +3926,6 @@ x3:   .space 8
add 9,9,3
bl .__tls_get_addr
nop'
-   tls_first_major=2
-   tls_first_minor=14
tls_as_opt="-a64 --fatal-warnings"
;;
   powerpc*-*-*)
@@ -3986,8 +3950,6 @@ x3:   .space 4
addi 9,2,x1@tprel
addis 9,2,x2@tprel@ha
addi 9,9,x2@tprel@l'
-   tls_first_major=2
-   tls_first_minor=14
tls_as_opt="-a32 --fatal-warnings"
;;
   

[PATCH 3/4] configure: fixup formatting from previous change

2021-07-21 Thread Serge Belyshev
configure: fixup formatting from previous change

gcc/ChangeLog:

* configure.ac: Fixup formatting.
---
 gcc/configure.ac | 71 ++--
 1 file changed, 27 insertions(+), 44 deletions(-)

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 3846794b949..6b452904ce7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2883,28 +2883,24 @@ case "$ORIGINAL_DSYMUTIL_FOR_TARGET" in
 esac 
 
 # Figure out what assembler alignment features are present.
-gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
- ,
+gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,,
 [.balign 4
 .p2align 2],,
 [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
   [Define if your assembler supports .balign and .p2align.])])
 
-gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
- ,
+gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], 
gcc_cv_as_max_skip_p2align,,
  [.p2align 4,,7],,
 [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
   [Define if your assembler supports specifying the maximum number
of bytes to skip when using the GAS .p2align command.])])
 
-gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,
- ,
+gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,,
  [.literal16],,
 [AC_DEFINE(HAVE_GAS_LITERAL16, 1,
   [Define if your assembler supports .literal16.])])
 
-gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
- ,
+gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,,
  [conftest_label1: .word 0
 .subsection -1
 conftest_label2: .word 0
@@ -2922,18 +2918,15 @@ conftest_label2: .word 0
   [Define if your assembler supports .subsection and .subsection -1 starts
emitting at the beginning of your section.])])
 
-gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
- ,
+gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,,
  [ .weak foobar],,
 [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
 
-gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
- ,
+gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,,
  [ .weakref foobar, barfnot],,
 [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports 
.weakref.])])
 
-gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
- ,
+gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,,
  [ .SPACE $TEXT$
.NSUBSPA $CODE$,COMDAT],,
 [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports 
.nsubspa comdat option.])])
@@ -2954,8 +2947,7 @@ case "${target}" in
 foobar:'
 ;;
 esac
-gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
- , [$conftest_s])
+gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,, [$conftest_s])
 case "${target}" in
   *-*-darwin*)
 # Darwin as has some visibility support, though with a different syntax.
@@ -3173,8 +3165,7 @@ gcc_AC_INITFINI_ARRAY
 # Check if we have .[us]leb128, and support symbol arithmetic with it.
 # Older versions of GAS and some non-GNU assemblers, have a bugs handling
 # these directives, even when they appear to accept them.
-gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
- ,
+gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,,
 [  .data
.uleb128 L2 - L1
 L1:
@@ -3212,8 +3203,7 @@ gcc_fn_eh_frame_ro () {
 }
 
 # Check if we have assembler support for unwind directives.
-gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
-  ,
+gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,,
 [  .text
.cfi_startproc
.cfi_offset 0, 0
@@ -3268,8 +3258,7 @@ gcc_GAS_CHECK_FEATURE([cfi directives], 
gcc_cv_as_cfi_directive,
 ;;
 esac])
 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
-gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
-  ,
+gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,,
 [  .text
.cfi_startproc
.cfi_adjust_cfa_offset 64
@@ -3332,8 +3321,7 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
 
 # GAS versions up to and including 2.11.0 may mis-optimize
 # .eh_frame data.
-gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
-  ,
+gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,,
 [  .text
 .LFB1:
.4byte  0
@@ -3636,8 +3624,7 @@ case "${target}" in
 esac
 
 gcc_GAS_CHECK_FEATURE([line table is_stmt support],
- gcc_cv_as_is_stmt,
- ,
+ gcc_cv_as_is_stmt,,
 [  .text
.file 1 "conf.c"
.loc 1 1 0 is_stmt 1],,
@@ -3645,8 +3632,7 @@ gcc_GAS_CHECK_FEATURE([line table is_stmt support],
   [Define if your assembler supports the .loc is_stmt sub-directive.])])
 
 gcc_GAS_CHECK_FEATURE([line table discriminator support],
- gcc_cv_as_discriminator,
- ,
+ gcc_cv_as_discriminator,,
 [  .text
.file 1 "conf.c"
.loc 1 1 0 discriminator 1],,
@@ -4741,16 +4727,15 @@ changequote([,])dnl
# Recent binutils allows the three-operand 

[PATCH 2/4] configure: remove version argument from gcc_GAS_CHECK_FEATURE

2021-07-21 Thread Serge Belyshev
configure: remove version argument from gcc_GAS_CHECK_FEATURE

gcc/ChangeLog:

* acinclude.m4 (gcc_GAS_CHECK_FEATURE): Remove third argument and ...
* configure.ac: ... update all callers.
---
 gcc/acinclude.m4 |  16 ++--
 gcc/configure.ac | 224 +++
 2 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index e038990cca6..082fa16ecb5 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -470,7 +470,7 @@ AC_DEFUN([gcc_GAS_FLAGS],
   esac])
 ])
 
-dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
+dnl gcc_GAS_CHECK_FEATURE(description, cv,
 dnl [extra switches to as], [assembler input],
 dnl [extra testing logic], [command if feature available])
 dnl
@@ -484,23 +484,23 @@ AC_DEFUN([gcc_GAS_CHECK_FEATURE],
 AC_CACHE_CHECK([assembler for $1], [$2],
  [[$2]=no
   if test x$gcc_cv_as != x; then
-AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
-if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s 
>_MESSAGE_LOG_FD])
+AS_ECHO([ifelse(m4_substr([$4],0,1),[$], "[$4]", '[$4]')]) > conftest.s
+if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $3 -o conftest.o conftest.s 
>_MESSAGE_LOG_FD])
 then
-   ifelse([$6],, [$2]=yes, [$6])
+   ifelse([$5],, [$2]=yes, [$5])
 else
   echo "configure: failed program was" >_MESSAGE_LOG_FD
   cat conftest.s >_MESSAGE_LOG_FD
 fi
 rm -f conftest.o conftest.s
   fi])
-ifelse([$7],,,[dnl
+ifelse([$6],,,[dnl
 if test $[$2] = yes; then
-  $7
+  $6
 fi])
-ifelse([$8],,,[dnl
+ifelse([$7],,,[dnl
 if test $[$2] != yes; then
-  $8
+  $7
 fi])])
 
 dnl GCC_TARGET_TEMPLATE(KEY)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c6e0bfdde90..3846794b949 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2884,27 +2884,27 @@ esac
 
 # Figure out what assembler alignment features are present.
 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
- [2,6,0],,
+ ,
 [.balign 4
 .p2align 2],,
 [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
   [Define if your assembler supports .balign and .p2align.])])
 
 gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
- [2,8,0],,
+ ,
  [.p2align 4,,7],,
 [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
   [Define if your assembler supports specifying the maximum number
of bytes to skip when using the GAS .p2align command.])])
 
 gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,
- [2,8,0],,
+ ,
  [.literal16],,
 [AC_DEFINE(HAVE_GAS_LITERAL16, 1,
   [Define if your assembler supports .literal16.])])
 
 gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
- [elf,2,9,0],,
+ ,
  [conftest_label1: .word 0
 .subsection -1
 conftest_label2: .word 0
@@ -2923,17 +2923,17 @@ conftest_label2: .word 0
emitting at the beginning of your section.])])
 
 gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
- [2,2,0],,
+ ,
  [ .weak foobar],,
 [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
 
 gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
- [2,17,0],,
+ ,
  [ .weakref foobar, barfnot],,
 [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports 
.weakref.])])
 
 gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
- [2,15,91],,
+ ,
  [ .SPACE $TEXT$
.NSUBSPA $CODE$,COMDAT],,
 [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports 
.nsubspa comdat option.])])
@@ -2955,7 +2955,7 @@ foobar:'
 ;;
 esac
 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
- [elf,2,13,0],, [$conftest_s])
+ , [$conftest_s])
 case "${target}" in
   *-*-darwin*)
 # Darwin as has some visibility support, though with a different syntax.
@@ -3174,7 +3174,7 @@ gcc_AC_INITFINI_ARRAY
 # Older versions of GAS and some non-GNU assemblers, have a bugs handling
 # these directives, even when they appear to accept them.
 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
- [elf,2,11,0],,
+ ,
 [  .data
.uleb128 L2 - L1
 L1:
@@ -3213,7 +3213,7 @@ gcc_fn_eh_frame_ro () {
 
 # Check if we have assembler support for unwind directives.
 gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
-  ,,
+  ,
 [  .text
.cfi_startproc
.cfi_offset 0, 0
@@ -3269,7 +3269,7 @@ gcc_GAS_CHECK_FEATURE([cfi directives], 
gcc_cv_as_cfi_directive,
 esac])
 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
 gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
-  ,,
+  ,
 [  .text
.cfi_startproc
.cfi_adjust_cfa_offset 64
@@ -3294,7 +3294,7 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
 
 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
 gcc_GAS_CHECK_FEATURE([cfi personality directive],
-  gcc_cv_as_cfi_personality_directive, ,,
+  gcc_cv_as_cfi_personality_directive,,
 [  .text
.cfi_startproc

[PATCH 1/4] configure: drop version checks for in-tree gas [PR91602]

2021-07-21 Thread Serge Belyshev
configure: drop version checks for in-tree gas [PR91602]

gcc/ChangeLog:

PR build/91602
* acinclude.m4 (_gcc_COMPUTE_GAS_VERSION, _gcc_GAS_VERSION_GTE_IFELSE)
(gcc_GAS_VERSION_GTE_IFELSE): Remove.
(gcc_GAS_CHECK_FEATURE): Do not handle in-tree case specially.
* configure.ac: Remove gcc_cv_gas_major_version, 
gcc_cv_gas_minor_version.
Remove remaining checks for in-tree assembler.
* configure: Regenerate.
---
 gcc/acinclude.m4 |  66 +---
 gcc/configure| 414 +++
 gcc/configure.ac |  26 +--
 3 files changed, 61 insertions(+), 445 deletions(-)

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index f9f6a07b040..e038990cca6 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -442,63 +442,6 @@ AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY_SUPPORT,
   [Define 0/1 if .init_array/.fini_array sections are available and working.])
 ])
 
-dnl # _gcc_COMPUTE_GAS_VERSION
-dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
-dnl #
-dnl # WARNING:
-dnl # gcc_cv_as_gas_srcdir must be defined before this.
-dnl # This gross requirement will go away eventually.
-AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
-[gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
-for f in $gcc_cv_as_bfd_srcdir/configure \
- $gcc_cv_as_gas_srcdir/configure \
- $gcc_cv_as_gas_srcdir/configure.ac \
- $gcc_cv_as_gas_srcdir/Makefile.in ; do
-  gcc_cv_gas_version=`sed -n -e 's/^[[ 
]]*VERSION=[[^0-9A-Za-z_]]*\([[0-9]]*\.[[0-9]]*.*\)/VERSION=\1/p' < $f`
-  if test x$gcc_cv_gas_version != x; then
-break
-  fi
-done
-case $gcc_cv_gas_version in
-  VERSION=[[0-9]]*) ;;
-  *) AC_MSG_ERROR([[cannot find version of in-tree assembler]]);;
-esac
-gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
-gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : 
"VERSION=[[0-9]]*\.\([[0-9]]*\)"`
-gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : 
"VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
-case $gcc_cv_gas_patch_version in
-  "") gcc_cv_gas_patch_version="0" ;;
-esac
-gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
-   + $gcc_cv_gas_minor_version \) \* 1000 \
-   + $gcc_cv_gas_patch_version`
-]) []dnl # _gcc_COMPUTE_GAS_VERSION
-
-dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
-dnl # [command_if_true = :], [command_if_false = :])
-dnl # Check to see if the version of GAS is greater than or
-dnl # equal to the specified version.
-dnl #
-dnl # The first ifelse() shortens the shell code if the patchlevel
-dnl # is unimportant (the usual case).  The others handle missing
-dnl # commands.  Note that the tests are structured so that the most
-dnl # common version number cases are tested first.
-AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
-[ifelse([$1], elf,
- [if test $in_tree_gas_is_elf = yes \
-  &&],
- [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + 
$4`
-  then dnl
-ifelse([$5],,:,[$5])[]dnl
-ifelse([$6],,,[
-  else $6])
-fi])
-
-AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
-[AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
-ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
-  [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
-
 dnl # gcc_GAS_FLAGS
 dnl # Used by gcc_GAS_CHECK_FEATURE 
 dnl #
@@ -531,9 +474,7 @@ dnl gcc_GAS_CHECK_FEATURE(description, cv, 
[[elf,]major,minor,patchlevel],
 dnl [extra switches to as], [assembler input],
 dnl [extra testing logic], [command if feature available])
 dnl
-dnl Checks for an assembler feature.  If we are building an in-tree
-dnl gas, the feature is available if the associated assembler version
-dnl is greater than or equal to major.minor.patchlevel.  If not, then
+dnl Checks for an assembler feature.
 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
 dnl if assembly succeeds.  If EXTRA TESTING LOGIC is not the empty string,
 dnl then it is run instead of simply setting CV to "yes" - it is responsible
@@ -542,10 +483,7 @@ AC_DEFUN([gcc_GAS_CHECK_FEATURE],
 [AC_REQUIRE([gcc_GAS_FLAGS])dnl
 AC_CACHE_CHECK([assembler for $1], [$2],
  [[$2]=no
-  ifelse([$3],,,[dnl
-  if test $in_tree_gas = yes; then
-gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
-  el])if test x$gcc_cv_as != x; then
+  if test x$gcc_cv_as != x; then
 AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
 if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s 
>_MESSAGE_LOG_FD])
 then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 26da07325e7..c6e0bfdde90 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2556,8 +2556,6 @@ AC_SUBST(enable_fast_install)
 # If build != host, and we aren't building gas in-tree, we identify a
 # build->target assembler and hope that it will have the same features
 # as the host->target assembler we'll be using.
-gcc_cv_gas_major_version=
-gcc_cv_gas_minor_version=
 

[PATCH 0/4] drop version checks for in-tree gas [PR91602]

2021-07-21 Thread Serge Belyshev
Special-casing checks for in-tree gas features is unnecessary since
r17 which made configure-gcc depend on all-gas, and thus making
alternate code path in gcc_GAS_CHECK_FEATURE for in-tree gas
redundant.

Along the way this fixes PR 91602, which is caused by incorrect guess
of leb128 support presense in RISC-V.

First patch removes alternate code path in gcc_GAS_CHECK_FEATURE and
related code, the rest are further cleanups.  Patches 2 and 3 in
series make no functional changes, thus configure is unchanged.

Bootstrapped/regtested on x86_64-pc-linux-gnu, riscv64-unknown-linux-gnu,
sparc-sun-solaris2.11 and powerpc-ibm-aix7.{1.5.0,2.4.0}, with and without
in-tree binutils (except on aix where combined tree does not appear to work
due to dynamic linker peculiarity).

OK for mainline ?

Serge Belyshev (4):
  configure: drop version checks for in-tree gas [PR91602]
  configure: remove version argument from gcc_GAS_CHECK_FEATURE
  configure: fixup formatting from previous change
  configure: remove gas versions from tls check

 gcc/acinclude.m4 |  82 +---
 gcc/configure| 472 ++-
 gcc/configure.ac | 335 -
 3 files changed, 188 insertions(+), 701 deletions(-)



[PATCH v3] gcc_update: use human readable name for revision string in gcc/REVISION

2021-07-19 Thread Serge Belyshev


>> > On 19 Jul 2021, at 11:39, Richard Biener via Gcc-patches 
>> >  wrote:
>> > 
>> > On Fri, Jul 16, 2021 at 12:37 PM Serge Belyshev
>> >  wrote:
>> >> 
>> >> Based on discussion I've chosen open-coded version without commit hash.
>> > 
>> > As said I'd prefer one with (shortened) hash,

Oh, I misunderstood then.

>> 
>> Likewise, I’ve been using a local change to produce “r12-2447-gcca1e30db142” 
>>  since soon after
>> change; I suspect that 12 digits is ‘enough’.  It makes it easier for the 
>> folks who want to find by 
>> SHA1 as well as folks who want to find by revision number.
>
> If the patch is changed from
>   revision=$r;
> to
>   revision=${r}-g${revision};
> then the exact hash length isn't hardcoded to 12 digits, but whatever git
> chooses to make it unique (with the current state of repository).
> Of course, changes later on in the repository can introduce collisions and
> more hash letters might be needed, but that is a general git problem.  And
> at least when we have the rXX--gZ revisions, it is still unique
> on the release branches, just one might need to use
> $(git gcc-descr `echo $rev | sed 's/-g[0-9a-f]*$//'`)
> instead of just
> $rev
> in case such collision happens if git tells rXX--g is ambiguous.
>

Right, variant with hash has the advantage that it is understood by git
out of the box without customisations, so be it then.

OK for mainline?

---
contrib/Changelog:

* gcc_update: derive human readable name for HEAD using git describe
like "git gcc-descr" with short commit hash.  Drop "revision" from 
gcc/REVISION.
---
 contrib/gcc_update | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/contrib/gcc_update b/contrib/gcc_update
index 80fac9fc995..ce472545e25 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -332,7 +332,22 @@ case $vcs_type in
 exit 1
fi
 
-   revision=`$GCC_GIT log -n1 --pretty=tformat:%p:%t:%H`
+   # Open-coded version of "git gcc-descr" from 
contrib/gcc-git-customization.sh
+   revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
+   r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
+  | sed -n 
's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;
+   if test -n $r; then
+   o=`$GCC_GIT config --get gcc-config.upstream`;
+   rr=`echo $r | sed -n 
's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'`;
+   if $GCC_GIT rev-parse --verify --quiet 
${o:-origin}/releases/gcc-$rr >/dev/null; then
+   m=releases/gcc-$rr;
+   else
+   m=master;
+   fi;
+   if $GCC_GIT merge-base --is-ancestor HEAD ${o:-origin}/$m; then
+   revision=${r}-g${revision};
+   fi
+   fi
branch=`$GCC_GIT name-rev --name-only HEAD || :`
;;
 
@@ -414,6 +429,6 @@ rm -f LAST_UPDATED gcc/REVISION
 date
 echo "`TZ=UTC date` (revision $revision)"
 } > LAST_UPDATED
-echo "[$branch revision $revision]" > gcc/REVISION
+echo "[$branch $revision]" > gcc/REVISION
 
 touch_files_reexec


[PATCH v2] gcc_update: use human readable name for revision string in gcc/REVISION

2021-07-16 Thread Serge Belyshev
Based on discussion I've chosen open-coded version without commit hash.

>> > > ...  Perhaps rename the r, o, rr and m temporaries.

I like it better with short names, there is no other code in that
script to clash with.  (Also, two adjacent case branches for hg and svn
are essentialy dead now).

>> ...  Perhaps also replace both HEAD occurences with $revision

not sure about that: should not they be exactly equivalent in all cases?

---
gcc_update: use human readable name for revision string in gcc/REVISION

contrib/Changelog:

* gcc_update: derive human readable name for HEAD using git describe
like "git gcc-descr" does.  Drop "revision" from gcc/REVISION.
---
 contrib/gcc_update | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/contrib/gcc_update b/contrib/gcc_update
index 80fac9fc995..558926b3a2d 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -332,7 +332,22 @@ case $vcs_type in
 exit 1
fi
 
-   revision=`$GCC_GIT log -n1 --pretty=tformat:%p:%t:%H`
+   # Open-coded version of "git gcc-descr" from 
contrib/gcc-git-customization.sh
+   revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
+   r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
+  | sed -n 
's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;
+   if test -n $r; then
+   o=`$GCC_GIT config --get gcc-config.upstream`;
+   rr=`echo $r | sed -n 
's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'`;
+   if $GCC_GIT rev-parse --verify --quiet 
${o:-origin}/releases/gcc-$rr >/dev/null; then
+   m=releases/gcc-$rr;
+   else
+   m=master;
+   fi;
+   if $GCC_GIT merge-base --is-ancestor HEAD ${o:-origin}/$m; then
+   revision=$r;
+   fi
+   fi
branch=`$GCC_GIT name-rev --name-only HEAD || :`
;;
 
@@ -414,6 +429,6 @@ rm -f LAST_UPDATED gcc/REVISION
 date
 echo "`TZ=UTC date` (revision $revision)"
 } > LAST_UPDATED
-echo "[$branch revision $revision]" > gcc/REVISION
+echo "[$branch $revision]" > gcc/REVISION
 
 touch_files_reexec


[PATCH] gcc_update: use gcc-descr git alias for revision string in gcc/REVISION

2021-07-15 Thread Serge Belyshev
This is to make development version string more readable, and
to simplify navigation through gcc-testresults.

Currently gcc_update uses git log --pretty=tformat:%p:%t:%H to
generate version string, which is somewhat excessive since conversion
to git because commit hashes are now stable.

Even better, gcc-git-customization.sh script provides gcc-descr alias
which makes prettier version string, and thus use it instead (or just
abbreviated commit hash when the alias is not available).

Before: [master revision 
b25edf6e6fe:e035f180ebf:7094a69bd62a14dfa311eaa2fea468f221c7c9f3]
After: [master r12-2331]

OK for mainline?

contrib/Changelog:

* gcc_update: Use gcc-descr alias for revision string if it exists, or
abbreviated commit hash instead. Drop "revision" from gcc/REVISION.
---
 contrib/gcc_update | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/gcc_update b/contrib/gcc_update
index 80fac9fc995..8f712e37616 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -332,7 +332,7 @@ case $vcs_type in
 exit 1
fi
 
-   revision=`$GCC_GIT log -n1 --pretty=tformat:%p:%t:%H`
+   revision=`$GCC_GIT gcc-descr || $GCC_GIT log -n1 --pretty=tformat:%h`
branch=`$GCC_GIT name-rev --name-only HEAD || :`
;;
 
@@ -414,6 +414,6 @@ rm -f LAST_UPDATED gcc/REVISION
 date
 echo "`TZ=UTC date` (revision $revision)"
 } > LAST_UPDATED
-echo "[$branch revision $revision]" > gcc/REVISION
+echo "[$branch $revision]" > gcc/REVISION
 
 touch_files_reexec


[PATCH] Add --enable-first-stage-cross configure option

2021-07-15 Thread Serge Belyshev
Add --enable-first-stage-cross configure option

Build static-only, C-only compiler that is sufficient to cross compile
glibc.  This option disables various runtime libraries that require
libc to compile, turns on --with-newlib, --without-headers,
--disable-decimal-float, --disable-shared, --disable-threads, and sets
--enable-languages=c.

Rationale: current way of building first stage compiler of a cross
toolchain requires specifying a list of target libraries that are not
going to be compiled due to their dependency on target libc.  This
list is not documented in gccinstall.texi and sometimes changes.  To
simplify the procedure, it is better to maintain that list in the GCC
itself.

Usage example as a patch to glibc's scripts/build-many-libcs.py:

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 580d25e8ee..3a6a7be76b 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1446,17 +1446,7 @@ class Config(object):
 # required to define inhibit_libc (to stop some parts of
 # libgcc including libc headers); --without-headers is not
 # sufficient.
-cfg_opts += ['--enable-languages=c', '--disable-shared',
- '--disable-threads',
- '--disable-libatomic',
- '--disable-decimal-float',
- '--disable-libffi',
- '--disable-libgomp',
- '--disable-libitm',
- '--disable-libmpx',
- '--disable-libquadmath',
- '--disable-libsanitizer',
- '--without-headers', '--with-newlib',
+cfg_opts += ['--enable-first-stage-cross',
  '--with-glibc-version=%s' % self.ctx.glibc_version
  ]
 cfg_opts += self.first_gcc_cfg


Bootstrapped/regtested on x86_64-pc-linux-gnu, and
tested with build-many-glibcs.py with the above patch.

OK for mainline?


ChangeLog:

* configure.ac: Add --enable-first-stage-cross.
* configure: Regenerate.

gcc/ChangeLog:

* doc/install.texi: Document --enable-first-stage-cross.
---
 configure| 20 
 configure.ac | 15 +++
 gcc/doc/install.texi |  7 +++
 3 files changed, 42 insertions(+)

diff --git a/configure b/configure
index 85ab9915402..df59036e258 100755
--- a/configure
+++ b/configure
@@ -787,6 +787,7 @@ ac_user_opts='
 enable_option_checking
 with_build_libsubdir
 with_system_zlib
+enable_first_stage_cross
 enable_as_accelerator_for
 enable_offload_targets
 enable_offload_defaulted
@@ -1514,6 +1515,9 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE   do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-first-stage-cross
+  Build a static-only compiler that is sufficient to
+  build glibc.
   --enable-as-accelerator-for=ARG
   build as offload target compiler. Specify offload
   host triple by ARG
@@ -2961,6 +2965,22 @@ case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
 esac
 
+# Check whether --enable-first-stage-cross was given.
+if test "${enable_first_stage_cross+set}" = set; then :
+  enableval=$enable_first_stage_cross; ENABLE_FIRST_STAGE_CROSS=$enableval
+else
+  ENABLE_FIRST_STAGE_CROSS=no
+fi
+
+case "${ENABLE_FIRST_STAGE_CROSS}" in
+  yes)
+noconfigdirs="$noconfigdirs target-libatomic target-libquadmath 
target-libgomp target-libssp"
+host_configargs="$host_configargs --disable-shared --disable-threads 
--disable-decimal-float --without-headers --with-newlib"
+target_configargs="$target_configargs --disable-shared"
+enable_languages=c
+;;
+esac
+
 # If both --with-headers and --with-libs are specified, default to
 # --without-newlib.
 if test x"${with_headers}" != x && test x"${with_headers}" != xno \
diff --git a/configure.ac b/configure.ac
index 1df038b04f3..53f920c1a2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,6 +268,21 @@ case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
 esac
 
+AC_ARG_ENABLE(first-stage-cross,
+[AS_HELP_STRING([--enable-first-stage-cross],
+   [Build a static-only compiler that is
+   sufficient to build glibc.])],
+ENABLE_FIRST_STAGE_CROSS=$enableval,
+ENABLE_FIRST_STAGE_CROSS=no)
+case "${ENABLE_FIRST_STAGE_CROSS}" in
+  yes)
+noconfigdirs="$noconfigdirs target-libatomic target-libquadmath 
target-libgomp target-libssp"
+host_configargs="$host_configargs --disable-shared --disable-threads 
--disable-decimal-float --without-headers --with-newlib"
+target_configargs="$target_configargs --disable-shared"
+enable_languages=c
+;;
+esac
+
 # 

[COMMITTED] MAINTAINERS: Add myself for write after approval

2021-05-17 Thread Serge Belyshev via Gcc-patches
2021-05-17  Serge Belyshev  

* MAINTAINERS (Write After Approval): Add myself.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 5b10f212ce8..fbaa183cea4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -317,6 +317,7 @@ Gergö Barany

 Charles Baylis 
 Tejas Belagod  
 Matthew Beliveau   
+Serge Belyshev 
 Jon Beniston   
 Andrew Bennett 
 Andrew Benson  


Re: gcc 11.1.0 mpfr

2021-05-11 Thread Serge Belyshev via Gcc


> $ egrep "mpfr\.h" log/cfg/cfg.gcc-11.1.0.log 
> checking for the correct version of mpfr.h... buggy but acceptable
>
> It appears "gcc-11.1.0/contrib/download_prerequisites"  
> specifies "mpfr-3.1.4.tar.bz2" whereas top level 'configure' 
> has "MPFR_VERSION_NUM(3,1,6)".
>
> Is there a reason mpfr 3.1.6 isn't being used?

No good reason: that script was not updated with new versions. GCC-11 is
also known to work fine with the most recent mpfr version 4.1.0.


Re: Bootstrap failure in stage 2 on i386.c

2016-11-22 Thread Serge Belyshev
> My builds for the last couple of days have all been failing in stage 2
> like so:
>
> /home/arth/src/gcc/gcc/config/i386/i386.c: In function ‘rtx_def* 
> ix86_expand_bui
> ltin(tree, rtx, rtx, machine_mode, int)’:
> /home/arth/src/gcc/gcc/config/i386/i386.c:38407:18: error: ‘fcn’ may be used 
> uni
> nitialized in this function [-Werror=maybe-uninitialized]
> emit_insn (fcn (target, accum, wide_reg, mem));
> ~~^~~~
>
> Anyone else seeing this?

I'm seeing it too. The code is new, but the 'may be used unitialized'
warning itself is, probably, an instance of the old PR36550.

I have reduced this testcase to:

//
/* { dg-do compile } */
/* { dg-options "-O2 -Wuninitialized" } */

int force_reg (int, int);
int expand_expr_real (int, int);
void f (int);

void ix86_expand_builtin (int fcode, int pmode)
{
  int fcn;
  int i, addr, masked = 1;

  switch (fcode)
{
case 1:
  fcn = 1;
  masked = 0;
  goto s4fma_expand;

case 2:
  fcn = 2;
  masked = 0;
  goto s4fma_expand;

case 4:
  {
  s4fma_expand:
for (i = 0; i < 4; i++)
  expand_expr_real (0, 0);

addr = expand_expr_real (0, 0);
force_reg ((pmode ? 0 : 2), addr);

if (! masked)
  f (fcn);
  }
}
}
//

It fails with every gcc version down to 3.2 (the oldest one I could
compile on my amd64 box).  Note that this testcase is particularly
flaky: recent gccs will not issue a warning if one, for example, changes
the '2' to '1' in the force_reg() call.


Re: i386: load-operate-store-test

2011-04-02 Thread Serge Belyshev
Andrew Pinski pins...@gmail.com writes:

 On Fri, Apr 1, 2011 at 8:57 PM, Alex cirru...@uol.com.br wrote:
  If I understood correct, gcc could replace insns 5, 7, 8 and 9 by the insn
 defined as *andmode_2, but it seems combine did not tried that.

 Yes you missed that combine in GCC only acts on 3 insns at a time.
 Though that has changed in GCC 4.6 and above so try to look see if the
 trunk does this optimization.

FYI, gcc-2.95.4 with -O3 -fomit-frame-pointer -march=pentiumpro generates
the following:

func1:
movl a,%eax
andl b,%eax
movl %eax,a
je .L3
movl d,%eax
movl %eax,c
.L3:
ret


Re: Status of the DLX backend for GCC?

2007-12-30 Thread Serge Belyshev
[EMAIL PROTECTED] writes:

 Over the previous years, I had downloaded and used both a really archaic
 gcc-1.09 DLX backend as well as the one you refer too. They are both in a sad
 state of affairs, but the gcc-2.7.2.1 (AFAICR) was usable.


Offtopic: if you still have such an old gcc-1.09 (?) release around, please make
it available so it can be uploaded here: 
ftp://sourceware.org/pub/gcc/old-releases/


Re: libgfortran, libgomp not compiled with BOOT_CFLAGS.

2007-12-16 Thread Serge Belyshev
Toon Moene [EMAIL PROTECTED] writes:

 L.S.,

 Recently, I've begun to bootstrap with make BOOT_CFLAGS=flags,
 basically to get the run time libraries (libgfortran, libgomp)
 compiled with -mcpu=native -mtune=native (the speed of the compiler
 doesn't interest me that much).

 However, I see that almost everything is compiled with -mcpu=native
 -mtune=native, *except* the run time libraries ...

 Is that because they're target libraries - if so, how would one get
 them compiled optimally if not building a cross-compiler ?
Yeah, try adding appropriate FCFLAGS into environment.

Also CXXFLAGS, GCJFLAGS affect some of resulting binaries or libraries
when bootstrapping, and CFLAGS (don't remember about this one for sure).


Re: Bootstrap broken - treelang: error: 'treelang_expand_function' defined but not used

2007-09-12 Thread Serge Belyshev
Andreas Jaeger [EMAIL PROTECTED] writes:

 bootstrap with current svn head fails for me on Linux/x86-64:
...
 cc1: warnings being treated as errors
 /cvs/gcc-svn/trunk/gcc/treelang/treetree.c:1191: error: 
 ‘treelang_expand_function’ defined but not used
 make[3]: *** [treelang/treetree.o] Error 1

 Any ideas?

Just remove that function, it is not used anymore.


Re: GCC 4.2.0 Status Report (2007-05-11)

2007-05-14 Thread Serge Belyshev
Richard Guenther [EMAIL PROTECTED] writes:

 It was a patch to enable more optimization.  Reverting it should be as safe
 or unsafe as exchanging forwprop and dce passes.  And I have no idea
 as how to quantify safeness of either ;)

 I'd say we better analyze what goes wrong (as the problem is possibly
 latent on the mainline) and fix it properly.  If we paper over it we will not
 fix it at all.


I vote for reverting that change (r111639) on the branch before release.
We would gain nothing by having bug 30252, however latent,
uncovered in a released compiler.


Re: spec2k comparison of gcc 4.1 and 4.2 on AMD K8

2007-02-25 Thread Serge Belyshev
Vladimir N. Makarov [EMAIL PROTECTED] writes:

 I run SPEC2000 several times per week and always look at 3 runs (to be
 sure that is nothing wrong happened) but I never saw such big
 confidence intervals (as I understand that is difference between max
 and min of 3 runs divided by the score). [...]

No, it is much more complex than that, I've used generally accepted
definition of a confidence interval, see 
http://en.wikipedia.org/wiki/Confidence_interval
which basically tells that with 95% probabilty (the confidence level I've 
choosed)
true value lies in this interval.

I've used conservative estimate of confidence intervals in this case
because I didn't assume gaussian distribution of numbers which I
reported as difference between two run times, and this estimate is somewhat
bigger than difference between max and min of 3 runs :)

 [...] If the machine has only 512 Mb memory (even they
 write that it is enough for SPEC2000), the scores for some benchmark
 programs may be unstable.  [...]

My box is equipped with 2Gigs of RAM so I believe this is not the case,
Also the computer was *absolutely* idle when it was running spec2k.
(booted with init=/bin/sh and no other processes were running).

And no,
 [...] acknowledge that I never ran SPEC2000 on AMD machines and some
 processors generates less confident intervals. [...]
this is not the case, I'm absolutely sure.


spec2k comparison of gcc 4.1 and 4.2 on AMD K8

2007-02-24 Thread Serge Belyshev
I have compared 4.1.2 release (r121943) with three revisions of 4.2 on spec2k
on an 2GHz AMD Athlon64 box (in 64bit mode), detailed results are below.

In short, current 4.2 performs just as good as 4.1 on this target
with the exception of huge 80% win on 178.galgel. All other difference
lies almost in the noise.

results:

first number in each column is a runtime difference in %
between corresponding 4.2 revision and 4.1.2 (+ is better, - is worse).

second number is a +- confidence interval, i.e. according to my results,
current 4.2 does (82.0+-1.7)% better than 4.1.2 on 178.galgel.

(note some results are clearly noisy, but I've tried hard to avoid this --
I did three runs on a completely idle machine, wasting 14 hours of machine time 
in total).

r117890 -- 4.2 just before DannyB's aliasing fixes
r117891 -- 4.2 with aliasing fixes.
r122236 -- 4.2 current.

CINT2000 r117890 r117891 r122236

164.gzip-4.2 1.7-4.2 1.2-4.0 1.3
175.vpr  1.7 2.6 1.4 2.3 1.1 2.5
176.gcc -0.5 0.8-0.8 1.1-1.2 4.0
181.mcf -0.4 2.0-0.1 2.1-0.6 2.7
186.crafty  -0.4 6.4-1.3 7.0 0.8 4.4
197.parser   0.7 1.3 0.8 1.5-0.3 1.6
252.eon  8.8 3.710.6 9.4 6.9 4.7
253.perlbmk  2.7 1.0 3.4 1.4 3.0 1.9
254.gap -0.6 0.5-0.5 0.4-0.4 0.6
255.vortex   1.3 0.9 1.2 1.2 1.4 1.1
256.bzip20.6 1.6 0.9 1.6 0.4 1.7
300.twolf0.1 4.5 0.8 1.4-0.6 2.0


CFP2000

168.wupwise  0.2 22.00.1 22.12.2 13.6
171.swim-0.1 0.7-0.3 0.1-0.3 0.2
172.mgrid   -6.3 0.4-6.1 0.4-6.6 0.3
173.applu   -0.1 0.8 0.1 0.9-0.4 0.1
177.mesa 6.9 15.17.2 15.13.9 5.3
178.galgel  80.8 1.780.9 2.082.0 1.7
179.art  0.8 8.9-1.6 8.1-0.3 5.1
183.equake  -0.9 1.0-0.8 0.9-0.9 0.9
187.facerec  2.7 0.7 2.9 0.8 3.0 0.6
188.ammp-0.4 0.5-0.1 1.0-0.5 0.7
189.lucas   -0.8 0.5-0.7 0.6-0.4 0.6
191.fma3d1.1 2.1-0.9 2.3-1.0 2.2
200.sixtrack-0.7 0.4-0.7 0.5-1.3 0.4
301.apsi-3.0 1.4-2.7 1.1-3.1 0.3


remarks:

1. big jump on 178.galgel can be seen here too:
   http://www.suse.de/~aj/SPEC/amd64/CFP/sandbox-britten/178_galgel_big.png

2. even though I did three runs, most of the difference is noise,
   which means that one should treat single-run spec results with a *big* grain 
of salt.

3. on this AMD K8 machine the difference between 4.2 with aliasing fixes and 
4.2 w/o
   aliasing fixes lies completely in the noise (modulo small 2% 191.fma3d 
regression).


Re: Call for help: when can compare_and_jump_seq produce sequences with control flow insns?

2007-02-20 Thread Serge Belyshev
Steven Bosscher [EMAIL PROTECTED] writes:

 Hello,

...[snip]
 So I'm looking for help here: Who can help me find a test case to trigger
 a verify_flow_info ICE in GCC with the above patch applied?  Can people
 try this patch on their favorite target, and see if they can trigger a
 test suite failure?


I've successfully bootstrapped r122139, all languages (including ada but 
excluding java)
on alphaev56-unknown-linux-gnu with BOOT_CFLAGS=-O2 -funroll-loops.


Re: [PATCH for] Re: gcc-4.0-20070128 is now available

2007-01-30 Thread Serge Belyshev
Gabriel Dos Reis [EMAIL PROTECTED] writes:

 Gerald Pfeifer [EMAIL PROTECTED] writes:

 | On Sun, 28 Jan 2007, Joe Buck wrote:
 |  It's probably time to turn off 4.0 snapshots; the last ones will
 |  probably be Gaby's prerelease snapshots, and the release should come
 |  soon.
 | 
 | That's a good idea.  You're right, there is no need to wait until
 | the 4.0.4 release itself.

 completely agreed.

 -- Gaby

Also, don't forget to remove gcc-4.0 from ~gccadmin/scripts/update_version*