Skip to content
Snippets Groups Projects
  1. Jan 14, 2024
  2. Jan 13, 2024
    • Jakub Jelinek's avatar
      c++, demangle: Implement https://github.com/itanium-cxx-abi/cxx-abi/issues/148 non-proposal · 65388b28
      Jakub Jelinek authored
      The following patch attempts to implement what apparently clang++
      implemented for explicit object member function mangling, but nobody
      actually proposed in patch form in
      https://github.com/itanium-cxx-abi/cxx-abi/issues/148
      
      2024-01-13  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/cp/
      	* mangle.cc (write_nested_name): Mangle explicit object
      	member functions with H as per
      	https://github.com/itanium-cxx-abi/cxx-abi/issues/148 non-proposal.
      gcc/testsuite/
      	* g++.dg/abi/mangle79.C: New test.
      include/
      	* demangle.h (enum demangle_component_type): Add
      	DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION.
      libiberty/
      	* cp-demangle.c (FNQUAL_COMPONENT_CASE): Add case for
      	DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION.
      	(d_dump): Handle DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION.
      	(d_nested_name): Parse H after N in nested name.
      	(d_count_templates_scopes): Handle
      	DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION.
      	(d_print_mod): Likewise.
      	(d_print_function_type): Likewise.
      	* testsuite/demangle-expected: Add tests for explicit object
      	member functions.
      65388b28
  3. Jan 03, 2024
  4. Dec 06, 2023
  5. Dec 05, 2023
    • Jakub Jelinek's avatar
      libiberty: Fix build with GCC < 7 · c73cc6fe
      Jakub Jelinek authored
      Tobias reported on IRC that the linker fails to build with GCC 4.8.5.
      In configure I've tried to use everything actually used in the sha1.c
      x86 hw implementation, but unfortunately I forgot about implicit function
      declarations.  GCC before 7 did have <cpuid.h> header and bit_SHA define
      and __get_cpuid function defined inline, but it didn't define
      __get_cpuid_count, which compiled fine (and the configure test is
      intentionally compile time only) due to implicit function declaration,
      but then failed to link when linking the linker, because
      __get_cpuid_count wasn't defined anywhere.
      
      The following patch fixes that by using what autoconf uses in AC_CHECK_DECL
      to make sure the functions are declared.
      
      2023-12-05  Jakub Jelinek  <jakub@redhat.com>
      
      	* configure.ac (HAVE_X86_SHA1_HW_SUPPORT): Verify __get_cpuid and
      	__get_cpuid_count are not implicitly declared.
      	* configure: Regenerated.
      c73cc6fe
    • Rainer Orth's avatar
      libiberty: Fix pex_unix_wait return type · 691858d2
      Rainer Orth authored
      The recent warning patches broke Solaris bootstrap:
      
      /vol/gcc/src/hg/master/local/libiberty/pex-unix.c:326:3: error: initialization of 'pid_t (*)(struct pex_obj *, pid_t,  int *, struct pex_time *, int,  const char **, int *)' {aka 'long int (*)(struct pex_obj *, long int,  int *, struct pex_time *, int,  const char **, int *)'} from incompatible pointer type 'int (*)(struct pex_obj *, pid_t,  int *, struct pex_time *, int,  const char **, int *)' {aka 'int (*)(struct pex_obj *, long int,  int *, struct pex_time *, int,  const char **, int *)'} [-Wincompatible-pointer-types]
        326 |   pex_unix_wait,
            |   ^~~~~~~~~~~~~
      /vol/gcc/src/hg/master/local/libiberty/pex-unix.c:326:3: note: (near initialization for 'funcs.wait')
      
      While pex_funcs.wait expects a function returning pid_t, pex_unix_wait
      currently returns int.  However, on Solaris pid_t is long for 32-bit,
      but int for 64-bit.
      
      This patches fixes this by having pex_unix_wait return pid_t as
      expected, and like every other variant already does.
      
      Bootstrapped without regressions on i386-pc-solaris2.11,
      sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and
      x86_64-apple-darwin23.1.0.
      
      2023-12-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	libiberty:
      	* pex-unix.c (pex_unix_wait): Change return type to pid_t.
      691858d2
  6. Dec 02, 2023
  7. Dec 01, 2023
    • Jason Merrill's avatar
      c++: mangle function template constraints · c3f281a0
      Jason Merrill authored
      Per https://github.com/itanium-cxx-abi/cxx-abi/issues/24 and
      https://github.com/itanium-cxx-abi/cxx-abi/pull/166
      
      We need to mangle constraints to be able to distinguish between function
      templates that only differ in constraints.  From the latter link, we want to
      use the template parameter mangling previously specified for lambdas to also
      make explicit the form of a template parameter where the argument is not a
      "natural" fit for it, such as when the parameter is constrained or deduced.
      
      I'm concerned about how the latter link changes the mangling for some C++98
      and C++11 patterns, so I've limited template_parm_natural_p to avoid two
      cases found by running the testsuite with -Wabi forced on:
      
      template <class T, T V> T f() { return V; }
      int main() { return f<int,42>(); }
      
      template <int i> int max() { return i; }
      template <int i, int j, int... rest> int max()
      {
        int sub = max<j, rest...>();
        return i > sub ? i : sub;
      }
      int main() {  return max<1,2,3>(); }
      
      A third C++11 pattern is changed by this patch:
      
      template <template <typename...> class TT, typename... Ts> TT<Ts...> f();
      template <typename> struct A { };
      int main() { f<A,int>(); }
      
      I aim to resolve these with the ABI committee before GCC 14.1.
      
      We also need to resolve https://github.com/itanium-cxx-abi/cxx-abi/issues/38
      (mangling references to dependent template-ids where the name is fully
      resolved) as references to concepts in std:: will consistently run into this
      area.  This is why mangle-concepts1.C only refers to concepts in the global
      namespace so far.
      
      The library changes are to avoid trying to mangle builtins, which fails.
      
      Demangler support and test coverage is not complete yet.
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (TEMPLATE_ARGS_TYPE_CONSTRAINT_P): New.
      	(get_concept_check_template): Declare.
      	* constraint.cc (combine_constraint_expressions)
      	(finish_shorthand_constraint): Use UNKNOWN_LOCATION.
      	* pt.cc (convert_generic_types_to_packs): Likewise.
      	* mangle.cc (write_constraint_expression)
      	(write_tparms_constraints, write_type_constraint)
      	(template_parm_natural_p, write_requirement)
      	(write_requires_expr): New.
      	(write_encoding): Mangle trailing requires-clause.
      	(write_name): Pass parms to write_template_args.
      	(write_template_param_decl): Factor out from...
      	(write_closure_template_head): ...here.
      	(write_template_args): Mangle non-natural parms
      	and requires-clause.
      	(write_expression): Handle REQUIRES_EXPR.
      
      include/ChangeLog:
      
      	* demangle.h (enum demangle_component_type): Add
      	DEMANGLE_COMPONENT_CONSTRAINTS.
      
      libiberty/ChangeLog:
      
      	* cp-demangle.c (d_make_comp): Handle
      	DEMANGLE_COMPONENT_CONSTRAINTS.
      	(d_count_templates_scopes): Likewise.
      	(d_print_comp_inner): Likewise.
      	(d_maybe_constraints): New.
      	(d_encoding, d_template_args_1): Call it.
      	(d_parmlist): Handle 'Q'.
      	* testsuite/demangle-expected: Add some constraint tests.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/bit: Avoid builtins in requires-clauses.
      	* include/std/variant: Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/abi/mangle10.C: Disable compat aliases.
      	* g++.dg/abi/mangle52.C: Specify ABI 18.
      	* g++.dg/cpp2a/class-deduction-alias3.C
      	* g++.dg/cpp2a/class-deduction-alias8.C:
      	Avoid builtins in requires-clauses.
      	* g++.dg/abi/mangle-concepts1.C: New test.
      	* g++.dg/abi/mangle-ttp1.C: New test.
      c3f281a0
    • GCC Administrator's avatar
      Daily bump. · 8428bcd7
      GCC Administrator authored
      8428bcd7
  8. Nov 30, 2023
    • Rainer Orth's avatar
      libiberty: Disable hwcaps for sha1.o · f2c52c0d
      Rainer Orth authored
      This patch
      
      commit bf4f40cc
      Author: Jakub Jelinek <jakub@redhat.com>
      Date:   Tue Nov 28 13:14:05 2023 +0100
      
          libiberty: Use x86 HW optimized sha1
      
      broke Solaris/x86 bootstrap with the native as:
      
      libtool: compile:  /var/gcc/regression/master/11.4-gcc/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=internal/goarch /vol/gcc/src/hg/master/local/libgo/go/internal/goarch/goarch.go zgoarch.go
      ld.so.1: go1: fatal: /var/gcc/regression/master/11.4-gcc/build/gcc/go1: hardware capability (CA_SUNW_HW_2) unsupported: 0x4000000  [ SHA1 ]
      gccgo: fatal error: Killed signal terminated program go1
      
      As is already done in a couple of other similar cases, this patches
      disables hwcaps support for libiberty.
      
      Initially, this didn't work because config/hwcaps.m4 uses target_os, but
      didn't ensure it is defined.
      
      Tested on i386-pc-solaris2.11 with as and gas.
      
      2023-11-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	config:
      	* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): Require
      	AC_CANONICAL_TARGET.
      
      	libiberty:
      	* configure.ac (GCC_CHECK_ASSEMBLER_HWCAP): Invoke.
      	* configure, aclocal.m4: Regenerate.
      	* Makefile.in (COMPILE.c): Add HWCAP_CFLAGS.
      f2c52c0d
  9. Nov 29, 2023
  10. Nov 28, 2023
    • Jakub Jelinek's avatar
      libiberty: Use x86 HW optimized sha1 · bf4f40cc
      Jakub Jelinek authored
      Nick has approved this patch (+ small ld change to use it for --build-id=),
      so I'm commiting it to GCC as master as well.
      
      If anyone from ARM would be willing to implement it similarly with
      vsha1{cq,mq,pq,h,su0q,su1q}_u32 intrinsics, it could be a useful linker
      speedup on those hosts as well, the intent in sha1.c was that
      sha1_hw_process_bytes, sha1_hw_process_block functions
      would be defined whenever
      defined (HAVE_X86_SHA1_HW_SUPPORT) || defined (HAVE_WHATEVERELSE_SHA1_HW_SUPPORT)
      but the body of sha1_hw_process_block and sha1_choose_process_bytes
      would then have #elif defined (HAVE_WHATEVERELSE_SHA1_HW_SUPPORT) for
      the other arch support, similarly for any target attributes on
      sha1_hw_process_block if needed.
      
      2023-11-28  Jakub Jelinek  <jakub@redhat.com>
      
      include/
      	* sha1.h (sha1_process_bytes_fn): New typedef.
      	(sha1_choose_process_bytes): Declare.
      libiberty/
      	* configure.ac (HAVE_X86_SHA1_HW_SUPPORT): New check.
      	* sha1.c: If HAVE_X86_SHA1_HW_SUPPORT is defined, include x86intrin.h
      	and cpuid.h.
      	(sha1_hw_process_bytes, sha1_hw_process_block,
      	sha1_choose_process_bytes): New functions.
      	* config.in: Regenerated.
      	* configure: Regenerated.
      bf4f40cc
  11. Nov 16, 2023
  12. Nov 15, 2023
  13. Nov 14, 2023
  14. Nov 10, 2023
    • Brendan Shanks's avatar
      [PATCH v3] libiberty: Use posix_spawn in pex-unix when available. · 879cf9ff
      Brendan Shanks authored
      Hi,
      
      This patch implements pex_unix_exec_child using posix_spawn when
      available.
      
      This should especially benefit recent macOS (where vfork just calls
      fork), but should have equivalent or faster performance on all
      platforms.
      In addition, the implementation is substantially simpler than the
      vfork+exec code path.
      
      Tested on x86_64-linux.
      
      v2: Fix error handling (previously the function would be run twice in
      case of error), and don't use a macro that changes control flow.
      
      v3: Match file style for error-handling blocks, don't close
      in/out/errdes on error, and check close() for errors.
      
      libiberty/
      	* configure.ac (AC_CHECK_HEADERS): Add spawn.h.
      	(checkfuncs): Add posix_spawn, posix_spawnp.
      	(AC_CHECK_FUNCS): Add posix_spawn, posix_spawnp.
      	* aclocal.m4, configure, config.in: Rebuild.
      	* pex-unix.c [HAVE_POSIX_SPAWN] (pex_unix_exec_child): New function.
      879cf9ff
  15. Aug 23, 2023
  16. Aug 22, 2023
    • Jason Merrill's avatar
      c++: constrained hidden friends [PR109751] · 810bcc00
      Jason Merrill authored
      r13-4035 avoided a problem with overloading of constrained hidden friends by
      checking satisfaction, but checking satisfaction early is inconsistent with
      the usual late checking and can lead to hard errors, so let's not do that
      after all.
      
      We were wrongly treating the different instantiations of the same friend
      template as the same function because maybe_substitute_reqs_for was failing
      to actually substitute in the case of a non-template friend.  But we don't
      actually need to do the substitution anyway, because [temp.friend] says that
      such a friend can't be the same as any other declaration.
      
      After fixing that, instead of a redefinition error we got an ambiguous
      overload error, fixed by allowing constrained hidden friends to coexist
      until overload resolution, at which point they probably won't be in the same
      ADL overload set anyway.
      
      And we avoid mangling collisions by following the proposed mangling for
      these friends as a member function with an extra 'F' before the name.  I
      demangle this by just adding [friend] to the name of the function because
      it's not feasible to reconstruct the actual scope of the function since the
      mangling ABI doesn't distinguish between class and namespace scopes.
      
      	PR c++/109751
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (member_like_constrained_friend_p): Declare.
      	* decl.cc (member_like_constrained_friend_p): New.
      	(function_requirements_equivalent_p): Check it.
      	(duplicate_decls): Check it.
      	(grokfndecl): Check friend template constraints.
      	* mangle.cc (decl_mangling_context): Check it.
      	(write_unqualified_name): Check it.
      	* pt.cc (uses_outer_template_parms_in_constraints): Fix for friends.
      	(tsubst_friend_function): Don't check satisfaction.
      
      include/ChangeLog:
      
      	* demangle.h (enum demangle_component_type): Add
      	DEMANGLE_COMPONENT_FRIEND.
      
      libiberty/ChangeLog:
      
      	* cp-demangle.c (d_make_comp): Handle DEMANGLE_COMPONENT_FRIEND.
      	(d_count_templates_scopes): Likewise.
      	(d_print_comp_inner): Likewise.
      	(d_unqualified_name): Handle member-like friend mangling.
      	* testsuite/demangle-expected: Add test.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/concepts-friend11.C: Now works.  Add template.
      	* g++.dg/cpp2a/concepts-friend15.C: New test.
      810bcc00
  17. Aug 08, 2023
  18. Aug 07, 2023
    • John Ericson's avatar
      Deprecate a.out support for NetBSD targets. · 9fc0ae60
      John Ericson authored
      As discussed previously, a.out support is now quite deprecated, and in
      some cases removed, in both Binutils itself and NetBSD, so this legacy
      default makes little sense. `netbsdelf*` and `netbsdaout*` still work
      allowing the user to be explicit about there choice. Additionally, the
      configure script warns about the change as Nick Clifton requested.
      
      One possible concern was the status of NetBSD on NS32K, where only a.out
      was supported. But per [1] NetBSD has removed support, and if it were to
      come back, it would be with ELF. The binutils implementation is
      therefore marked obsolete, per the instructions in the last message.
      
      With that patch and this one applied, I have confirmed the following:
      
      --target=i686-unknown-netbsd
      --target=i686-unknown-netbsdelf
        builds completely
      
      --target=i686-unknown-netbsdaout
        properly fails because target is deprecated.
      
      --target=vax-unknown-netbsdaout builds completely except for gas, where
      the target is deprecated.
      
      [1]: https://mail-index.netbsd.org/tech-toolchain/2021/07/19/msg004025.html
      
      config/ChangeLog:
      
      	* picflag.m4: Simplify SHmedia NetBSD match by presuming ELF.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libada/ChangeLog:
      
      	* configure: Regenerate.
      
      libgcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libiberty/ChangeLog:
      
      	* configure: Regenerate.
      9fc0ae60
    • H.J. Lu's avatar
      GCC: Check if AR works with --plugin and rc · 9c7797a8
      H.J. Lu authored
      AR from older binutils doesn't work with --plugin and rc:
      
      [hjl@gnu-cfl-2 bin]$ touch foo.c
      [hjl@gnu-cfl-2 bin]$ ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
      [hjl@gnu-cfl-2 bin]$ ./ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
      ./ar: no operation specified
      [hjl@gnu-cfl-2 bin]$ ./ar --version
      GNU ar (Linux/GNU Binutils) 2.29.51.0.1.20180112
      Copyright (C) 2018 Free Software Foundation, Inc.
      This program is free software; you may redistribute it under the terms of
      the GNU General Public License version 3 or (at your option) any later version.
      This program has absolutely no warranty.
      [hjl@gnu-cfl-2 bin]$
      
      Check if AR works with --plugin and rc before passing --plugin to AR and
      RANLIB.
      
      ChangeLog:
      
      	* configure: Regenerated.
      	* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with
      	--plugin and rc before enabling --plugin.
      
      config/ChangeLog:
      
      	* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
      	--plugin and rc before enabling --plugin.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libiberty/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      9c7797a8
    • H.J. Lu's avatar
      Sync with binutils: GCC: Pass --plugin to AR and RANLIB · 126f707e
      H.J. Lu authored
      Sync with binutils for building binutils with LTO:
      
      50ad1254d50 GCC: Pass --plugin to AR and RANLIB
      
      Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
      build.
      
      ChangeLog:
      
      	* 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/ChangeLog:
      
      	* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
      
      libiberty/ChangeLog:
      
      	* 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/ChangeLog:
      
      	* configure: Regenerated.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      126f707e
  19. Jun 16, 2023
  20. Jun 15, 2023
    • Marek Polacek's avatar
      configure: Implement --enable-host-pie · b6cb10af
      Marek Polacek authored
      [ This is my third attempt to add this configure option.  The first
      version was approved but it came too late in the development cycle.
      The second version was also approved, but I had to revert it:
      <https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607082.html>.
      I've fixed the problem (by moving $(PICFLAG) from INTERNAL_CFLAGS to
      ALL_COMPILERFLAGS).  Another change is that since r13-4536 I no longer
      need to touch Makefile.def, so this patch is simplified. ]
      
      This patch implements the --enable-host-pie configure option which
      makes the compiler executables PIE.  This can be used to enhance
      protection against ROP attacks, and can be viewed as part of a wider
      trend to harden binaries.
      
      It is similar to the option --enable-host-shared, except that --e-h-s
      won't add -shared to the linker flags whereas --e-h-p will add -pie.
      It is different from --enable-default-pie because that option just
      adds an implicit -fPIE/-pie when the compiler is invoked, but the
      compiler itself isn't PIE.
      
      Since r12-5768-gfe7c3ecf, PCH works well with PIE, so there are no PCH
      regressions.
      
      When building the compiler, the build process may use various in-tree
      libraries; these need to be built with -fPIE so that it's possible to
      use them when building a PIE.  For instance, when --with-included-gettext
      is in effect, intl object files must be compiled with -fPIE.  Similarly,
      when building in-tree gmp, isl, mpfr and mpc, they must be compiled with
      -fPIE.
      
      With this patch and --enable-host-pie used to configure gcc:
      
      $ file gcc/cc1{,plus,obj,gm2} gcc/f951 gcc/lto1 gcc/cpp gcc/go1 gcc/rust1 gcc/gnat1
      gcc/cc1:     ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=98e22cde129d304aa6f33e61b1c39e144aeb135e, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/cc1plus: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=859d1ea37e43dfe50c18fd4e3dd9a34bb1db8f77, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/cc1obj:  ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=1964f8ecee6163182bc26134e2ac1f324816e434, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/cc1gm2:  ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a396672c7ff913d21855829202e7b02ecf42ff4c, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/f951:    ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=59c523db893186547ac75c7a71f48be0a461c06b, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/lto1:    ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=084a7b77df7be2d63c2d4c655b5bbc3fcdb6038d, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/cpp:     ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3503bf8390d219a10d6653b8560aa21158132168, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/go1:     ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=988cc673af4fba5dcb482f4b34957b99050a68c5, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/rust1:   ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b6a5d3d514446c4dcdee0707f086ab9b274a8a3c, for GNU/Linux 3.2.0, with debug_info, not stripped
      gcc/gnat1:   ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=bb11ccdc2c366fe3fe0980476bcd8ca19b67f9dc, for GNU/Linux 3.2.0, with debug_info, not stripped
      
      I plan to add an option to link with -Wl,-z,now.
      
      Bootstrapped on x86_64-pc-linux-gnu with --with-included-gettext
      --enable-host-pie as well as without --enable-host-pie.  Also tested
      on a Debian system where the system gcc was configured with
      --enable-default-pie.
      
      Co-Authored by: Iain Sandoe  <iain@sandoe.co.uk>
      
      ChangeLog:
      
      	* configure.ac (--enable-host-pie): New check.  Set PICFLAG after this
      	check.
      	* configure: Regenerate.
      
      c++tools/ChangeLog:
      
      	* Makefile.in: Rename PIEFLAG to PICFLAG.  Set LD_PICFLAG.  Use it.
      	Use pic/libiberty.a if PICFLAG is set.
      	* configure.ac (--enable-default-pie): Set PICFLAG instead of PIEFLAG.
      	(--enable-host-pie): New check.
      	* configure: Regenerate.
      
      fixincludes/ChangeLog:
      
      	* Makefile.in: Set and use PICFLAG and LD_PICFLAG.  Use the "pic"
      	build of libiberty if PICFLAG is set.
      	* configure.ac:
      	* configure: Regenerate.
      
      gcc/ChangeLog:
      
      	* Makefile.in: Set LD_PICFLAG.  Use it.  Set enable_host_pie.
      	Remove NO_PIE_CFLAGS and NO_PIE_FLAG.  Pass LD_PICFLAG to
      	ALL_LINKERFLAGS.  Use the "pic" build of libiberty if --enable-host-pie.
      	* configure.ac (--enable-host-shared): Don't set PICFLAG here.
      	(--enable-host-pie): New check.  Set PICFLAG and LD_PICFLAG after this
      	check.
      	* configure: Regenerate.
      	* doc/install.texi: Document --enable-host-pie.
      
      gcc/ada/ChangeLog:
      
      	* gcc-interface/Make-lang.in (ALL_ADAFLAGS): Remove NO_PIE_CFLAGS.  Add
      	PICFLAG.  Use PICFLAG when building ada/b_gnat1.o and ada/b_gnatb.o.
      	* gcc-interface/Makefile.in: Use pic/libiberty.a if PICFLAG is set.
      	Remove NO_PIE_FLAG.
      
      gcc/m2/ChangeLog:
      
      	* Make-lang.in: New var, GM2_PICFLAGS.  Use it.
      
      gcc/d/ChangeLog:
      
      	* Make-lang.in: Remove NO_PIE_CFLAGS.
      
      intl/ChangeLog:
      
      	* Makefile.in: Use @PICFLAG@ in COMPILE as well.
      	* configure.ac (--enable-host-shared): Don't set PICFLAG here.
      	(--enable-host-pie): New check.  Set PICFLAG after this check.
      	* configure: Regenerate.
      
      libcody/ChangeLog:
      
      	* Makefile.in: Pass LD_PICFLAG to LDFLAGS.
      	* configure.ac (--enable-host-shared): Don't set PICFLAG here.
      	(--enable-host-pie): New check.  Set PICFLAG and LD_PICFLAG after this
      	check.
      	* configure: Regenerate.
      
      libcpp/ChangeLog:
      
      	* configure.ac (--enable-host-shared): Don't set PICFLAG here.
      	(--enable-host-pie): New check.  Set PICFLAG after this check.
      	* configure: Regenerate.
      
      libdecnumber/ChangeLog:
      
      	* configure.ac (--enable-host-shared): Don't set PICFLAG here.
      	(--enable-host-pie): New check.  Set PICFLAG after this check.
      	* configure: Regenerate.
      
      libiberty/ChangeLog:
      
      	* configure.ac: Also set shared when enable_host_pie.
      	* configure: Regenerate.
      
      zlib/ChangeLog:
      
      	* configure.ac (--enable-host-shared): Don't set PICFLAG here.
      	(--enable-host-pie): New check.  Set PICFLAG after this check.
      	* configure: Regenerate.
      b6cb10af
  21. Jun 14, 2023
  22. Jun 13, 2023
    • Nathan Sidwell's avatar
      c++: Fix templated convertion operator demangling · 5a897036
      Nathan Sidwell authored
      Instantiations of templated conversion operators failed to demangle
      for cases such as 'operator X<int>', but worked for 'operator X<int>
      &', due to thinking the template instantiation of X was the
      instantiation of the conversion operator itself.
      
      	libiberty/
      	* cp-demangle.c (d_print_conversion): Remove incorrect
      	template instantiation handling.
      	* testsuite/demangle-expected: Add testcases.
      5a897036
  23. Jun 08, 2023
  24. Jun 07, 2023
    • Costas Argyris's avatar
      libiberty: writeargv: Simplify function error mode. · 3fe017ee
      Costas Argyris authored
      You are right, this is also a remnant of the old function design
      that I completely missed.    Here is the follow-up patch for that.
      
      Thanks for pointing it out.
      
      Costas
      
      On Tue, 6 Jun 2023 at 04:12, Jeff Law <jeffreyalaw@gmail.com> wrote:
      
          On 6/5/23 08:37, Costas Argyris via Gcc-patches wrote:
          > writeargv can be simplified by getting rid of the error exit mode
          > that was only relevant many years ago when the function used
          > to open the file descriptor internally.
          [ ... ]
          Thanks.  I've pushed this to the trunk.
      
          You could (as a follow-up) simplify it even further.  There's no need
          for the status variable as far as I can tell.  You could just have the
          final return be "return 0;" instead of "return status;".
      
      libiberty/
      	* argv.c (writeargv): Constant propagate "0" for "status",
      	simplifying the code slightly.
      3fe017ee
    • GCC Administrator's avatar
      Daily bump. · 4f0d4825
      GCC Administrator authored
      4f0d4825
  25. Jun 06, 2023
    • Costas Argyris's avatar
      libiberty: writeargv: Simplify function error mode. · 4d1e4ce9
      Costas Argyris authored
      writeargv can be simplified by getting rid of the error exit mode
      that was only relevant many years ago when the function used
      to open the file descriptor internally.
      
      0001-libiberty-writeargv-Simplify-function-error-mode.patch
      
      From 1271552baee5561fa61652f4ca7673c9667e4f8f Mon Sep 17 00:00:00 2001
      From: Costas Argyris <costas.argyris@gmail.com>
      Date: Mon, 5 Jun 2023 15:02:06 +0100
      Subject: [PATCH] libiberty: writeargv: Simplify function error mode.
      
      The goto-based error mode was based on a previous version
      of the function where it was responsible for opening the
      file, so it had to close it upon any exit:
      
      https://inbox.sourceware.org/gcc-patches/20070417200340.GM9017@sparrowhawk.codesourcery.com/
      
      
      
      (thanks pinskia)
      
      This is no longer the case though since now the function
      takes the file descriptor as input, so the exit mode on
      error can be just a simple return 1 statement.
      
      libiberty/
      	* argv.c (writeargv): Simplify & remove gotos.
      
      Signed-off-by: default avatarCostas Argyris <costas.argyris@gmail.com>
      4d1e4ce9
    • GCC Administrator's avatar
      Daily bump. · 14da7648
      GCC Administrator authored
      14da7648
  26. Jun 05, 2023
  27. Jun 04, 2023
  28. Jun 03, 2023
    • Patrick Palka's avatar
      c++: mangle noexcept-expr [PR70790] · 999e617d
      Patrick Palka authored
      This implements noexcept(expr) mangling and demangling as per the
      Itanium ABI.
      
      	PR c++/70790
      
      gcc/cp/ChangeLog:
      
      	* mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
      
      libiberty/ChangeLog:
      
      	* cp-demangle.c (cplus_demangle_operators): Add the noexcept
      	operator.
      	(d_print_comp_inner) <case DEMANGLE_COMPONENT_UNARY>: Always
      	print parens around the operand of noexcept too.
      	* testsuite/demangle-expected: Test noexcept operator
      	demangling.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/abi/mangle78.C: New test.
      999e617d
  29. Apr 03, 2023
  30. Apr 02, 2023
    • Jakub Jelinek's avatar
      libiberty: Make strstr.c in libiberty ANSI compliant · 1719fa40
      Jakub Jelinek authored
      On Fri, Nov 13, 2020 at 11:53:43AM -0700, Jeff Law via Gcc-patches wrote:
      >
      > On 5/1/20 6:06 PM, Seija Kijin via Gcc-patches wrote:
      > > The original code in libiberty says "FIXME" and then says it has not been
      > > validated to be ANSI compliant. However, this patch changes the function to
      > > match implementations that ARE compliant, and such code is in the public
      > > domain.
      > >
      > > I ran the test results, and there are no test failures.
      >
      > Thanks.  This seems to be the standard "simple" strstr implementation. 
      > There's significantly faster implementations available, but I doubt it's
      > worth the effort as the version in this file only gets used if there is
      > no system strstr.c.
      
      Except that PR109306 says the new version is non-compliant and
      is certainly slower than what we used to have.  The only problem I see
      on the old version (sure, it is not very fast version) is that for
      strstr ("abcd", "") it returned "abcd"+4 rather than "abcd" because
      strchr in that case changed p to point to the last character and then
      strncmp returned 0.
      
      The question reported in PR109306 is whether memcmp is required not to
      access characters beyond the first difference or not.
      For all of memcmp/strcmp/strncmp, C17 says:
      "The sign of a nonzero value returned by the comparison functions memcmp, strcmp, and strncmp
      is determined by the sign of the difference between the values of the first pair of characters (both
      interpreted as unsigned char) that differ in the objects being compared."
      but then in memcmp description says:
      "The memcmp function compares the first n characters of the object pointed to by s1 to the first n
      characters of the object pointed to by s2."
      rather than something similar to strncmp wording:
      "The strncmp function compares not more than n characters (characters that follow a null character
      are not compared) from the array pointed to by s1 to the array pointed to by
      s2."
      So, while for strncmp it seems clearly well defined when there is zero
      terminator before reaching the n, for memcmp it is unclear if say
      int
      memcmp (const void *s1, const void *s2, size_t n)
      {
        int ret = 0;
        size_t i;
        const unsigned char *p1 = (const unsigned char *) s1;
        const unsigned char *p2 = (const unsigned char *) s2;
      
        for (i = n; i; i--)
          if (p1[i - 1] != p2[i - 1])
            ret = p1[i - 1] < p2[i - 1] ? -1 : 1;
        return ret;
      }
      wouldn't be valid implementation (one which always compares all characters
      and just returns non-zero from the first one that differs).
      
      So, shouldn't we just revert and handle the len == 0 case correctly?
      
      I think almost nothing really uses it, but still, the old version
      at least worked nicer with a fast strchr.
      Could as well strncmp (p + 1, s2 + 1, len - 1) if that is preferred
      because strchr already compared the first character.
      
      2023-04-02  Jakub Jelinek  <jakub@redhat.com>
      
      	PR other/109306
      	* strstr.c: Revert the 2020-11-13 changes.
      	(strstr): Return s1 if len is 0.
      1719fa40
  31. Mar 31, 2023
  32. Mar 30, 2023
    • Gerald Pfeifer's avatar
      libiberty: Remove a reference to the Glibc manual · 83d2b1cc
      Gerald Pfeifer authored
      longjmp is not specific to Glibc, and GCC supports lots of systems
      that do not use Glibc. Plus this link has been broken in the web
      version for ages without a good way to fix.
      
      libiberty/ChangeLog:
      
      	* obstacks.texi (Preparing for Obstacks): Remove a (broken)
      	reference to the Glibc manual.
      83d2b1cc
  33. Mar 04, 2023
Loading