Skip to content
Snippets Groups Projects
  1. Aug 07, 2023
    • Nick Alcock's avatar
      libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case · f3307109
      Nick Alcock authored
      My previous nm patch handled all cases but one -- if the user set NM in
      the environment to a path which contained an option, libtool's nm
      detection tries to run nm against a copy of nm with the options in it:
      e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
      test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
      This is unlikely to be desirable: in this case we should run
      "/usr/bin/nm --blargle /usr/bin/nm".
      
      Furthermore, as part of this nm has to detect when the passed-in $NM
      contains a path, and in that case avoid doing a path search itself.
      This too was thrown off if an option contained something that looked
      like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
      "nm -B../prev-gcc nm" which rarely works well (and indeed it looks
      to see whether that nm exists, finds it doesn't, and wrongly concludes
      that nm -p or whatever does not work).
      
      Fix all of these by clipping all options (defined as everything
      including and after the first " -") before deciding whether nm
      contains a path (but not using the clipped value for anything else),
      and then removing all options from the path-modified nm before
      looking to see whether that nm existed.
      
      NM=my-nm now does a path search and runs e.g.
        /usr/bin/my-nm -B /usr/bin/my-nm
      
      NM=/usr/bin/my-nm now avoids a path search and runs e.g.
        /usr/bin/my-nm -B /usr/bin/my-nm
      
      NM="my-nm -p../wombat" now does a path search and runs e.g.
        /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm
      
      NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
        ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm
      
      This seems to be all combinations, including those used by GCC bootstrap
      (which, before this commit, fails to bootstrap when configured
      --with-build-config=bootstrap-lto, because the lto plugin is now using
      --export-symbols-regex, which requires libtool to find a working nm,
      while also using -B../prev-gcc to point at the lto plugin associated
      with the GCC just built.)
      
      Regenerate all affected configure scripts.
      
      ChangeLog:
      
      	* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
      	options, including options containing paths.
      
      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.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      Unverified
      f3307109
    • Nick Alcock's avatar
      libtool.m4: fix nm BSD flag detection · ab422974
      Nick Alcock authored
      Libtool needs to get BSD-format (or MS-format) output out of the system
      nm, so that it can scan generated object files for symbol names for
      -export-symbols-regex support.  Some nms need specific flags to turn on
      BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
      Unfortunately the code to do this has a pair of interlocking flaws:
      
       - it runs the test by doing an nm of /dev/null.  Some platforms
         reasonably refuse to do an nm on a device file, but before now this
         has only been worked around by assuming that the error message has a
         specific textual form emitted by Tru64 nm, and that getting this
         error means this is Tru64 nm and that nm -B would work to produce
         BSD-format output, even though the test never actually got anything
         but an error message out of nm -B.  This is fixable by nm'ing *nm
         itself* (since we necessarily have a path to it).
      
       - the test is entirely skipped if NM is set in the environment, on the
         grounds that the user has overridden the test: but the user cannot
         reasonably be expected to know that libtool wants not only nm but
         also flags forcing BSD-format output.  Worse yet, one such "user" is
         the top-level Cygnus configure script, which neither tests for
         nor specifies any BSD-format flags.  So platforms needing BSD-format
         flags always fail to set them when run in a Cygnus tree, breaking
         -export-symbols-regex on such platforms.  Libtool also needs to
         augment $LD on some platforms, but this is done unconditionally,
         augmenting whatever the user specified: the nm check should do the
         same.
      
         One wrinkle: if the user has overridden $NM, a path might have been
         provided: so we use the user-specified path if there was one, and
         otherwise do the path search as usual.  (If the nm specified doesn't
         work, this might lead to a few extra pointless path searches -- but
         the test is going to fail anyway, so that's not a problem.)
      
      (Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
      symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
      *that* is a symlink to /usr/bin/nm.)
      
      ChangeLog:
      
      	* libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
      	NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
      	errors from nms that refuse to work on non-regular files.  Remove
      	other workarounds for this problem.  Strip out blank lines from the
      	nm output.
      
      fixincludes/ChangeLog:
      
      	* configure: Regenerate.
      
      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.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      Unverified
      ab422974
    • 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.
      Unverified
      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.
      Unverified
      126f707e
  2. May 19, 2023
  3. May 18, 2023
    • Bernhard Reutner-Fischer's avatar
      c: use _P() defines from tree.h · 9157b213
      Bernhard Reutner-Fischer authored
      gcc/c-family/ChangeLog:
      
      	* c-ada-spec.cc (has_static_fields): Use _P() defines from tree.h.
      	(dump_ada_declaration): Ditto.
      	(dump_ada_structure): Ditto.
      	* c-common.cc (unsafe_conversion_p): Ditto.
      	(shorten_compare): Ditto.
      	(pointer_int_sum): Ditto.
      	(c_common_truthvalue_conversion): Ditto.
      	(scalar_to_vector): Ditto.
      	* c-common.h (gnu_vector_type_p): Ditto.
      	* c-omp.cc (c_omp_depend_t_p): Ditto.
      	(c_omp_split_clauses): Ditto.
      	* c-ubsan.cc (ubsan_instrument_division): Ditto.
      	* c-warn.cc (conversion_warning): Ditto.
      	(warnings_for_convert_and_check): Ditto.
      
      gcc/c/ChangeLog:
      
      	* c-convert.cc (c_convert): Ditto.
      	* c-decl.cc (merge_decls): Ditto.
      	* c-parser.cc (c_parser_omp_clause_reduction): Ditto.
      	(c_parser_omp_declare_reduction): Ditto.
      	* c-typeck.cc (build_component_ref): Ditto.
      	(convert_argument): Ditto.
      	(pointer_diff): Ditto.
      	(build_unary_op): Ditto.
      	(build_c_cast): Ditto.
      	(build_modify_expr): Ditto.
      	(store_init_value): Ditto.
      	(constexpr_init_fits_real_type): Ditto.
      	(check_constexpr_init): Ditto.
      	(c_finish_return): Ditto.
      	(handle_omp_array_sections_1): Ditto.
      	(c_finish_omp_clauses): Ditto.
      	* gimple-parser.cc (c_finish_gimple_return): Ditto.
      
      libcc1/ChangeLog:
      
      	* libcc1plugin.cc (plugin_float_type): Ditto.
      	* libcp1plugin.cc (plugin_reactivate_decl): Ditto.
      	(plugin_get_float_type): Ditto.
      9157b213
  4. Jan 16, 2023
  5. Nov 02, 2022
  6. Nov 01, 2022
    • Nathan Sidwell's avatar
      c++: per-scope, per-signature lambda discriminators · 2b0e81d5
      Nathan Sidwell authored
      This implements ABI-compliant lambda discriminators.  Not only do we
      have per-scope counters, but we also distinguish by lambda signature.
      Only lambdas with the same signature will need non-zero
      discriminators.  As the discriminator is signature-dependent, we have
      to process the lambda function's declaration before we can determine
      it.  For templated and generic lambdas the signature is that of the
      uninstantiated lambda -- not separate for each instantiation.
      
      With this change, gcc and clang now produce the same lambda manglings
      for all these testcases.
      
      	gcc/cp/
      	* cp-tree.h (LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR): New.
      	(struct tree_lambda_expr): Add discriminator_sig bitfield.
      	(recrd_lambda_scope_sig_discriminator): Declare.
      	* lambda.cc (struct lambda_sig_count): New.
      	(lambda_discriminator): Add signature vector.
      	(start_lambda_scope): Adjust.
      	(compare_lambda_template_head, compare_lambda_sig): New.
      	(record_lambda_scope_sig_discriminator): New.
      	* mangle.cc (write_closure_type): Use the scope-sig discriminator for
      	ABI >= 18.  Emit abi mangling warning if needed.
      	* module.cc (trees_out::core_vals): Stream the new discriminator.
      	(trees_in::core_vals): Likewise.
      	* parser.cc (cp_parser_lambda_declarator_opt): Call
      	record_lambda_scope_sig_discriminator.
      	* pt.cc (tsubst_lambda_expr): Likewise.
      	libcc1/
      	* libcp1plugin.cc (plugin_start_lambda_closure_class_type):
      	Initialize the per-scope, per-signature discriminator.
      	gcc/testsuite/
      	* g++.dg/abi/lambda-sig1-18.C: New.
      	* g++.dg/abi/lambda-sig1-18vs17.C: New.
      	* g++.dg/cpp1y/lambda-mangle-1-18.C: New.
      2b0e81d5
    • Nathan Sidwell's avatar
      c++: Reorganize per-scope lambda discriminators · 0122faae
      Nathan Sidwell authored
      We currently use a per-extra-scope counter to discriminate multiple
      lambdas in a particular such scope.  This is not ABI compliant.  This
      patch merely refactors the existing code to make it easier to drop in
      a conformant mangling -- there's no functional change here.  I rename
      the LAMBDA_EXPR_DISCIMINATOR to LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR,
      foreshadowing that there'll be a new discriminator.  To provide ABI
      warnings we'll need to calculate both, and that requires some
      repacking of the lambda_expr's fields.  Finally, although we end up
      calling the discriminator setter and the scope recorder (nearly)
      always consecutively, it's clearer to handle it as two separate
      operations.  That also allows us to remove the instantiation
      special-case for a null extra-scope.
      
      	gcc/cp/
      	* cp-tree.h (LAMBDA_EXPR_DISCRIMINATOR): Rename to ...
      	(LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR): ... here.
      	(struct tree_lambda_expr): Make default_capture_mode &
      	discriminator_scope bitfields.
      	(record_null_lambda_scope) Delete.
      	(record_lambda_scope_discriminator): Declare.
      	* lambda.cc (struct lambda_discriminator): New struct.
      	(lambda_scope, lambda_scope_stack): Adjust types.
      	(lambda_count): Delete.
      	(struct tree_int): Delete.
      	(start_lambda_scope, finish_lambda_scope): Adjust.
      	(record_lambda_scope): Only record the scope.
      	(record_lambda_scope_discriminator): New.
      	* mangle.cc (write_closure_type_name): Adjust.
      	* module.cc (trees_out::core_vals): Likewise,
      	(trees_in::core_vals): Likewise.
      	* parser.cc (cp_parser_lambda_expression): Call
      	record_lambda_scope_discriminator.
      	* pt.cc (tsubst_lambda_expr): Adjust record_lambda_scope caling.  Call
      	record_lambda_scope_discriminator. Commonize control flow on tsubsting
      	the operator function.
      	libcc1/
      	* libcp1plugin.cc (plugin_start_closure): Adjust.
      	gcc/testsuite/
      	* g++.dg/abi/lambda-sig1-17.C: New.
      	* g++.dg/abi/lambda-sig1.h: New.
      	* g++.dg/cpp1y/lambda-mangle-1.C: Extracted to ...
      	* g++.dg/cpp1y/lambda-mangle-1.h: ... here.
      	* g++.dg/cpp1y/lambda-mangle-1-11.C: New
      	* g++.dg/cpp1y/lambda-mangle-1-17.C
      0122faae
  7. Oct 13, 2022
  8. Oct 12, 2022
    • Martin Liska's avatar
      regenerate configure files · 6d2294a8
      Martin Liska authored
      Needed after a recent change.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      liboffloadmic/ChangeLog:
      
      	* configure: Regenerate.
      	* plugin/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.
      6d2294a8
    • GCC Administrator's avatar
      Daily bump. · ab332cd7
      GCC Administrator authored
      ab332cd7
  9. Oct 11, 2022
    • Olivier Hainque's avatar
      Generic configury support for shared libs on VxWorks · 0ecd0f1c
      Olivier Hainque authored
      This change adds the configury bits to activate the build of
      shared libs on VxWorks ports configured with --enable-shared,
      for libraries variants where this is generally supported (rtp,
      code model !large - currently not compatible with -fPIC).
      
      Set lt_cv_deplibs_check_method in libtool.m4, so the build of
      libraries know how to establish dependencies.  This is useful in
      configurations such as aarch64 where proper support of LSE relies
      on accurate dependency information between libstdc++ and libgcc_s
      to begin with.
      
      Regenerate configure scripts to reflect libtool.m4 change.
      
      2022-10-09  Olivier Hainque  <hainque@adacore.com>
      
      	* libtool.m4 (*vxworks*): When enable_shared, set dynamic_linker
      	and friends for rtp !large. Assume the linker has the required
      	abilities and set lt_cv_deplibs_check_method.
      
      gcc/
      	* config.gcc (*vxworks*): Add t-slibgcc fragment
      	if enable_shared.
      
      libgcc/
      	* config.host (*vxworks*): When enable_shared, add
      	libgcc and crtstuff "shared" fragments for rtp except
      	large code model.
      	(aarch64*-wrs-vxworks7*): Remove t-slibgcc-libgcc from
      	the list of fragments.
      
      2022-10-09  Olivier Hainque  <hainque@adacore.com>
      
      gcc/
      	* configure: Regenerate.
      
      libatomic/
      	* configure: Regenerate.
      
      libbacktrace/
      	* configure: Regenerate.
      
      libcc1/
      	* configure: Regenerate.
      
      libffi/
      	* configure: Regenerate.
      
      libgfortran/
      	* configure: Regenerate.
      
      libgomp/
      	* configure: Regenerate.
      
      libitm/
      	* configure: Regenerate.
      
      libobjc/
      	* configure: Regenerate.
      
      liboffloadmic/
      	* configure: Regenerate.
      
      liboffloadmic/
      	* plugin/configure: Regenerate.
      
      libphobos/
      	* configure: Regenerate.
      
      libquadmath/
      	* configure: Regenerate.
      
      libsanitizer/
      	* configure: Regenerate.
      
      libssp/
      	* configure: Regenerate.
      
      libstdc++-v3/
      	* configure: Regenerate.
      
      libvtv/
      	* configure: Regenerate.
      
      lto-plugin/
      	* configure: Regenerate.
      
      zlib/
      	* configure: Regenerate.
      0ecd0f1c
  10. Jun 28, 2022
  11. Jun 27, 2022
    • Sergei Trofimovich's avatar
      c++: avoid <memory> poisoning on musl [PR106102] · 3b21c21f
      Sergei Trofimovich authored
      On musl <pthread.h> uses calloc() (via <sched.h>). <memory> includes
      it indirectly and exposes use of poisoned calloc() when module code
      is built:
      
          /build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc
              In file included from /<<NIX>>/musl-1.2.3-dev/include/pthread.h:30,
                       from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35,
                       ....
                       from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77,
                       from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24,
                       from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25,
                       from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23,
                       from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32:
          /<<NIX>>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc"
             84 | void *calloc(size_t, size_t);
                |       ^
          /<<NIX>>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc"
            124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
                |                                    ^
      
      gcc/cp/
      
      	PR c++/106102
      	* mapper-client.cc: Include <memory> via "system.h".
      	* mapper-resolver.cc: Ditto.
      	* module.cc: Ditto.
      
      libcc1/
      
      	PR c++/106102
      	* libcc1plugin.cc: Include <memory> via "system.h".
      	* libcp1plugin.cc: Ditto.
      3b21c21f
  12. Jun 02, 2022
  13. Jun 01, 2022
    • David Seifert's avatar
      [PATCH] configure: use OBJDUMP determined by libtool [PR95648] · c4c3cd5c
      David Seifert authored
      $ac_cv_prog_OBJDUMP contains the --host OBJDUMP that
      libtool has inferred. Current config/gcc-plugin.m4 does
      not respect the user's choice for OBJDUMP.
      
      	PR plugins/95648
      config/
      
      	* gcc-plugin.m4: Use libtool's $ac_cv_prog_OBJDUMP.
      
      gcc/
      
      	* configure: Regenerate.
      
      libcc1/
      
      	* configure: Regenerate.
      c4c3cd5c
  14. Jan 03, 2022
  15. Dec 17, 2021
  16. Dec 16, 2021
    • Patrick Palka's avatar
      c++: two-stage name lookup for overloaded operators [PR51577] · bb2a7f80
      Patrick Palka authored
      In order to properly implement two-stage name lookup for dependent
      operator expressions, we need to remember the result of unqualified
      lookup of the operator at template definition time, and reuse that
      result rather than performing another unqualified lookup at
      instantiation time.
      
      Ideally we could just store the lookup in the expression directly, but
      as pointed out in r9-6405 this isn't really possible since we use the
      standard tree codes to represent most dependent operator expressions.
      
      We could perhaps create a new tree code to represent dependent operator
      expressions, with enough operands to store the lookup along with
      everything else, but that'd require a lot of careful work to make sure
      we handle this new tree code properly across the frontend.
      
      But currently type-dependent operator (and call) expressions are given
      an empty TREE_TYPE, which dependent_type_p treats as dependent, so this
      field is effectively unused except to signal that the expression is
      type-dependent.  It'd be convenient if we could store the lookup there
      while preserving the dependent-ness of the expression.
      
      To that end, this patch creates a new kind of type, called
      DEPENDENT_OPERATOR_TYPE, which we give to dependent operator expressions
      and into which we can store the result of operator lookup at template
      definition time (DEPENDENT_OPERATOR_TYPE_SAVED_LOOKUPS).  Since this
      type is always dependent (by definition), and since the frontend doesn't
      seem to care much about the exact type of a type-dependent expression,
      using this type in place of a NULL_TREE type seems to "just work"; only
      dependent_type_p and WILDCARD_TYPE_P need to be adjusted to return true
      for this new type.
      
      The rest of the patch mostly consists of adding the necessary plumbing
      to pass DEPENDENT_OPERATOR_TYPE_SAVED_LOOKUPS to add_operator_candidates,
      adjusting all callers of build_x_* appropriately, and removing the now
      unnecessary push_operator_bindings mechanism.
      
      In passing, this patch simplifies finish_constraint_binary_op to avoid
      using build_x_binary_op for building a binary constraint-expr; we don't
      need to consider operator overloads here, as the &&/|| inside a
      constraint effectively always has the built-in meaning (since atomic
      constraints must have bool type).
      
      This patch also makes FOLD_EXPR_OP yield a tree_code instead of a raw
      INTEGER_CST.
      
      Finally, this patch adds the XFAILed test operator-8.C which is about
      broken two-stage name lookup for rewritten non-dependent operator
      expressions, an existing bug that's otherwise only documented in
      build_new_op.
      
      	PR c++/51577
      	PR c++/83035
      	PR c++/100465
      
      gcc/cp/ChangeLog:
      
      	* call.c (add_operator_candidates): Add lookups parameter.
      	Use it to avoid performing a second unqualified lookup when
      	instantiating a dependent operator expression.
      	(build_new_op): Add lookups parameter and pass it appropriately.
      	* constraint.cc (finish_constraint_binary_op): Use
      	build_min_nt_loc instead of build_x_binary_op.
      	* coroutines.cc (build_co_await): Adjust call to build_new_op.
      	* cp-objcp-common.c (cp_common_init_ts): Mark
      	DEPENDENT_OPERATOR_TYPE appropriately.
      	* cp-tree.def (DEPENDENT_OPERATOR_TYPE): Define.
      	* cp-tree.h (WILDCARD_TYPE_P): Accept DEPENDENT_OPERATOR_TYPE.
      	(FOLD_EXPR_OP_RAW): New, renamed from ...
      	(FOLD_EXPR_OP): ... this.  Change this to return the tree_code directly.
      	(DEPENDENT_OPERATOR_TYPE_SAVED_LOOKUPS): Define.
      	(templated_operator_saved_lookups): Define.
      	(build_new_op): Add lookups parameter.
      	(build_dependent_operator_type): Declare.
      	(build_x_indirect_ref): Add lookups parameter.
      	(build_x_binary_op): Likewise.
      	(build_x_unary_op): Likewise.
      	(build_x_compound_expr): Likewise.
      	(build_x_modify_expr): Likewise.
      	* cxx-pretty-print.c (get_fold_operator): Adjust after
      	FOLD_EXPR_OP change.
      	* decl.c (start_preparsed_function): Don't call
      	push_operator_bindings.
      	* decl2.c (grok_array_decl): Adjust calls to build_new_op.
      	* method.c (do_one_comp): Likewise.
      	(build_comparison_op): Likewise.
      	* module.cc (trees_out::type_node): Handle DEPENDENT_OPERATOR_TYPE.
      	(trees_in::tree_node): Likewise.
      	* name-lookup.c (lookup_name): Revert r11-2876 change.
      	(op_unqualified_lookup): Remove.
      	(maybe_save_operator_binding): Remove.
      	(discard_operator_bindings): Remove.
      	(push_operator_bindings): Remove.
      	* name-lookup.h (maybe_save_operator_binding): Remove.
      	(push_operator_bindings): Remove.
      	(discard_operator_bindings): Remove.
      	* parser.c (cp_parser_unary_expression): Adjust calls to build_x_*.
      	(cp_parser_binary_expression): Likewise.
      	(cp_parser_assignment_expression): Likewise.
      	(cp_parser_expression): Likewise.
      	(do_range_for_auto_deduction): Likewise.
      	(cp_convert_range_for): Likewise.
      	(cp_parser_perform_range_for_lookup): Likewise.
      	(cp_parser_template_argument): Likewise.
      	(cp_parser_omp_for_cond): Likewise.
      	(cp_parser_omp_for_incr): Likewise.
      	(cp_parser_omp_for_loop_init): Likewise.
      	(cp_convert_omp_range_for): Likewise.
      	(cp_finish_omp_range_for): Likewise.
      	* pt.c (fold_expression): Adjust after FOLD_EXPR_OP change. Pass
      	templated_operator_saved_lookups to build_x_*.
      	(tsubst_omp_for_iterator): Adjust call to build_x_modify_expr.
      	(tsubst_expr) <case COMPOUND_EXPR>: Pass
      	templated_operator_saved_lookups to build_x_*.
      	(tsubst_copy_and_build) <case INDIRECT_REF>: Likewise.
      	<case tcc_unary>: Likewise.
      	<case tcc_binary>: Likewise.
      	<case MODOP_EXPR>: Likewise.
      	<case COMPOUND_EXPR>: Likewise.
      	(dependent_type_p_r): Return true for DEPENDENT_OPERATOR_TYPE.
      	* ptree.c (cxx_print_type): Handle DEPENDENT_OPERATOR_TYPE.
      	* semantics.c (finish_increment_expr): Adjust call to
      	build_x_unary_op.
      	(finish_unary_op_expr): Likewise.
      	(handle_omp_for_class_iterator): Adjust calls to build_x_*.
      	(finish_omp_cancel): Likewise.
      	(finish_unary_fold_expr): Use build_dependent_operator_type.
      	(finish_binary_fold_expr): Likewise.
      	* tree.c (cp_free_lang_data): Don't call discard_operator_bindings.
      	* typeck.c (rationalize_conditional_expr): Adjust call to
      	build_x_binary_op.
      	(op_unqualified_lookup): Define.
      	(build_dependent_operator_type): Define.
      	(build_x_indirect_ref): Add lookups parameter and use
      	build_dependent_operator_type.
      	(build_x_binary_op): Likewise.
      	(build_x_array_ref): Likewise.
      	(build_x_unary_op): Likewise.
      	(build_x_compound_expr_from_list): Adjust call to
      	build_x_compound_expr.
      	(build_x_compound_expr_from_vec): Likewise.
      	(build_x_compound_expr): Add lookups parameter and use
      	build_dependent_operator_type.
      	(cp_build_modify_expr): Adjust call to build_new_op.
      	(build_x_modify_expr): Add lookups parameter and use
      	build_dependent_operator_type.
      	* typeck2.c (build_x_arrow): Adjust call to build_new_op.
      
      libcc1/ChangeLog:
      
      	* libcp1plugin.cc (plugin_build_unary_expr): Adjust call to
      	build_x_unary_op.
      	(plugin_build_binary_expr): Adjust call to build_x_binary_op.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/lookup/operator-3.C: Split out operator overload
      	declarations into ...
      	* g++.dg/lookup/operator-3-ops.h: ... here.
      	* g++.dg/lookup/operator-3a.C: New test.
      	* g++.dg/lookup/operator-4.C: New test.
      	* g++.dg/lookup/operator-4a.C: New test.
      	* g++.dg/lookup/operator-5.C: New test.
      	* g++.dg/lookup/operator-5a.C: New test.
      	* g++.dg/lookup/operator-6.C: New test.
      	* g++.dg/lookup/operator-7.C: New test.
      	* g++.dg/lookup/operator-8.C: New test.
      bb2a7f80
    • GCC Administrator's avatar
      Daily bump. · 8a89c39b
      GCC Administrator authored
      8a89c39b
  17. Dec 15, 2021
  18. Aug 18, 2021
  19. Aug 17, 2021
  20. Jun 29, 2021
  21. Jun 28, 2021
  22. May 06, 2021
  23. May 05, 2021
    • Tom Tromey's avatar
      libcc1: avoid a call to c_str · 61d48b1e
      Tom Tromey authored
      This is a trivial change to libcc1 to avoid an explicit call to c_str.
      Passing by const reference is slightly less wordy.
      
      libcc1
      
      	* compiler.cc (make_regexp): Take const std::string.
      	(cc1_plugin::compiler_triplet_regexp::find): Update.
      
      
      61d48b1e
    • Tom Tromey's avatar
      libcc1: avoid extra string copies · 96deddca
      Tom Tromey authored
      PR c/94669 points out that a couple of spots in libcc1 take a
      std::string where a reference would do.  This changes these spots to
      take a const char *, to reduce the number of copies.
      
      libcc1
      
      	PR c/94669
      	* compiler.hh (compiler_driver_filename): Take const char *.
      	(compiler_triplet_regexp): Likewise.
      96deddca
    • Tom Tromey's avatar
      libcc1: use variadic templates for callbacks · 8fdffa48
      Tom Tromey authored
      This patch completes the transition of libcc1 from the use of separate
      template functions for different arities to the use of variadic
      functions.  This is how I had wanted it to work from the very
      beginning, and is possible now with C++11.
      
      I had thought that variadic callbacks required C++17, but it turns out
      that the approach taken here is basically equivalent to std::apply --
      just a bit wordier.
      
      libcc1
      
      	* rpc.hh (argument_wrapper) <get>: Replace cast operator.
      	(argument_wrapper<T *>) <get>: Likewise.
      	(unmarshall): Add std::tuple overloads.
      	(callback): Remove.
      	(class invoker): New.
      	* libcp1plugin.cc (plugin_init): Update.
      	* libcp1.cc (libcp1::add_callbacks): Update.
      	* libcc1plugin.cc (plugin_init): Update.
      	* libcc1.cc (libcc1::add_callbacks): Update.
      	* connection.cc (cc1_plugin::connection::do_wait): Update.
      
      
      8fdffa48
    • Tom Tromey's avatar
      libcc1: fix a memory leak · ee75ca6b
      Tom Tromey authored
      libcc1 has a memory leak when calling fork_exec -- it allocates a new
      vector of arguments, but then does not free it anywhere.  This patch
      changes this code to use std::vector instead.
      
      Note that the previous code tried to avoid bad_alloc.  I don't believe
      this is very important.  For one thing, plenty of other allocations do
      not bother with this.
      
      libcc1
      
      	* gdbctx.hh (do_compile): Use std::vector.
      
      
      ee75ca6b
    • Tom Tromey's avatar
      libcc1: share the GCC interface code · a8deb832
      Tom Tromey authored
      Both the C and C++ side of the GDB plugin in libcc1 share a lot of
      code relating to the base GCC interface.  It was all copy-and-pasted,
      but is essentially identical between the two.  This is by design, as
      the base GCC API is intended to be shared.
      
      This patch merges the implementations into base_gdb_plugin, which was
      introduced earlier for this purpose.
      
      libcc1
      
      	* libcp1.cc (libcp1): Change parameters.  Update.
      	(libcp1_set_verbose, libcp1_set_arguments)
      	(libcp1_set_triplet_regexp, libcp1_set_driver_filename)
      	(libcp1_set_source_file, libcp1_set_print_callback, fork_exec)
      	(libcp1_compile, libcp1_destroy, vtable): Remove.
      	(libcp1::add_callbacks): New method, extracted from
      	libcp1_compile.
      	(gcc_c_fe_context): Update.
      	* libcc1.cc (libcc1): Change parameters.  Update.
      	(libcc1_set_verbose, libcc1_set_arguments)
      	(libcc1_set_triplet_regexp, libcc1_set_driver_filename)
      	(libcc1_set_source_file, libcc1_set_print_callback, fork_exec)
      	(libcc1_compile, libcc1_destroy, vtable): Remove.
      	(libcc1::add_callbacks): New method, extracted from
      	libcc1_compile.
      	(gcc_c_fe_context): Update.
      	* gdbctx.hh (base_gdb_plugin): Change parameters.
      	(~base_gdb_plugin): New.
      	<add_callbacks>: New virtual method.
      	<plugin_name, fe_version, compiler_name, vtable>: New members.
      	(get_self, do_set_verbose, do_set_arguments)
      	(do_set_triplet_regexp, do_set_driver_filename)
      	(do_set_arguments_v0, do_set_source_file, do_set_print_callback)
      	(fork_exec, do_compile, do_compile_v0, do_destroy): New methods.
      
      
      a8deb832
    • Tom Tromey's avatar
      libcc1: use GCC_FE_VERSION_1 in C++ plugin · b65c0bcb
      Tom Tromey authored
      The C++ plugin defaults to version 0 of the base compiler API.
      However, this is a mistake -- version 1 was introduced before the C++
      API was even implemented.  This switches the default to version 1.
      Note that the compiler-side plugin will accept this version, so it
      should remain compatible.
      
      libcc1
      
      	* libcp1.cc (vtable): Use GCC_FE_VERSION_1.
      
      
      b65c0bcb
    • Tom Tromey's avatar
      libcc1: share GDB plugin code · 1a51cb29
      Tom Tromey authored
      The two GDB plugins in libcc1 share a fair amount of code.  This was
      done by copy-and-paste, though in reality the underlying code is
      nearly identical.
      
      libcc1
      
      	* libcp1.cc (struct libcp1): Derive from base_gdb_plugin.  Remove
      	shared code.
      	(class libcp1_connection): Remove.
      	(rpc): Remove.
      	(libcp1_set_verbose, libcp1_compile): Update.
      	(cp_call_binding_oracle, cp_call_symbol_address)
      	(cp_call_enter_scope, cp_call_leave_scope): Update.
      	* libcc1.cc (struct libcc1): Derive from base_gdb_plugin.  Remove
      	shared code.
      	(class libcc1_connection): Remove.
      	(c_call_binding_oracle, c_call_symbol_address): Update.
      	(rpc): Remove.
      	(libcc1_set_verbose, libcc1_compile): Update.
      	* gdbctx.hh: New file.
      
      
      1a51cb29
    • Tom Tromey's avatar
      libcc1: share basic context code · 06248232
      Tom Tromey authored
      Both plugins in libcc1 share a fair amount of boilerplate.  They both
      share error-emission code, context management code, and tree GC code.
      This patch unifies these two bodies of code, avoiding needless
      duplication.
      
      libcc1
      
      	* libcc1plugin.cc: Move code to context.cc.
      	* libcp1plugin.cc: Move code to context.cc.
      	* context.hh: New file.
      	* context.cc: New file.
      	* Makefile.in: Rebuild.
      	* Makefile.am (AM_CPPFLAGS): Add more gcc flags.
      	(CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): Update.
      	(libcc1plugin_la_SOURCES): Add context.hh, context.cc.
      	(libcp1plugin_la_SOURCES): Likewise.
      
      
      06248232
    • Tom Tromey's avatar
      libcc1: use static_assert · 0ed83e1d
      Tom Tromey authored
      This changes one spot in libcc1 to use static_assert rather than the
      old-style array declaration.
      
      libcc1
      
      	* libcp1plugin.cc: Use static assert.
      
      
      0ed83e1d
    • Tom Tromey's avatar
      libcc1: use foreach · 7c4e5d5e
      Tom Tromey authored
      This changes libcc1 to ues foreach in a couple of spots.
      
      libcc1
      
      	* libcp1plugin.cc (plugin_context::mark): Use foreach.
      	* libcc1plugin.cc (plugin_context::mark): Use foreach.
      
      
      7c4e5d5e
    • Tom Tromey's avatar
      libcc1: unify compiler handling · 1d9c9726
      Tom Tromey authored
      Both libcc1 plugins have nearly identical copies of code to find the
      underlying compiler.  This seemed wasteful to me, so this patch
      unifies the copies.
      
      Two minor API changes were needed.
      
      First, the old code used a back-link from the compiler object to the
      plugin object to check the 'verbose' setting.  This patch adds a
      'verbose' setting directly to the compiler object instead.
      
      Second, the 'find' method implicitly knew which compiler base name
      ("gcc" or "g++") to use.  This patch makes this a parameter that is
      passed in by the plugin.
      
      libcc1
      
      	* libcp1.cc (compiler, compiler_triplet_regexp)
      	(compiler_driver_filename): Remove.
      	(libcp1::libcp1): Update.
      	(make_regexp, libcp1::compiler::find)
      	(libcp1::compiler_triplet_regexp::find)
      	(libcp1::compiler_driver_filename::find): Remove.
      	(libcp1_set_verbose, libcp1_set_arguments)
      	(libcp1_set_triplet_regexp, libcp1_set_driver_filename): Update.
      	* libcc1.cc (compiler, compiler_triplet_regexp)
      	(compiler_driver_filename): Remove.
      	(libcc1::libcc1): Update.
      	(make_regexp, libcc1::compiler::find)
      	(libcc1::compiler_triplet_regexp::find)
      	(libcc1::compiler_driver_filename::find): Remove.
      	(libcc1_set_verbose, libcc1_set_arguments)
      	(libcc1_set_triplet_regexp, libcc1_set_driver_filename): Update.
      	* compiler.cc: New file.
      	* compiler.hh: New file.
      	* Makefile.in: Rebuild.
      	* Makefile.am (libcc1_la_SOURCES): Add compiler.hh, compiler.cc.
      
      1d9c9726
    • Tom Tromey's avatar
      libcc1: use unique_ptr more · 30c9604c
      Tom Tromey authored
      This changes libcc1 to use unique_ptr in a few more places, removing
      some manual memory management.
      
      libcc1
      
      	* libcp1.cc (struct libcp1) <connection, compilerp>: Use
      	unique_ptr.
      	(~libcp1): Remove.
      	(libcp1_compile, libcp1_set_triplet_regexp)
      	(libcp1_set_driver_filename): Update.
      	* libcc1.cc (struct libcc1) <connection, compilerp>: Use
      	unique_ptr.
      	(~libcc1): Remove.
      	(libcc1_set_triplet_regexp, libcc1_set_driver_filename)
      	(libcc1_compile): Update.
      
      
      30c9604c
Loading