Commit Graph

1968 Commits

Author SHA1 Message Date
GCC Administrator
24da863403 Daily bump. 2024-11-18 00:17:28 +00:00
John David Anglin
8f50a07940 hppa: Remove typedef for bool type
In C23, bool is now a keyword.  So, doing a typedef for it is invalid.

2024-11-17  John David Anglin  <danglin@gcc.gnu.org>

libgcc/ChangeLog:

	PR target/117627
	* config/pa/linux-atomic.c: Remove typedef for bool type.
2024-11-17 14:42:39 -05:00
GCC Administrator
a649efea00 Daily bump. 2024-11-17 00:21:19 +00:00
Georg-Johann Lay
307b11179a AVR: Fix building LibF7 after switching to C23.
Since r15-5327, GNU-C23 is being used as C language default.
libf7.h doesn't assume headers like stdbool.h are present
and defines bool, true and false on its own.

libgcc/config/avr/libf7/
	* libf7.h (bool, true, false): Don't define in C23 or higher.
2024-11-16 22:18:51 +01:00
Jakub Jelinek
09ef9756f2 libgcc: Fix a warning/error in libgcc2.c [PR117624]
Since the switch to -std=gnu23 by default, float.h (included from
tsystem.h) defines INFINITY macro (to __builtin_inff ()), which now
results in a warning when compiling libgcc2.c which defines it
to something else (and, worse aarch64 compiles it with -Werror and
build fails).
libgcc2.c asserts INFINITY has the expected type which depends on
the macros with which libgcc2.c is being compiled, so guarding
the define with #ifndef INFINITY wouldn't work.
So this patch instead #undefs the macro before defining it.

2024-11-16  Jakub Jelinek  <jakub@redhat.com>

	PR libgcc/117624
	* libgcc2.c (INFINITY): Add #undef before #define.
2024-11-16 17:04:38 +01:00
GCC Administrator
5673fc0c7b Daily bump. 2024-11-14 17:20:15 +00:00
Szabolcs Nagy
d8374290e5 aarch64: libgcc: add GCS marking to asm
libgcc/ChangeLog:

	* config/aarch64/aarch64-asm.h (FEATURE_1_GCS): Define.
	(GCS_FLAG): Define if GCS is enabled.
	(GNU_PROPERTY): Add GCS_FLAG.
2024-11-14 16:15:12 +00:00
Szabolcs Nagy
2a330ec149 aarch64: Add GCS support to the unwinder
Follows the current linux ABI that uses single signal entry token
and shared shadow stack between thread and alt stack.
Could be behind __ARM_FEATURE_GCS_DEFAULT ifdef (only do anything
special with gcs compat codegen) but there is a runtime check anyway.

Change affected tests to be compatible with -mbranch-protection=standard

libgcc/ChangeLog:

	* config/aarch64/aarch64-unwind.h (_Unwind_Frames_Extra): Update.
	(_Unwind_Frames_Increment): Define.
2024-11-14 16:15:11 +00:00
Christophe Lyon
13a966d56f libgcc: Fix COPY_ARG_VAL initializer (PR 117537)
We recently forced -Werror when building libgcc for aarch64, to make
sure we'd catch and fix the kind of problem described in the PR.

In this case, when building for aarch64_be (so, big endian), gcc emits
this warning/error:
libgcc/config/libbid/bid_conf.h:847:25: error: missing braces around initializer [-Werror=missing-braces]
  847 |        UINT128 arg_name={ bid_##arg_name.w[1], bid_##arg_name.w[0]};
libgcc/config/libbid/bid_conf.h:871:8: note: in expansion of macro 'COPY_ARG_VAL'
  871 |        COPY_ARG_VAL(arg_name)

This patch fixes the problem by adding curly braces around the
initializer for COPY_ARG_VAL in the big endian case.

It seems that COPY_ARG_REF (just above COPY_ARG_VAL) has a similar
issue, but DECIMAL_CALL_BY_REFERENCE seems always defined to 0, so
COPY_ARG_REF is never used.  The patch fixes it too, though.

libgcc/config/libbid/ChangeLog:

	PR libgcc/117537
	* bid_conf.h (COPY_ARG_REF): Fix initializer.
	(COPY_ARG_VAL): Likewise.
2024-11-14 08:59:28 +00:00
GCC Administrator
c232f92161 Daily bump. 2024-10-26 00:19:39 +00:00
Jakub Jelinek
45ab93d9af non-gcc: Remove trailing whitespace
I've tried to build stage3 with
-Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank
added to STRICT_WARN and that expectably resulted in about
2744 unique trailing whitespace warnings and 124837 leading whitespace
warnings when excluding *.md files (which obviously is in big part a
generator issue).  Others from that are generator related, I think those
need to be solved later.

The following patch just fixes up the easy case (trailing whitespace),
which could be easily automated:
for i in `find . -name \*.h -o -name \*.cc -o -name \*.c | xargs grep -l '[ 	]$' | grep -v testsuite/`; do sed -i -e 's/[ 	]*$//' $i; done
I've excluded files which I knew are obviously generated or go FE.

Is there anything else we'd want to avoid the changes?

Due to patch size, I've split it between gcc/ part
and rest (include/, libiberty/, libgcc/, libcpp/, libstdc++-v3/;
this part).

2024-10-24  Jakub Jelinek  <jakub@redhat.com>

include/
	* dyn-string.h: Remove trailing whitespace.
	* libiberty.h: Likewise.
	* xregex.h: Likewise.
	* splay-tree.h: Likewise.
	* partition.h: Likewise.
	* plugin-api.h: Likewise.
	* demangle.h: Likewise.
	* vtv-change-permission.h: Likewise.
	* fibheap.h: Likewise.
	* hsa_ext_image.h: Likewise.
	* hashtab.h: Likewise.
	* libcollector.h: Likewise.
	* sort.h: Likewise.
	* symcat.h: Likewise.
	* hsa_ext_amd.h: Likewise.
libcpp/
	* directives.cc: Remove trailing whitespace.
	* mkdeps.cc: Likewise.
	* line-map.cc: Likewise.
	* internal.h: Likewise.
	* files.cc: Likewise.
	* init.cc: Likewise.
	* makeucnid.cc: Likewise.
	* system.h: Likewise.
	* include/line-map.h: Likewise.
	* include/symtab.h: Likewise.
	* include/cpplib.h: Likewise.
	* expr.cc: Likewise.
	* charset.cc: Likewise.
	* macro.cc: Likewise.
	* errors.cc: Likewise.
	* lex.cc: Likewise.
	* traditional.cc: Likewise.
libgcc/
	* crtstuff.c: Remove trailing whitespace.
	* libgcov.h: Likewise.
	* config/alpha/crtfastmath.c: Likewise.
	* config/alpha/vms-gcc_shell_handler.c: Likewise.
	* config/alpha/vms-unwind.h: Likewise.
	* config/pa/linux-atomic.c: Likewise.
	* config/pa/linux-unwind.h: Likewise.
	* config/pa/quadlib.c: Likewise.
	* config/pa/fptr.c: Likewise.
	* config/s390/32/_fixsfdi.c: Likewise.
	* config/s390/32/_fixunssfdi.c: Likewise.
	* config/s390/32/_fixunsdfdi.c: Likewise.
	* config/c6x/pr-support.c: Likewise.
	* config/lm32/_udivsi3.c: Likewise.
	* config/lm32/libgcc_lm32.h: Likewise.
	* config/lm32/_udivmodsi4.c: Likewise.
	* config/lm32/_mulsi3.c: Likewise.
	* config/lm32/_modsi3.c: Likewise.
	* config/lm32/_umodsi3.c: Likewise.
	* config/lm32/_divsi3.c: Likewise.
	* config/darwin-crt3.c: Likewise.
	* config/msp430/mpy.c: Likewise.
	* config/ia64/tf-signs.c: Likewise.
	* config/ia64/fde-vms.c: Likewise.
	* config/ia64/unwind-ia64.c: Likewise.
	* config/ia64/vms-unwind.h: Likewise.
	* config/ia64/sfp-exceptions.c: Likewise.
	* config/ia64/quadlib.c: Likewise.
	* config/ia64/unwind-ia64.h: Likewise.
	* config/rl78/vregs.h: Likewise.
	* config/arm/bpabi.c: Likewise.
	* config/arm/unwind-arm.c: Likewise.
	* config/arm/pr-support.c: Likewise.
	* config/arm/linux-atomic.c: Likewise.
	* config/arm/bpabi-lib.h: Likewise.
	* config/frv/frvend.c: Likewise.
	* config/frv/cmovw.c: Likewise.
	* config/frv/frvbegin.c: Likewise.
	* config/frv/cmovd.c: Likewise.
	* config/frv/cmovh.c: Likewise.
	* config/aarch64/cpuinfo.c: Likewise.
	* config/i386/crtfastmath.c: Likewise.
	* config/i386/cygming-crtend.c: Likewise.
	* config/i386/32/tf-signs.c: Likewise.
	* config/i386/crtprec.c: Likewise.
	* config/i386/sfp-exceptions.c: Likewise.
	* config/i386/w32-unwind.h: Likewise.
	* config/m32r/initfini.c: Likewise.
	* config/sparc/crtfastmath.c: Likewise.
	* config/gcn/amdgcn_veclib.h: Likewise.
	* config/nios2/linux-atomic.c: Likewise.
	* config/nios2/linux-unwind.h: Likewise.
	* config/nios2/lib2-mul.c: Likewise.
	* config/nios2/lib2-nios2.h: Likewise.
	* config/xtensa/unwind-dw2-xtensa.c: Likewise.
	* config/rs6000/darwin-fallback.c: Likewise.
	* config/rs6000/ibm-ldouble.c: Likewise.
	* config/rs6000/sfp-machine.h: Likewise.
	* config/rs6000/darwin-asm.h: Likewise.
	* config/rs6000/darwin-crt2.c: Likewise.
	* config/rs6000/aix-unwind.h: Likewise.
	* config/rs6000/sfp-exceptions.c: Likewise.
	* config/gthr-vxworks.c: Likewise.
	* config/riscv/atomic.c: Likewise.
	* config/visium/memcpy.c: Likewise.
	* config/darwin-crt-tm.c: Likewise.
	* config/stormy16/lib2funcs.c: Likewise.
	* config/arc/ieee-754/divtab-arc-sf.c: Likewise.
	* config/arc/ieee-754/divtab-arc-df.c: Likewise.
	* config/arc/initfini.c: Likewise.
	* config/sol2/gmon.c: Likewise.
	* config/microblaze/divsi3_table.c: Likewise.
	* config/m68k/fpgnulib.c: Likewise.
	* libgcov-driver.c: Likewise.
	* unwind-dw2.c: Likewise.
	* fp-bit.c: Likewise.
	* dfp-bit.h: Likewise.
	* dfp-bit.c: Likewise.
	* libgcov-driver-system.c: Likewise.
libgcc/config/libbid/
	* _le_td.c: Remove trailing whitespace.
	* bid128_compare.c: Likewise.
	* bid_div_macros.h: Likewise.
	* bid64_to_bid128.c: Likewise.
	* bid64_to_uint32.c: Likewise.
	* bid128_to_uint64.c: Likewise.
	* bid64_div.c: Likewise.
	* bid128_round_integral.c: Likewise.
	* bid_binarydecimal.c: Likewise.
	* bid128_string.c: Likewise.
	* bid_flag_operations.c: Likewise.
	* bid128_to_int64.c: Likewise.
	* _mul_sd.c: Likewise.
	* bid64_mul.c: Likewise.
	* bid128_noncomp.c: Likewise.
	* _gt_dd.c: Likewise.
	* bid64_add.c: Likewise.
	* bid64_string.c: Likewise.
	* bid_from_int.c: Likewise.
	* bid128.c: Likewise.
	* _ge_dd.c: Likewise.
	* _ne_sd.c: Likewise.
	* _dd_to_td.c: Likewise.
	* _unord_sd.c: Likewise.
	* bid64_to_uint64.c: Likewise.
	* _gt_sd.c: Likewise.
	* _sd_to_td.c: Likewise.
	* _addsub_td.c: Likewise.
	* _ne_td.c: Likewise.
	* bid_dpd.c: Likewise.
	* bid128_add.c: Likewise.
	* bid128_next.c: Likewise.
	* _lt_sd.c: Likewise.
	* bid64_next.c: Likewise.
	* bid128_mul.c: Likewise.
	* _lt_dd.c: Likewise.
	* _ge_td.c: Likewise.
	* _unord_dd.c: Likewise.
	* bid64_sqrt.c: Likewise.
	* bid_sqrt_macros.h: Likewise.
	* bid64_fma.c: Likewise.
	* _sd_to_dd.c: Likewise.
	* bid_conf.h: Likewise.
	* bid64_noncomp.c: Likewise.
	* bid_gcc_intrinsics.h: Likewise.
	* _gt_td.c: Likewise.
	* _ge_sd.c: Likewise.
	* bid128_minmax.c: Likewise.
	* bid128_quantize.c: Likewise.
	* bid32_to_bid64.c: Likewise.
	* bid_round.c: Likewise.
	* _td_to_sd.c: Likewise.
	* bid_inline_add.h: Likewise.
	* bid128_fma.c: Likewise.
	* _eq_td.c: Likewise.
	* bid32_to_bid128.c: Likewise.
	* bid64_rem.c: Likewise.
	* bid128_2_str_tables.c: Likewise.
	* _mul_dd.c: Likewise.
	* _dd_to_sd.c: Likewise.
	* bid128_div.c: Likewise.
	* _lt_td.c: Likewise.
	* bid64_compare.c: Likewise.
	* bid64_to_int32.c: Likewise.
	* _unord_td.c: Likewise.
	* bid128_rem.c: Likewise.
	* bid_internal.h: Likewise.
	* bid64_to_int64.c: Likewise.
	* _eq_dd.c: Likewise.
	* _td_to_dd.c: Likewise.
	* bid128_to_int32.c: Likewise.
	* bid128_to_uint32.c: Likewise.
	* _ne_dd.c: Likewise.
	* bid64_quantize.c: Likewise.
	* _le_dd.c: Likewise.
	* bid64_round_integral.c: Likewise.
	* _le_sd.c: Likewise.
	* bid64_minmax.c: Likewise.
libgcc/config/avr/libf7/
	* f7-renames.h: Remove trailing whitespace.
libstdc++-v3/
	* include/debug/debug.h: Remove trailing whitespace.
	* include/parallel/base.h: Likewise.
	* include/parallel/types.h: Likewise.
	* include/parallel/settings.h: Likewise.
	* include/parallel/multiseq_selection.h: Likewise.
	* include/parallel/partition.h: Likewise.
	* include/parallel/random_number.h: Likewise.
	* include/parallel/find_selectors.h: Likewise.
	* include/parallel/partial_sum.h: Likewise.
	* include/parallel/list_partition.h: Likewise.
	* include/parallel/search.h: Likewise.
	* include/parallel/algorithmfwd.h: Likewise.
	* include/parallel/random_shuffle.h: Likewise.
	* include/parallel/multiway_mergesort.h: Likewise.
	* include/parallel/sort.h: Likewise.
	* include/parallel/algobase.h: Likewise.
	* include/parallel/numericfwd.h: Likewise.
	* include/parallel/multiway_merge.h: Likewise.
	* include/parallel/losertree.h: Likewise.
	* include/bits/basic_ios.h: Likewise.
	* include/bits/stringfwd.h: Likewise.
	* include/bits/ostream_insert.h: Likewise.
	* include/bits/stl_heap.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.
	* include/bits/valarray_before.h: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/postypes.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/localefwd.h: Likewise.
	* include/bits/stl_algo.h: Likewise.
	* include/bits/ios_base.h: Likewise.
	* include/bits/stl_function.h: Likewise.
	* include/bits/basic_string.h: Likewise.
	* include/bits/hashtable.h: Likewise.
	* include/bits/valarray_after.h: Likewise.
	* include/bits/char_traits.h: Likewise.
	* include/bits/gslice.h: Likewise.
	* include/bits/locale_facets_nonio.h: Likewise.
	* include/bits/mask_array.h: Likewise.
	* include/bits/specfun.h: Likewise.
	* include/bits/random.h: Likewise.
	* include/bits/slice_array.h: Likewise.
	* include/bits/valarray_array.h: Likewise.
	* include/tr1/float.h: Likewise.
	* include/tr1/functional_hash.h: Likewise.
	* include/tr1/math.h: Likewise.
	* include/tr1/hashtable_policy.h: Likewise.
	* include/tr1/stdio.h: Likewise.
	* include/tr1/complex.h: Likewise.
	* include/tr1/stdbool.h: Likewise.
	* include/tr1/stdarg.h: Likewise.
	* include/tr1/inttypes.h: Likewise.
	* include/tr1/fenv.h: Likewise.
	* include/tr1/stdlib.h: Likewise.
	* include/tr1/wchar.h: Likewise.
	* include/tr1/tgmath.h: Likewise.
	* include/tr1/limits.h: Likewise.
	* include/tr1/wctype.h: Likewise.
	* include/tr1/stdint.h: Likewise.
	* include/tr1/ctype.h: Likewise.
	* include/tr1/random.h: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/ext/sso_string_base.h: Likewise.
	* include/ext/debug_allocator.h: Likewise.
	* include/ext/vstring_fwd.h: Likewise.
	* include/ext/pointer.h: Likewise.
	* include/ext/pod_char_traits.h: Likewise.
	* include/ext/malloc_allocator.h: Likewise.
	* include/ext/vstring.h: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/pool_allocator.h: Likewise.
	* include/ext/type_traits.h: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/ext/codecvt_specializations.h: Likewise.
	* include/ext/throw_allocator.h: Likewise.
	* include/ext/extptr_allocator.h: Likewise.
	* include/ext/atomicity.h: Likewise.
	* include/ext/concurrence.h: Likewise.
	* include/c_compatibility/wchar.h: Likewise.
	* include/c_compatibility/stdint.h: Likewise.
	* include/backward/hash_fun.h: Likewise.
	* include/backward/binders.h: Likewise.
	* include/backward/hashtable.h: Likewise.
	* include/backward/auto_ptr.h: Likewise.
	* libsupc++/eh_arm.cc: Likewise.
	* libsupc++/unwind-cxx.h: Likewise.
	* libsupc++/si_class_type_info.cc: Likewise.
	* libsupc++/vec.cc: Likewise.
	* libsupc++/class_type_info.cc: Likewise.
	* libsupc++/vmi_class_type_info.cc: Likewise.
	* libsupc++/guard_error.cc: Likewise.
	* libsupc++/bad_typeid.cc: Likewise.
	* libsupc++/eh_personality.cc: Likewise.
	* libsupc++/atexit_arm.cc: Likewise.
	* libsupc++/pmem_type_info.cc: Likewise.
	* libsupc++/vterminate.cc: Likewise.
	* libsupc++/eh_terminate.cc: Likewise.
	* libsupc++/bad_cast.cc: Likewise.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/eh_throw.cc: Likewise.
	* libsupc++/bad_alloc.cc: Likewise.
	* libsupc++/nested_exception.cc: Likewise.
	* libsupc++/pointer_type_info.cc: Likewise.
	* libsupc++/pbase_type_info.cc: Likewise.
	* libsupc++/bad_array_new.cc: Likewise.
	* libsupc++/pure.cc: Likewise.
	* libsupc++/eh_exception.cc: Likewise.
	* libsupc++/bad_array_length.cc: Likewise.
	* libsupc++/cxxabi.h: Likewise.
	* libsupc++/guard.cc: Likewise.
	* libsupc++/eh_catch.cc: Likewise.
	* libsupc++/cxxabi_forced.h: Likewise.
	* libsupc++/tinfo.h: Likewise.
2024-10-25 10:03:17 +02:00
David Malcolm
bf43fe6aa9 Use unique_ptr in more places in pretty_printer/diagnostics [PR116613]
My forthcoming patches for PR other/116613 make much more use of
cloning of pretty_printers than before, so it makes sense as a
preliminary patch for the result of pretty_printer::clone to be a
std::unique_ptr, rather than add more manual uses of "delete".

On doing so, I noticed various other places where naked new/delete is
used for run-time configuration of diagnostics:
* the output format (text vs SARIF)
* client data hooks
* the option manager
* the URLifier

Hence this patch also makes use of std::unique_ptr and ::make_unique for
managing such client policy classes, and also for diagnostic_buffer's
per-format implementations.

Unfortunately we can't directly include <memory> in our internal headers
but instead any of our TUs that make use of std::unique_ptr must #define
INCLUDE_MEMORY before including system.h.

Hence the bulk of this patch is taken up with adding a define of
INCLUDE_MEMORY to hundreds of source files: everything that includes
diagnostic.h or pretty-print.h (and thus anything transitively such as
includers of lto-wrapper.h, c-tree.h, cp-tree.h and rtl-ssa.h).

Thanks to Gaius Mulley for the parts of the patch that regenerated the
m2 files.

gcc/ada/ChangeLog:
	PR other/116613
	* gcc-interface/misc.cc: Add #define INCLUDE_MEMORY
	* gcc-interface/trans.cc: Likewise.
	* gcc-interface/utils.cc: Likewise.

gcc/analyzer/ChangeLog:
	PR other/116613
	* analyzer-logging.cc: Add #define INCLUDE_MEMORY
	(logger::logger): Update for m_pp becoming a unique_ptr.
	(logger::~logger): Likewise.
	(logger::log_va_partial): Likewise.
	(logger::end_log_line): Likewise.
	* analyzer-logging.h (logger::get_printer): Likewise.
	(logger::m_pp): Convert to a unique_ptr.
	* analyzer.cc (make_label_text): Use
	diagnostic_context::clone_printer and use unique_ptr.
	(make_label_text_n): Likewise.
	* bar-chart.cc: Add #define INCLUDE_MEMORY
	* pending-diagnostic.cc (evdesc::event_desc::formatted_print):
	Use diagnostic_context::clone_printer and use unique_ptr.
	* sm-malloc.cc (sufficiently_similar_p): Likewise.
	* supergraph.cc (supergraph::dump_dot_to_file): Likewise.

gcc/c-family/ChangeLog:
	PR other/116613
	* c-ada-spec.cc: Add #define INCLUDE_MEMORY.
	* c-attribs.cc: Likewise.
	* c-common.cc: Likewise.
	* c-format.cc: Likewise.
	* c-gimplify.cc: Likewise.
	* c-indentation.cc: Likewise.
	* c-opts.cc: Likewise.
	* c-pch.cc: Likewise.
	* c-pragma.cc: Likewise.
	* c-pretty-print.cc: Likewise.  Add #include "make-unique.h".
	(c_pretty_printer::clone): Use std::unique_ptr and ::make_unique.
	* c-pretty-print.h (c_pretty_printer::clone): Use std::unique_ptr.
	* c-type-mismatch.cc: Add #define INCLUDE_MEMORY.
	* c-warn.cc: Likewise.

gcc/c/ChangeLog:
	PR other/116613
	* c-aux-info.cc: Add #define INCLUDE_MEMORY.
	* c-convert.cc: Likewise.
	* c-errors.cc: Likewise.
	* c-fold.cc: Likewise.
	* c-lang.cc: Likewise.
	* c-objc-common.cc: Likewise.
	(pp_markup::element_quoted_type::print_type): Use unique_ptr.
	* c-typeck.cc: Add #define INCLUDE_MEMORY.
	* gimple-parser.cc: Likewise.

gcc/cp/ChangeLog:
	PR other/116613
	* call.cc: Add #define INCLUDE_MEMORY.
	* class.cc: Likewise.
	* constexpr.cc: Likewise.
	* constraint.cc: Likewise.
	* contracts.cc: Likewise.
	* coroutines.cc: Likewise.
	* cp-gimplify.cc: Likewise.
	* cp-lang.cc: Likewise.
	* cp-objcp-common.cc: Likewise.
	* cp-ubsan.cc: Likewise.
	* cvt.cc: Likewise.
	* cxx-pretty-print.cc: Likewise.  Add #include "cp-tree.h".
	(cxx_pretty_printer::clone): Use std::unique_ptr and
	::make_unique.
	* cxx-pretty-print.h (cxx_pretty_printer::clone): Use
	std::unique_ptr.
	* decl2.cc: Add #define INCLUDE_MEMORY.
	* dump.cc: Likewise.
	* except.cc: Likewise.
	* expr.cc: Likewise.
	* friend.cc: Likewise.
	* init.cc: Likewise.
	* lambda.cc: Likewise.
	* logic.cc: Likewise.
	* mangle.cc: Likewise.
	* method.cc: Likewise.
	* optimize.cc: Likewise.
	* pt.cc: Likewise.
	* ptree.cc: Likewise.
	* rtti.cc: Likewise.
	* search.cc: Likewise.
	* semantics.cc: Likewise.
	* tree.cc: Likewise.
	* typeck.cc: Likewise.
	* typeck2.cc: Likewise.
	* vtable-class-hierarchy.cc: Likewise.

gcc/d/ChangeLog:
	PR other/116613
	* d-attribs.cc: Add #define INCLUDE_MEMORY.
	* d-builtins.cc: Likewise.
	* d-codegen.cc: Likewise.
	* d-convert.cc: Likewise.
	* d-diagnostic.cc: Likewise.
	* d-frontend.cc: Likewise.
	* d-lang.cc: Likewise.
	* d-longdouble.cc: Likewise.
	* d-target.cc: Likewise.
	* decl.cc: Likewise.
	* expr.cc: Likewise.
	* intrinsics.cc: Likewise.
	* modules.cc: Likewise.
	* toir.cc: Likewise.
	* typeinfo.cc: Likewise.
	* types.cc: Likewise.

gcc/fortran/ChangeLog:
	PR other/116613
	* arith.cc: Add #define INCLUDE_MEMORY.
	* array.cc: Likewise.
	* bbt.cc: Likewise.
	* check.cc: Likewise.
	* class.cc: Likewise.
	* constructor.cc: Likewise.
	* convert.cc: Likewise.
	* cpp.cc: Likewise.
	* data.cc: Likewise.
	* decl.cc: Likewise.
	* dependency.cc: Likewise.
	* dump-parse-tree.cc: Likewise.
	* error.cc: Likewise.
	* expr.cc: Likewise.
	* f95-lang.cc: Likewise.
	* frontend-passes.cc: Likewise.
	* interface.cc: Likewise.
	* intrinsic.cc: Likewise.
	* io.cc: Likewise.
	* iresolve.cc: Likewise.
	* match.cc: Likewise.
	* matchexp.cc: Likewise.
	* misc.cc: Likewise.
	* module.cc: Likewise.
	* openmp.cc: Likewise.
	* options.cc: Likewise.
	* parse.cc: Likewise.
	* primary.cc: Likewise.
	* resolve.cc: Likewise.
	* scanner.cc: Likewise.
	* simplify.cc: Likewise.
	* st.cc: Likewise.
	* symbol.cc: Likewise.
	* target-memory.cc: Likewise.
	* trans-array.cc: Likewise.
	* trans-common.cc: Likewise.
	* trans-const.cc: Likewise.
	* trans-decl.cc: Likewise.
	* trans-expr.cc: Likewise.
	* trans-intrinsic.cc: Likewise.
	* trans-io.cc: Likewise.
	* trans-openmp.cc: Likewise.
	* trans-stmt.cc: Likewise.
	* trans-types.cc: Likewise.
	* trans.cc: Likewise.

gcc/go/ChangeLog:
	PR other/116613
	* go-backend.cc: Add #define INCLUDE_MEMORY.
	* go-lang.cc: Likewise.

gcc/jit/ChangeLog:
	PR other/116613
	* dummy-frontend.cc: Add #define INCLUDE_MEMORY.
	* jit-playback.cc: Likewise.
	* jit-recording.cc: Likewise.

gcc/lto/ChangeLog:
	PR other/116613
	* lto-common.cc: Add #define INCLUDE_MEMORY.
	* lto-dump.cc: Likewise.
	* lto-partition.cc: Likewise.
	* lto-symtab.cc: Likewise.
	* lto.cc: Likewise.

gcc/m2/ChangeLog:
	PR other/116613
	* gm2-gcc/gcc-consolidation.h: Add #define INCLUDE_MEMORY.
	* gm2-gcc/m2configure.cc: Likewise.
	* mc-boot/GASCII.cc: Regenerate.
	* mc-boot/GASCII.h: Ditto.
	* mc-boot/GArgs.cc: Ditto.
	* mc-boot/GArgs.h: Ditto.
	* mc-boot/GAssertion.cc: Ditto.
	* mc-boot/GAssertion.h: Ditto.
	* mc-boot/GBreak.cc: Ditto.
	* mc-boot/GBreak.h: Ditto.
	* mc-boot/GCOROUTINES.h: Ditto.
	* mc-boot/GCmdArgs.cc: Ditto.
	* mc-boot/GCmdArgs.h: Ditto.
	* mc-boot/GDebug.cc: Ditto.
	* mc-boot/GDebug.h: Ditto.
	* mc-boot/GDynamicStrings.cc: Ditto.
	* mc-boot/GDynamicStrings.h: Ditto.
	* mc-boot/GEnvironment.cc: Ditto.
	* mc-boot/GEnvironment.h: Ditto.
	* mc-boot/GFIO.cc: Ditto.
	* mc-boot/GFIO.h: Ditto.
	* mc-boot/GFormatStrings.cc: Ditto.
	* mc-boot/GFormatStrings.h: Ditto.
	* mc-boot/GFpuIO.cc: Ditto.
	* mc-boot/GFpuIO.h: Ditto.
	* mc-boot/GIO.cc: Ditto.
	* mc-boot/GIO.h: Ditto.
	* mc-boot/GIndexing.cc: Ditto.
	* mc-boot/GIndexing.h: Ditto.
	* mc-boot/GM2Dependent.cc: Ditto.
	* mc-boot/GM2Dependent.h: Ditto.
	* mc-boot/GM2EXCEPTION.cc: Ditto.
	* mc-boot/GM2EXCEPTION.h: Ditto.
	* mc-boot/GM2RTS.cc: Ditto.
	* mc-boot/GM2RTS.h: Ditto.
	* mc-boot/GMemUtils.cc: Ditto.
	* mc-boot/GMemUtils.h: Ditto.
	* mc-boot/GNumberIO.cc: Ditto.
	* mc-boot/GNumberIO.h: Ditto.
	* mc-boot/GPushBackInput.cc: Ditto.
	* mc-boot/GPushBackInput.h: Ditto.
	* mc-boot/GRTExceptions.cc: Ditto.
	* mc-boot/GRTExceptions.h: Ditto.
	* mc-boot/GRTco.h: Ditto.
	* mc-boot/GRTentity.h: Ditto.
	* mc-boot/GRTint.cc: Ditto.
	* mc-boot/GRTint.h: Ditto.
	* mc-boot/GSArgs.cc: Ditto.
	* mc-boot/GSArgs.h: Ditto.
	* mc-boot/GSFIO.cc: Ditto.
	* mc-boot/GSFIO.h: Ditto.
	* mc-boot/GSYSTEM.h: Ditto.
	* mc-boot/GSelective.h: Ditto.
	* mc-boot/GStdIO.cc: Ditto.
	* mc-boot/GStdIO.h: Ditto.
	* mc-boot/GStorage.cc: Ditto.
	* mc-boot/GStorage.h: Ditto.
	* mc-boot/GStrCase.cc: Ditto.
	* mc-boot/GStrCase.h: Ditto.
	* mc-boot/GStrIO.cc: Ditto.
	* mc-boot/GStrIO.h: Ditto.
	* mc-boot/GStrLib.cc: Ditto.
	* mc-boot/GStrLib.h: Ditto.
	* mc-boot/GStringConvert.cc: Ditto.
	* mc-boot/GStringConvert.h: Ditto.
	* mc-boot/GSysExceptions.h: Ditto.
	* mc-boot/GSysStorage.cc: Ditto.
	* mc-boot/GSysStorage.h: Ditto.
	* mc-boot/GTimeString.cc: Ditto.
	* mc-boot/GTimeString.h: Ditto.
	* mc-boot/GUnixArgs.h: Ditto.
	* mc-boot/Galists.cc: Ditto.
	* mc-boot/Galists.h: Ditto.
	* mc-boot/Gdecl.cc: Ditto.
	* mc-boot/Gdecl.h: Ditto.
	* mc-boot/Gdtoa.h: Ditto.
	* mc-boot/Gerrno.h: Ditto.
	* mc-boot/Gkeyc.cc: Ditto.
	* mc-boot/Gkeyc.h: Ditto.
	* mc-boot/Gldtoa.h: Ditto.
	* mc-boot/Glibc.h: Ditto.
	* mc-boot/Glibm.h: Ditto.
	* mc-boot/Glists.cc: Ditto.
	* mc-boot/Glists.h: Ditto.
	* mc-boot/GmcComment.cc: Ditto.
	* mc-boot/GmcComment.h: Ditto.
	* mc-boot/GmcComp.cc: Ditto.
	* mc-boot/GmcComp.h: Ditto.
	* mc-boot/GmcDebug.cc: Ditto.
	* mc-boot/GmcDebug.h: Ditto.
	* mc-boot/GmcError.cc: Ditto.
	* mc-boot/GmcError.h: Ditto.
	* mc-boot/GmcFileName.cc: Ditto.
	* mc-boot/GmcFileName.h: Ditto.
	* mc-boot/GmcLexBuf.cc: Ditto.
	* mc-boot/GmcLexBuf.h: Ditto.
	* mc-boot/GmcMetaError.cc: Ditto.
	* mc-boot/GmcMetaError.h: Ditto.
	* mc-boot/GmcOptions.cc: Ditto.
	* mc-boot/GmcOptions.h: Ditto.
	* mc-boot/GmcPreprocess.cc: Ditto.
	* mc-boot/GmcPreprocess.h: Ditto.
	* mc-boot/GmcPretty.cc: Ditto.
	* mc-boot/GmcPretty.h: Ditto.
	* mc-boot/GmcPrintf.cc: Ditto.
	* mc-boot/GmcPrintf.h: Ditto.
	* mc-boot/GmcQuiet.cc: Ditto.
	* mc-boot/GmcQuiet.h: Ditto.
	* mc-boot/GmcReserved.cc: Ditto.
	* mc-boot/GmcReserved.h: Ditto.
	* mc-boot/GmcSearch.cc: Ditto.
	* mc-boot/GmcSearch.h: Ditto.
	* mc-boot/GmcStack.cc: Ditto.
	* mc-boot/GmcStack.h: Ditto.
	* mc-boot/GmcStream.cc: Ditto.
	* mc-boot/GmcStream.h: Ditto.
	* mc-boot/Gmcflex.h: Ditto.
	* mc-boot/Gmcp1.cc: Ditto.
	* mc-boot/Gmcp1.h: Ditto.
	* mc-boot/Gmcp2.cc: Ditto.
	* mc-boot/Gmcp2.h: Ditto.
	* mc-boot/Gmcp3.cc: Ditto.
	* mc-boot/Gmcp3.h: Ditto.
	* mc-boot/Gmcp4.cc: Ditto.
	* mc-boot/Gmcp4.h: Ditto.
	* mc-boot/Gmcp5.cc: Ditto.
	* mc-boot/Gmcp5.h: Ditto.
	* mc-boot/GnameKey.cc: Ditto.
	* mc-boot/GnameKey.h: Ditto.
	* mc-boot/GsymbolKey.cc: Ditto.
	* mc-boot/GsymbolKey.h: Ditto.
	* mc-boot/Gtermios.h: Ditto.
	* mc-boot/Gtop.cc: Ditto.
	* mc-boot/Gvarargs.cc: Ditto.
	* mc-boot/Gvarargs.h: Ditto.
	* mc-boot/Gwlists.cc: Ditto.
	* mc-boot/Gwlists.h: Ditto.
	* mc-boot/Gwrapc.h: Ditto.
	* mc/keyc.mod (checkGccConfigSystem): Add
	#define INCLUDE_MEMORY.
	* pge-boot/GASCII.cc: Regenerate.
	* pge-boot/GASCII.h: Ditto.
	* pge-boot/GArgs.cc: Ditto.
	* pge-boot/GArgs.h: Ditto.
	* pge-boot/GAssertion.cc: Ditto.
	* pge-boot/GAssertion.h: Ditto.
	* pge-boot/GBreak.h: Ditto.
	* pge-boot/GCmdArgs.h: Ditto.
	* pge-boot/GDebug.cc: Ditto.
	* pge-boot/GDebug.h: Ditto.
	* pge-boot/GDynamicStrings.cc: Ditto.
	* pge-boot/GDynamicStrings.h: Ditto.
	* pge-boot/GEnvironment.h: Ditto.
	* pge-boot/GFIO.cc: Ditto.
	* pge-boot/GFIO.h: Ditto.
	* pge-boot/GFormatStrings.h: Ditto.
	* pge-boot/GFpuIO.h: Ditto.
	* pge-boot/GIO.cc: Ditto.
	* pge-boot/GIO.h: Ditto.
	* pge-boot/GIndexing.cc: Ditto.
	* pge-boot/GIndexing.h: Ditto.
	* pge-boot/GLists.cc: Ditto.
	* pge-boot/GLists.h: Ditto.
	* pge-boot/GM2Dependent.cc: Ditto.
	* pge-boot/GM2Dependent.h: Ditto.
	* pge-boot/GM2EXCEPTION.cc: Ditto.
	* pge-boot/GM2EXCEPTION.h: Ditto.
	* pge-boot/GM2RTS.cc: Ditto.
	* pge-boot/GM2RTS.h: Ditto.
	* pge-boot/GNameKey.cc: Ditto.
	* pge-boot/GNameKey.h: Ditto.
	* pge-boot/GNumberIO.cc: Ditto.
	* pge-boot/GNumberIO.h: Ditto.
	* pge-boot/GOutput.cc: Ditto.
	* pge-boot/GOutput.h: Ditto.
	* pge-boot/GPushBackInput.cc: Ditto.
	* pge-boot/GPushBackInput.h: Ditto.
	* pge-boot/GRTExceptions.cc: Ditto.
	* pge-boot/GRTExceptions.h: Ditto.
	* pge-boot/GSArgs.h: Ditto.
	* pge-boot/GSEnvironment.h: Ditto.
	* pge-boot/GSFIO.cc: Ditto.
	* pge-boot/GSFIO.h: Ditto.
	* pge-boot/GSYSTEM.h: Ditto.
	* pge-boot/GScan.h: Ditto.
	* pge-boot/GStdIO.cc: Ditto.
	* pge-boot/GStdIO.h: Ditto.
	* pge-boot/GStorage.cc: Ditto.
	* pge-boot/GStorage.h: Ditto.
	* pge-boot/GStrCase.cc: Ditto.
	* pge-boot/GStrCase.h: Ditto.
	* pge-boot/GStrIO.cc: Ditto.
	* pge-boot/GStrIO.h: Ditto.
	* pge-boot/GStrLib.cc: Ditto.
	* pge-boot/GStrLib.h: Ditto.
	* pge-boot/GStringConvert.h: Ditto.
	* pge-boot/GSymbolKey.cc: Ditto.
	* pge-boot/GSymbolKey.h: Ditto.
	* pge-boot/GSysExceptions.h: Ditto.
	* pge-boot/GSysStorage.cc: Ditto.
	* pge-boot/GSysStorage.h: Ditto.
	* pge-boot/GTimeString.h: Ditto.
	* pge-boot/GUnixArgs.h: Ditto.
	* pge-boot/Gbnflex.cc: Ditto.
	* pge-boot/Gbnflex.h: Ditto.
	* pge-boot/Gdtoa.h: Ditto.
	* pge-boot/Gerrno.h: Ditto.
	* pge-boot/Gldtoa.h: Ditto.
	* pge-boot/Glibc.h: Ditto.
	* pge-boot/Glibm.h: Ditto.
	* pge-boot/Gpge.cc: Ditto.
	* pge-boot/Gtermios.h: Ditto.
	* pge-boot/Gwrapc.h: Ditto.

gcc/objc/ChangeLog:
	PR other/116613
	* objc-act.cc: Add #define INCLUDE_MEMORY.
	* objc-encoding.cc: Likewise.
	* objc-gnu-runtime-abi-01.cc: Likewise.
	* objc-lang.cc: Likewise.
	* objc-next-runtime-abi-01.cc: Likewise.
	* objc-next-runtime-abi-02.cc: Likewise.
	* objc-runtime-shared-support.cc: Likewise.

gcc/objcp/ChangeLog:: Add #define INCLUDE_MEMORY.
	PR other/116613
	* objcp-decl.cc
	* objcp-lang.cc: Likewise.

gcc/rust/ChangeLog:
	PR other/116613
	* resolve/rust-ast-resolve-expr.cc: Add #define INCLUDE_MEMORY.
	* rust-attribs.cc: Likewise.
	* rust-system.h: Likewise.

gcc/ChangeLog:
	PR other/116613
	* asan.cc: Add #define INCLUDE_MEMORY.
	* attribs.cc: Likewise.
	(attr_access::array_as_string): Use
	diagnostic_context::clone_printer and use unique_ptr.
	* auto-profile.cc: Add #define INCLUDE_MEMORY.
	* calls.cc: Likewise.
	* cfganal.cc: Likewise.
	* cfgexpand.cc: Likewise.
	* cfghooks.cc: Likewise.
	* cfgloop.cc: Likewise.
	* cgraph.cc: Likewise.
	* cgraphclones.cc: Likewise.
	* cgraphunit.cc: Likewise.
	* collect-utils.cc: Likewise.
	* collect2.cc: Likewise.
	* common/config/aarch64/aarch64-common.cc: Likewise.
	* common/config/arm/arm-common.cc: Likewise.
	* common/config/avr/avr-common.cc: Likewise.
	* config/aarch64/aarch64-cc-fusion.cc: Likewise.
	* config/aarch64/aarch64-early-ra.cc: Likewise.
	* config/aarch64/aarch64-sve-builtins.cc: Likewise.
	* config/arc/arc.cc: Likewise.
	* config/arm/aarch-common.cc: Likewise.
	* config/arm/arm-mve-builtins.cc: Likewise.
	* config/avr/avr-devices.cc: Likewise.
	* config/avr/driver-avr.cc: Likewise.
	* config/bpf/bpf.cc: Likewise.
	* config/bpf/btfext-out.cc: Likewise.
	* config/bpf/core-builtins.cc: Likewise.
	* config/darwin.cc: Likewise.
	* config/i386/driver-i386.cc: Likewise.
	* config/i386/i386-builtins.cc: Likewise.
	* config/i386/i386-expand.cc: Likewise.
	* config/i386/i386-features.cc: Likewise.
	* config/i386/i386-options.cc: Likewise.
	* config/loongarch/loongarch-builtins.cc: Likewise.
	* config/mingw/winnt-cxx.cc: Likewise.
	* config/mingw/winnt.cc: Likewise.
	* config/mips/mips.cc: Likewise.
	* config/msp430/driver-msp430.cc: Likewise.
	* config/nvptx/mkoffload.cc: Likewise.
	* config/nvptx/nvptx.cc: Likewise.
	* config/riscv/riscv-avlprop.cc: Likewise.
	* config/riscv/riscv-vector-builtins.cc: Likewise.
	* config/riscv/riscv-vsetvl.cc: Likewise.
	* config/rs6000/driver-rs6000.cc: Likewise.
	* config/rs6000/host-darwin.cc: Likewise.
	* config/rs6000/rs6000-c.cc: Likewise.
	* config/s390/s390-c.cc: Likewise.
	* config/s390/s390.cc: Likewise.
	* config/sol2-cxx.cc: Likewise.
	* config/vms/vms-c.cc: Likewise.
	* config/xtensa/xtensa-dynconfig.cc: Likewise.
	* coroutine-passes.cc: Likewise.
	* coverage.cc: Likewise.
	* data-streamer-in.cc: Likewise.
	* data-streamer-out.cc: Likewise.
	* data-streamer.cc: Likewise.
	* diagnostic-buffer.h (diagnostic_buffer::~diagnostic_buffer):
	Delete.
	(diagnostic_buffer::m_per_format_buffer): Use std::unique_ptr.
	* diagnostic-client-data-hooks.h (make_compiler_data_hooks): Use
	std::unique_ptr for return type.
	* diagnostic-format-json.cc
	(json_output_format::make_per_format_buffer): Likewise.
	(diagnostic_output_format_init_json): Update for usage of
	std::unique_ptr in set_output_format.
	* diagnostic-format-sarif.cc
	(sarif_output_format::make_per_format_buffer): Use std::unique_ptr
	for return type.
	(diagnostic_output_format_init_sarif): Update for usage of
	std::unique_ptr.
	(test_message_with_embedded_link): Likewise for set_urlifier.
	* diagnostic-format-text.cc: Add #define INCLUDE_MEMORY.  Include
	"make-unique.h".
	(diagnostic_text_output_format::set_buffer): Use std::unique_ptr.
	* diagnostic-format-text.h
	(diagnostic_text_output_format::set_buffer): Likewise.
	* diagnostic-format.h
	(diagnostic_output_format::make_per_format_buffer): Likewise.
	* diagnostic-global-context.cc:
	* diagnostic-macro-unwinding.cc: Likewise.
	* diagnostic-show-locus.cc: Likewise.
	* diagnostic-spec.cc: Likewise.
	* diagnostic.cc (diagnostic_context::set_output_format): Use
	std::unique_ptr for input.
	(diagnostic_context::set_client_data_hooks): Likewise.
	(diagnostic_context::set_option_manager): Likewise.
	(diagnostic_context::set_urlifier): Likewise.
	(diagnostic_context::set_diagnostic_buffer): Update for use of
	std::unique_ptr.
	(diagnostic_buffer::diagnostic_buffer): Likewise.
	(diagnostic_buffer::~diagnostic_buffer): Delete.
	* diagnostic.h: Complain if INCLUDE_MEMORY was not defined.
	(diagnostic_context::set_output_format): Use std::unique_ptr for
	input.
	(diagnostic_context::set_client_data_hooks): Likewise.
	(diagnostic_context::set_option_manager): Likewise.
	(diagnostic_context::set_urlifier): Likewise.
	(diagnostic_context::clone_printer): New.
	(diagnostic_context::m_printer): Update comment.
	(diagnostic_context::m_option_mgr): Likewise.
	(diagnostic_context::m_urlifier): Likewise.
	(diagnostic_context::m_edit_context_ptr): Likewise.
	(diagnostic_context::m_output_format): Likewise.
	(diagnostic_context::m_client_data_hooks): Likewise.
	(diagnostic_context::m_theme): Likewise.
	* digraph.cc: Add #define INCLUDE_MEMORY.
	* dwarf2out.cc: Likewise.
	* edit-context.cc: Likewise.
	* except.cc: Likewise.
	* expr.cc: Likewise.
	* file-prefix-map.cc: Likewise.
	* final.cc: Likewise.
	* fwprop.cc: Likewise.
	* gcc-plugin.h: Likewise.
	* gcc-rich-location.cc: Likewise.
	* gcc-urlifier.cc: Likewise.  Add #include "make-unique.h".
	(make_gcc_urlifier): Use std::unique_ptr and ::make_unique.
	* gcc-urlifier.h (make_gcc_urlifier): Use std::unique_ptr.
	* gcc.cc: Add #define INCLUDE_MEMORY.  Include
	"pretty-print-urlifier.h".
	* gcov-dump.cc: Add #define INCLUDE_MEMORY.
	* gcov-tool.cc: Likewise.
	* gengtype.cc (open_base_files): Likewise to output.
	* genmatch.cc: Likewise.
	* gimple-fold.cc: Likewise.
	* gimple-harden-conditionals.cc: Likewise.
	* gimple-harden-control-flow.cc: Likewise.
	* gimple-if-to-switch.cc: Likewise.
	* gimple-lower-bitint.cc: Likewise.
	* gimple-predicate-analysis.cc: Likewise.
	* gimple-pretty-print.cc: Likewise.
	* gimple-range-cache.cc: Likewise.
	* gimple-range-edge.cc: Likewise.
	* gimple-range-fold.cc: Likewise.
	* gimple-range-gori.cc: Likewise.
	* gimple-range-infer.cc: Likewise.
	* gimple-range-op.cc: Likewise.
	* gimple-range-path.cc: Likewise.
	* gimple-range-phi.cc: Likewise.
	* gimple-range-trace.cc: Likewise.
	* gimple-range.cc: Likewise.
	* gimple-ssa-backprop.cc: Likewise.
	* gimple-ssa-sprintf.cc: Likewise.
	* gimple-ssa-store-merging.cc: Likewise.
	* gimple-ssa-strength-reduction.cc: Likewise.
	* gimple-ssa-warn-access.cc: Likewise.
	* gimple-ssa-warn-alloca.cc: Likewise.
	* gimple-ssa-warn-restrict.cc: Likewise.
	* gimple-streamer-in.cc: Likewise.
	* gimple-streamer-out.cc: Likewise.
	* gimple.cc: Likewise.
	* gimplify.cc: Likewise.
	* graph.cc: Likewise.
	* graphviz.cc: Likewise.
	* input.cc: Likewise.
	* ipa-cp.cc: Likewise.
	* ipa-devirt.cc: Likewise.
	* ipa-fnsummary.cc: Likewise.
	* ipa-free-lang-data.cc: Likewise.
	* ipa-icf-gimple.cc: Likewise.
	* ipa-icf.cc: Likewise.
	* ipa-inline-analysis.cc: Likewise.
	* ipa-inline.cc: Likewise.
	* ipa-modref-tree.cc: Likewise.
	* ipa-modref.cc: Likewise.
	* ipa-param-manipulation.cc: Likewise.
	* ipa-polymorphic-call.cc: Likewise.
	* ipa-predicate.cc: Likewise.
	* ipa-profile.cc: Likewise.
	* ipa-prop.cc: Likewise.
	* ipa-pure-const.cc: Likewise.
	* ipa-reference.cc: Likewise.
	* ipa-split.cc: Likewise.
	* ipa-sra.cc: Likewise.
	* ipa-strub.cc: Likewise.
	* ipa-utils.cc: Likewise.
	* langhooks.cc: Likewise.
	* late-combine.cc: Likewise.
	* lto-cgraph.cc: Likewise.
	* lto-compress.cc: Likewise.
	* lto-opts.cc: Likewise.
	* lto-section-in.cc: Likewise.
	* lto-section-out.cc: Likewise.
	* lto-streamer-in.cc: Likewise.
	* lto-streamer-out.cc: Likewise.
	* lto-streamer.cc: Likewise.
	* lto-wrapper.cc: Likewise.  Include "make-unique.h".
	(main): Use ::make_unique when creating option manager.
	* multiple_target.cc: Likewise.
	* omp-expand.cc: Likewise.
	* omp-general.cc: Likewise.
	* omp-low.cc: Likewise.
	* omp-oacc-neuter-broadcast.cc: Likewise.
	* omp-offload.cc: Likewise.
	* omp-simd-clone.cc: Likewise.
	* optc-gen.awk: Likewise in output.
	* optc-save-gen.awk: Likewise in output.
	* options-urls-cc-gen.awk: Likewise in output.
	* opts-common.cc: Likewise.
	* opts-global.cc: Likewise.
	* opts.cc: Likewise.
	* pair-fusion.cc: Likewise.
	* passes.cc: Likewise.
	* pointer-query.cc: Likewise.
	* predict.cc: Likewise.
	* pretty-print.cc (pretty_printer::clone): Use std::unique_ptr and
	::make_unique.
	* pretty-print.h: Complain if INCLUDE_MEMORY is not defined.
	(pretty_printer::clone): Use std::unique_ptr.
	* print-rtl.cc: Add #define INCLUDE_MEMORY.
	* print-tree.cc: Likewise.
	* profile-count.cc: Likewise.
	* range-op-float.cc: Likewise.
	* range-op-ptr.cc: Likewise.
	* range-op.cc: Likewise.
	* range.cc: Likewise.
	* read-rtl-function.cc: Likewise.
	* rtl-error.cc: Likewise.
	* rtl-ssa/accesses.cc: Likewise.
	* rtl-ssa/blocks.cc: Likewise.
	* rtl-ssa/changes.cc: Likewise.
	* rtl-ssa/functions.cc: Likewise.
	* rtl-ssa/insns.cc: Likewise.
	* rtl-ssa/movement.cc: Likewise.
	* rtl-tests.cc: Likewise.
	* sanopt.cc: Likewise.
	* sched-rgn.cc: Likewise.
	* selftest-diagnostic-path.cc: Likewise.
	* selftest-diagnostic.cc: Likewise.
	* splay-tree-utils.cc: Likewise.
	* sreal.cc: Likewise.
	* stmt.cc: Likewise.
	* substring-locations.cc: Likewise.
	* symtab-clones.cc: Likewise.
	* symtab-thunks.cc: Likewise.
	* symtab.cc: Likewise.
	* text-art/box-drawing.cc: Likewise.
	* text-art/canvas.cc: Likewise.
	* text-art/ruler.cc: Likewise.
	* text-art/selftests.cc: Likewise.
	* text-art/theme.cc: Likewise.
	* toplev.cc: Likewise.  Include "make-unique.h".
	(general_init): Use ::make_unique when setting option_manager.
	* trans-mem.cc: Add #define INCLUDE_MEMORY.
	* tree-affine.cc: Likewise.
	* tree-call-cdce.cc: Likewise.
	* tree-cfg.cc: Likewise.
	* tree-chrec.cc: Likewise.
	* tree-dfa.cc: Likewise.
	* tree-diagnostic-client-data-hooks.cc: Include "make-unique.h".
	(make_compiler_data_hooks): Use std::unique_ptr and ::make_unique.
	* tree-diagnostic.cc: Add #define INCLUDE_MEMORY.
	* tree-dump.cc: Likewise.
	* tree-inline.cc: Likewise.
	* tree-into-ssa.cc: Likewise.
	* tree-logical-location.cc: Likewise.
	* tree-nested.cc: Likewise.
	* tree-nrv.cc: Likewise.
	* tree-object-size.cc: Likewise.
	* tree-outof-ssa.cc: Likewise.
	* tree-pretty-print.cc: Likewise.
	* tree-profile.cc: Likewise.
	* tree-scalar-evolution.cc: Likewise.
	* tree-sra.cc: Likewise.
	* tree-ssa-address.cc: Likewise.
	* tree-ssa-alias.cc: Likewise.
	* tree-ssa-ccp.cc: Likewise.
	* tree-ssa-coalesce.cc: Likewise.
	* tree-ssa-copy.cc: Likewise.
	* tree-ssa-dce.cc: Likewise.
	* tree-ssa-dom.cc: Likewise.
	* tree-ssa-forwprop.cc: Likewise.
	* tree-ssa-ifcombine.cc: Likewise.
	* tree-ssa-loop-ch.cc: Likewise.
	* tree-ssa-loop-im.cc: Likewise.
	* tree-ssa-loop-manip.cc: Likewise.
	* tree-ssa-loop-niter.cc: Likewise.
	* tree-ssa-loop-split.cc: Likewise.
	* tree-ssa-math-opts.cc: Likewise.
	* tree-ssa-operands.cc: Likewise.
	* tree-ssa-phiprop.cc: Likewise.
	* tree-ssa-pre.cc: Likewise.
	* tree-ssa-propagate.cc: Likewise.
	* tree-ssa-reassoc.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.
	* tree-ssa-scopedtables.cc: Likewise.
	* tree-ssa-sink.cc: Likewise.
	* tree-ssa-strlen.cc: Likewise.
	* tree-ssa-structalias.cc: Likewise.
	* tree-ssa-ter.cc: Likewise.
	* tree-ssa-uninit.cc: Likewise.
	* tree-ssa.cc: Likewise.
	* tree-ssanames.cc: Likewise.
	* tree-stdarg.cc: Likewise.
	* tree-streamer-in.cc: Likewise.
	* tree-streamer-out.cc: Likewise.
	* tree-streamer.cc: Likewise.
	* tree-switch-conversion.cc: Likewise.
	* tree-tailcall.cc: Likewise.
	* tree-vrp.cc: Likewise.
	* tree.cc: Likewise.
	* ubsan.cc: Likewise.
	* value-pointer-equiv.cc: Likewise.
	* value-prof.cc: Likewise.
	* value-query.cc: Likewise.
	* value-range-pretty-print.cc: Likewise.
	* value-range-storage.cc: Likewise.
	* value-range.cc: Likewise.
	* value-relation.cc: Likewise.
	* var-tracking.cc: Likewise.
	* varpool.cc: Likewise.
	* vr-values.cc: Likewise.
	* wide-int-print.cc: Likewise.

gcc/testsuite/ChangeLog:
	PR other/116613
	* gcc.dg/plugin/diagnostic_group_plugin.c: Update for use of
	std::unique_ptr.
	* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: Likewise.
	* gcc.dg/plugin/ggcplug.c: Likewise.

libgcc/ChangeLog:
	PR other/116613
	* libgcov-util.c: Add #define INCLUDE_MEMORY.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Gaius Mulley <gaiusmod2@gmail.com>
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-10-24 11:48:01 -04:00
GCC Administrator
de14559ef5 Daily bump. 2024-10-19 00:19:43 +00:00
Christophe Lyon
71c7b446b9 aarch64: libgcc: Use -Werror
This patch adds -Werror to LIBGCC2_CFLAGS so that aarch64 can catch
warnings during bootstrap, while not impacting other targets.

The patch also adds -Wno-prio-ctor-dtor to avoid a warning when
compiling lse_init.c

	libgcc/
	* config/aarch64/t-aarch64: Always use -Werror
	-Wno-prio-ctor-dtor.
2024-10-17 15:43:28 +00:00
Christophe Lyon
d806810f02 aarch64: libgcc: add prototypes in cpuinfo
Add prototypes for __init_cpu_features_resolver and
__init_cpu_features to avoid warnings due to -Wmissing-prototypes.

	libgcc/
	* config/aarch64/cpuinfo.c (__init_cpu_features_resolver): Add
	prototype.
	(__init_cpu_features): Likewise.
2024-10-17 15:43:27 +00:00
Christophe Lyon
e4d417417f aarch64: libgcc: Cleanup warnings in lse.S
Since
  Commit c608ada288
  Author:     Zac Walker <zacwalker@microsoft.com>
  CommitDate: 2024-01-23 15:32:30 +0000

  Ifdef `.hidden`, `.type`, and `.size` pseudo-ops for `aarch64-w64-mingw32` target

lse.S includes aarch64-asm.h, leading to a conflicting definition of macro 'L':
- in lse.S it expands to either '' or 'L'
- in aarch64-asm.h it is used to generate .L ## label

lse.S does not use the second, so this patch just undefines L after
the inclusion of aarch64-asm.h.

libgcc/
	* config/aarch64/lse.S: Undefine L() macro.
2024-10-17 15:43:27 +00:00
GCC Administrator
d9e02add88 Daily bump. 2024-10-16 11:37:33 +00:00
Yangyu Chen
1c507a02f2 RISC-V: Add detailed comments on processing implied extensions. [NFC]
In some cases, we don't need to handle implied extensions. Add detailed
comments to help developers understand what implied ISAs should be
considered.

libgcc/ChangeLog:

	* config/riscv/feature_bits.c (__init_riscv_features_bits_linux):
	Add detailed comments on processing implied extensions.

Signed-off-by: Yangyu Chen <chenyangyu@isrc.iscas.ac.cn>
2024-10-14 19:53:17 +08:00
Kito Cheng
ca44eb7f6a RISC-V: Implement __init_riscv_feature_bits, __riscv_feature_bits, and __riscv_vendor_feature_bits
This provides a common abstraction layer to probe the available extensions at
run-time. These functions can be used to implement function multi-versioning or
to detect available extensions.

The advantages of providing this abstraction layer are:
- Easy to port to other new platforms.
- Easier to maintain in GCC for function multi-versioning.
  - For example, maintaining platform-dependent code in C code/libgcc is much
    easier than maintaining it in GCC by creating GIMPLEs...

This API is intended to provide the capability to query minimal common available extensions on the system.

The API is defined in the riscv-c-api-doc:
https://github.com/riscv-non-isa/riscv-c-api-doc/blob/main/src/c-api.adoc

Proposal to use unsigned long long for marchid and mimpid:
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/91

Full function multi-versioning implementation will come later. We are posting
this first because we intend to backport it to the GCC 14 branch to unblock
LLVM 19 to use this with GCC 14.2, rather than waiting for GCC 15.

Changes since v7:
- Remove vendorID field in __riscv_vendor_feature_bits.
- Fix C implies Zcf only for RV32.
- Add more comments to kernel versions.

Changes since v6:
- Implement __riscv_cpu_model.
- Set new sub extension bits which implied from previous extensions.

Changes since v5:
- Minor fixes on indentation.

Changes since v4:
- Bump to newest riscv-c-api-doc with some new extensions like Zve*, Zc*
  Zimop, Zcmop, Zawrs.
- Rename the return variable name of hwprobe syscall.
- Minor fixes on indentation.

Changes since v3:
- Fix non-linux build.
- Let __init_riscv_feature_bits become constructor

Changes since v2:
- Prevent it initialize more than once.

Changes since v1:
- Fix the format.
- Prevented race conditions by introducing a local variable to avoid load/store
  operations during the computation of the feature bit.

Co-Developed-by: Yangyu Chen <chenyangyu@isrc.iscas.ac.cn>
Signed-off-by: Yangyu Chen <chenyangyu@isrc.iscas.ac.cn>

libgcc/ChangeLog:

	* config/riscv/feature_bits.c: New.
	* config/riscv/t-elf (LIB2ADD): Add feature_bits.c.
2024-10-14 17:36:14 +08:00
GCC Administrator
ccd7ede939 Daily bump. 2024-10-11 00:17:48 +00:00
Sébastien Michelland
e95512e2d5 SH: Use softfp for sh-elf
libgcc/ChangeLog:

	PR target/29845
	* config.host (sh-*-elf*): Replace fdpbit with softfp.
	* config/sh/sfp-machine.h: New file.

Signed-off-by: Sébastien Michelland <sebastien.michelland@lcis.grenoble-inp.fr>
2024-10-10 09:29:33 +09:00
GCC Administrator
7d736ecbc0 Daily bump. 2024-10-05 00:18:14 +00:00
Tsung Chun Lin
78d2af1fa5 [PATCH] RISC-V/libgcc: Fix incorrect .cfi_offset for saving ra in __riscv_save_[0-3] on ilp32e.
From 8b3c5ebe8aacbcc4ddf1be8dea9a555e7e1bcc39 Mon Sep 17 00:00:00 2001
From: Jim Lin <jim@andestech.com>
Date: Fri, 4 Oct 2024 14:48:12 +0800
Subject: [PATCH] RISC-V/libgcc: Fix incorrect .cfi_offset for saving ra in
 __riscv_save_[0-3] on ilp32e.

libgcc/ChangeLog:

	* config/riscv/save-restore.S: Fix .cfi_offset for saving ra in
	__riscv_save_[0-3] on ilp32e.
2024-10-04 08:02:48 -06:00
GCC Administrator
60f1feded2 Daily bump. 2024-10-02 00:17:48 +00:00
Tsung Chun Lin
97fd777248 [PATCH] RISC-V/libgcc: Fix incorrect and missing .cfi_offset for __riscv_save_[0-3] on RV32.
0001-RISC-V-libgcc-Fix-incorrect-and-missing-.cfi_offset-.patch

From 06a370a0a2329dd4da0ffcab7c35ea7df2353baf Mon Sep 17 00:00:00 2001
From: Jim Lin <jim@andestech.com>
Date: Tue, 1 Oct 2024 14:42:56 +0800
Subject: [PATCH] RISC-V/libgcc: Fix incorrect and missing .cfi_offset for
 __riscv_save_[0-3] on RV32.

libgcc/ChangeLog:

	* config/riscv/save-restore.S: Fix .cfi_offset for
	__riscv_save_[0-3] on RV32.
2024-10-01 09:10:29 -06:00
GCC Administrator
9261339092 Daily bump. 2024-09-28 00:19:05 +00:00
Matthieu Longo
0ff49a5c1d aarch64: fix build failure on aarch64-none-elf
A previous patch ([1]) introduced a build regression on aarch64-none-elf
target. The changes were primarilly tested on aarch64-unknown-linux-gnu,
so the issue was missed during development.
The includes are slighly different between the two targets, and due to some
include rules ([2]), "aarch64-unwind-def.h" was not found.

[1]: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bdf41d627c13bc5f0dc676991f4513daa9d9ae36

[2]: https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html
> include "file"
> ...  It searches for a file named file first in the directory
> containing the current file, ...

libgcc/ChangeLog:

	* config/aarch64/aarch64-unwind.h: Fix header path.
2024-09-27 15:35:10 +01:00
Mark Mentovai
dd5b823ce2 libgcc, Darwin: Don't build legacy libgcc_s.1 on macOS 14 [PR116809]
d9cafa0c4f stopped building libgcc_s.1 on macOS >= 15, in part because
that is required to bootstrap the compiler using the macOS 15 SDK. The
macOS 15 SDK ships in Xcode 16, which also runs on macOS 14. libgcc_s.1
can no longer be built on macOS 14 using Xcode 16 by the same logic that
the previous change disabled it for macOS 15.

	PR target/116809

libgcc/ChangeLog:

	* config.host: Don't build legacy libgcc_s.1 on macOS 14.

Signed-off-by: Mark Mentovai <mark@mentovai.com>
2024-09-27 13:17:44 +01:00
Jim Lin
bb01c9d6d2 RISC-V/libgcc: Save/Restore routines for E goes with ABI.
That Save/Restore routines for E can be used for RVI with ILP32E ABI.

libgcc/ChangeLog:

	* config/riscv/save-restore.S: Check with __riscv_abi_rve rather than
	__riscv_32e.
2024-09-27 17:29:06 +08:00
GCC Administrator
ff20f2b599 Daily bump. 2024-09-27 00:18:47 +00:00
Nathaniel Shead
6a4d1c374e libgcc, libstdc++: Make declarations no longer TU-local [PR115126]
In C++20, modules streaming check for exposures of TU-local entities.
In general exposing internal linkage functions in a header is liable to
cause ODR violations in C++, and this is now detected in a module
context.

This patch goes through and removes 'static' from many declarations
exposed through libstdc++ to prevent code like the following from
failing:

  export module M;
  extern "C++" {
    #include <bits/stdc++.h>
  }

Since gthreads is used from C as well, we need to choose whether to use
'inline' or 'static inline' depending on whether we're compiling for C
or C++ (since the semantics of 'inline' are different between the
languages).  Additionally we need to remove static global variables, so
we migrate these to function-local statics to avoid the ODR issues.

There doesn't seem to be a good workaround for weakrefs, so I've left
them as-is and will work around it in the modules streaming code to
consider them as not TU-local.

The same issue occurs in the objective-C specific parts of gthreads, but
I'm not familiar with the surrounding context and we don't currently
test modules with Objective C++ anyway so I've left it as-is.

	PR libstdc++/115126

libgcc/ChangeLog:

	* gthr-posix.h (__GTHREAD_ALWAYS_INLINE): New macro.
	(__GTHREAD_INLINE): New macro.
	(__gthread_active): Convert from variable to (hidden) function.
	(__gthread_active_p): Mark as __GTHREAD_INLINE instead of
	static; make visibility("hidden") when it has a static local
	variable.
	(__gthread_trigger): Mark as __GTHREAD_INLINE instead of static.
	(__gthread_create): Likewise.
	(__gthread_join): Likewise.
	(__gthread_detach): Likewise.
	(__gthread_equal): Likewise.
	(__gthread_self): Likewise.
	(__gthread_yield): Likewise.
	(__gthread_once): Likewise.
	(__gthread_key_create): Likewise.
	(__gthread_key_delete): Likewise.
	(__gthread_getspecific): Likewise.
	(__gthread_setspecific): Likewise.
	(__gthread_mutex_init_function): Likewise.
	(__gthread_mutex_destroy): Likewise.
	(__gthread_mutex_lock): Likewise.
	(__gthread_mutex_trylock): Likewise.
	(__gthread_mutex_timedlock): Likewise.
	(__gthread_mutex_unlock): Likewise.
	(__gthread_recursive_mutex_init_function): Likewise.
	(__gthread_recursive_mutex_lock): Likewise.
	(__gthread_recursive_mutex_trylock): Likewise.
	(__gthread_recursive_mutex_timedlock): Likewise.
	(__gthread_recursive_mutex_unlock): Likewise.
	(__gthread_recursive_mutex_destroy): Likewise.
	(__gthread_cond_init_function): Likewise.
	(__gthread_cond_broadcast): Likewise.
	(__gthread_cond_signal): Likewise.
	(__gthread_cond_wait): Likewise.
	(__gthread_cond_timedwait): Likewise.
	(__gthread_cond_wait_recursive): Likewise.
	(__gthread_cond_destroy): Likewise.
	(__gthread_rwlock_rdlock): Likewise.
	(__gthread_rwlock_tryrdlock): Likewise.
	(__gthread_rwlock_wrlock): Likewise.
	(__gthread_rwlock_trywrlock): Likewise.
	(__gthread_rwlock_unlock): Likewise.
	* gthr-single.h: (__GTHREAD_ALWAYS_INLINE): New macro.
	(__GTHREAD_INLINE): New macro.
	(__gthread_active_p): Mark as __GTHREAD_INLINE instead of static.
	(__gthread_once): Likewise.
	(__gthread_key_create): Likewise.
	(__gthread_key_delete): Likewise.
	(__gthread_getspecific): Likewise.
	(__gthread_setspecific): Likewise.
	(__gthread_mutex_destroy): Likewise.
	(__gthread_mutex_lock): Likewise.
	(__gthread_mutex_trylock): Likewise.
	(__gthread_mutex_unlock): Likewise.
	(__gthread_recursive_mutex_lock): Likewise.
	(__gthread_recursive_mutex_trylock): Likewise.
	(__gthread_recursive_mutex_unlock): Likewise.
	(__gthread_recursive_mutex_destroy): Likewise.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr.h (std::__is_shared_ptr): Remove
	unnecessary 'static'.
	* include/bits/unique_ptr.h (std::__is_unique_ptr): Likewise.
	* include/std/future (std::__create_task_state): Likewise.
	* include/std/shared_mutex (_GLIBCXX_GTRHW): Likewise.
	(__glibcxx_rwlock_init): Likewise.
	(__glibcxx_rwlock_timedrdlock): Likewise.
	(__glibcxx_rwlock_timedwrlock): Likewise.
	(__glibcxx_rwlock_rdlock): Likewise.
	(__glibcxx_rwlock_tryrdlock): Likewise.
	(__glibcxx_rwlock_wrlock): Likewise.
	(__glibcxx_rwlock_trywrlock): Likewise.
	(__glibcxx_rwlock_unlock): Likewise.
	(__glibcxx_rwlock_destroy): Likewise.
	(__glibcxx_rwlock_init): Likewise.
	* include/pstl/algorithm_impl.h
	(__pstl::__internal::__set_algo_cut_off): Mark inline.
	* include/pstl/unseq_backend_simd.h
	(__pstl::__unseq_backend::__lane_size): Mark inline.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Jakub Jelinek <jakub@redhat.com>
2024-09-27 09:16:53 +10:00
GCC Administrator
2d8392c4e7 Daily bump. 2024-09-25 00:18:47 +00:00
Iain Sandoe
d9cafa0c4f libgcc, Darwin: Drop the legacy library build for macOS >= 15 [PR116809].
We have been building a legacy libgcc_s.1 DSO to support code that
was built with older compilers.

From macOS 15,  the unwinder no longer exports some of the symbols used
in that library which (a) cuases bootstrap fail and (b) means that the
legacy library is no longer useful.

No open branch of GCC emits references to this library - and any already
-built code that depends on the symbols would need rework anyway.

	PR target/116809

libgcc/ChangeLog:

	* config.host: Build legacy libgcc_s.1 on hosts before macOS 15.
	* config/i386/t-darwin: Remove reference to legacy libgcc_s.1
	* config/rs6000/t-darwin: Likewise.
	* config/t-darwin-libgccs1: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-24 19:23:02 +01:00
GCC Administrator
4d6fa5b7f1 Daily bump. 2024-09-24 00:18:14 +00:00
Matthieu Longo
9e1c71bab5 dwarf2: add hooks for architecture-specific CFIs
Architecture-specific CFI directives are currently declared an processed
among others architecture-independent CFI directives in gcc/dwarf2* files.
This approach creates confusion, specifically in the case of DWARF
instructions in the vendor space and using the same instruction code.

Such a clash currently happen between DW_CFA_GNU_window_save (used on
SPARC) and DW_CFA_AARCH64_negate_ra_state (used on AArch64), and both
having the same instruction code 0x2d.
Then AArch64 compilers generates a SPARC CFI directive (.cfi_window_save)
instead of .cfi_negate_ra_state, contrarilly to what is expected in
[DWARF for the Arm 64-bit Architecture (AArch64)](https://github.com/
ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst).

This refactoring does not solve completely the problem, but improve the
situation by moving some of the processing of those directives (more
specifically their output in the assembly) to the backend via 2 target
hooks:
- DW_CFI_OPRND1_DESC: parse the first operand of the directive (if any).
- OUTPUT_CFI_DIRECTIVE: output the CFI directive as a string.

Additionally, this patch also contains a renaming of an enum used for
return address mangling on AArch64.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc
	(aarch64_output_cfi_directive): New hook for CFI directives.
	(aarch64_dw_cfi_oprnd1_desc): Same.
	(TARGET_OUTPUT_CFI_DIRECTIVE): Hook for output_cfi_directive.
	(TARGET_DW_CFI_OPRND1_DESC): Hook for dw_cfi_oprnd1_desc.
	* config/sparc/sparc.cc
	(sparc_output_cfi_directive): New hook for CFI directives.
	(sparc_dw_cfi_oprnd1_desc): Same.
	(TARGET_OUTPUT_CFI_DIRECTIVE): Hook for output_cfi_directive.
	(TARGET_DW_CFI_OPRND1_DESC): Hook for dw_cfi_oprnd1_desc.
	* coretypes.h
	(struct dw_cfi_node): Forward declaration of CFI type from
	gcc/dwarf2out.h.
	(enum dw_cfi_oprnd_type): Same.
	(enum dwarf_call_frame_info): Same.
	* doc/tm.texi: Regenerated from doc/tm.texi.in.
	* doc/tm.texi.in: Add doc for new target hooks.
	type of enum to allow forward declaration.
	* dwarf2cfi.cc
	(struct dw_cfi_row): Update the description for window_save
	and ra_mangled.
	(dwarf2out_frame_debug_cfa_negate_ra_state): Use AArch64 CFI
	directive instead of the SPARC one.
	(change_cfi_row): Use the right CFI directive's name for RA
	mangling.
	(output_cfi): Remove explicit architecture-specific CFI
	directive DW_CFA_GNU_window_save that falls into default case.
	(output_cfi_directive): Use target hook as default.
	* dwarf2out.cc (dw_cfi_oprnd1_desc): Use target hook as default.
	* dwarf2out.h (enum dw_cfi_oprnd_type): specify underlying type
	of enum to allow forward declaration.
	(dw_cfi_oprnd1_desc): Call target hook.
	(output_cfi_directive): Use dw_cfi_ref instead of struct
	dw_cfi_node *.
	* hooks.cc
	(hook_bool_dwcfi_dwcfioprndtyperef_false): New.
	(hook_bool_FILEptr_dwcfiptr_false): New.
	* hooks.h
	(hook_bool_dwcfi_dwcfioprndtyperef_false): New.
	(hook_bool_FILEptr_dwcfiptr_false): New.
	* target.def: Documentation for new hooks.

include/ChangeLog:

	* dwarf2.h (enum dwarf_call_frame_info): specify underlying

libffi/ChangeLog:

	* include/ffi_cfi.h (cfi_negate_ra_state): Declare AArch64 cfi
	directive.

libgcc/ChangeLog:

	* config/aarch64/aarch64-asm.h (PACIASP): Replace SPARC CFI
	directive by AArch64 one.
	(AUTIASP): Same.

libitm/ChangeLog:

	* config/aarch64/sjlj.S: Replace SPARC CFI directive by
	AArch64 one.

gcc/testsuite/ChangeLog:

	* g++.target/aarch64/pr94515-1.C: Replace SPARC CFI directive by
	AArch64 one.
	* g++.target/aarch64/pr94515-2.C: Same.
2024-09-23 15:37:05 +01:00
Matthieu Longo
bdf41d627c libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler.
This patch provides a new handler MD_ARCH_FRAME_STATE_T to hide an
architecture-specific structure containing CIE and FDE data related
to DWARF architecture extensions.

Hiding the architecture-specific attributes behind a handler has the
following benefits:
1. isolating those data from the generic ones in _Unwind_FrameState
2. avoiding casts to custom types.
3. preserving typing information when debugging with GDB, and so
   facilitating their printing.

This approach required to add a new header md-unwind-def.h included at
the top of libgcc/unwind-dw2.h, and redirecting to the corresponding
architecture header via a symbolic link.

An obvious drawback is the increase in complexity with macros, and
headers. It also caused a split of architecture definitions between
md-unwind-def.h (types definitions used in unwind-dw2.h) and
md-unwind.h (local types definitions and handlers implementations).
The naming of md-unwind.h with .h extension is a bit misleading as
the file is only included in the middle of unwind-dw2.c. Changing
this naming would require modification of others backends, which I
prefered to abstain from. Overall the benefits are worth the added
complexity from my perspective.

libgcc/ChangeLog:

	* Makefile.in: New target for symbolic link to md-unwind-def.h
	* config.host: New parameter md_unwind_def_header. Set it to
	aarch64/aarch64-unwind-def.h for AArch64 targets, or no-unwind.h
	by default.
	* config/aarch64/aarch64-unwind.h
	(aarch64_pointer_auth_key): Move to aarch64-unwind-def.h
	(aarch64_cie_aug_handler): Update.
	(aarch64_arch_extension_frame_init): Update.
	(aarch64_demangle_return_addr): Update.
	* configure.ac: New substitute variable md_unwind_def_header.
	* unwind-dw2.h (defined): MD_ARCH_FRAME_STATE_T.
	* config/aarch64/aarch64-unwind-def.h: New file.
	* configure: Regenerate.
	* config/no-unwind.h: Updated comment
2024-09-23 15:24:21 +01:00
Matthieu Longo
ba3e597681 aarch64: skip copy of RA state register into target context
The RA state register is local to a frame, so it should not be copied to
the target frame during the context installation.

This patch adds a new backend handler that check whether a register
needs to be skipped or not before its installation.

libgcc/ChangeLog:

	* config/aarch64/aarch64-unwind.h
	(MD_FRAME_LOCAL_REGISTER_P): new handler checking whether a register
	from the current context needs to be skipped before installation into
	the target context.
	(aarch64_frame_local_register): Likewise.
	* unwind-dw2.c (uw_install_context_1): use MD_FRAME_LOCAL_REGISTER_P.
2024-09-23 15:12:07 +01:00
Matthieu Longo
f531673917 aarch64: store signing key and signing method in DWARF _Unwind_FrameState
This patch is only a refactoring of the existing implementation
of PAuth and returned-address signing. The existing behavior is
preserved.

_Unwind_FrameState already contains several CIE and FDE information
(see the attributes below the comment "The information we care
about from the CIE/FDE" in libgcc/unwind-dw2.h).
The patch aims at moving the information from DWARF CIE (signing
key stored in the augmentation string) and FDE (the used signing
method) into _Unwind_FrameState along the already-stored CIE and
FDE information.
Note: those information have to be saved in frame_state_reg_info
instead of _Unwind_FrameState as they need to be savable by
DW_CFA_remember_state and restorable by DW_CFA_restore_state, that
both rely on the attribute "prev".

Those new information in _Unwind_FrameState simplifies the look-up
of the signing key when the return address is demangled. It also
allows future signing methods to be easily added.

_Unwind_FrameState is not a part of the public API of libunwind,
so the change is backward compatible.

A new architecture-specific handler MD_ARCH_EXTENSION_FRAME_INIT
allows to reset values (if needed) in the frame state and unwind
context before changing the frame state to the caller context.

A new architecture-specific handler MD_ARCH_EXTENSION_CIE_AUG_HANDLER
isolates the architecture-specific augmentation strings in AArch64
backend, and allows others architectures to reuse augmentation
strings that would have clashed with AArch64 DWARF extensions.

aarch64_demangle_return_addr, DW_CFA_AARCH64_negate_ra_state and
DW_CFA_val_expression cases in libgcc/unwind-dw2-execute_cfa.h
were documented to clarify where the value of the RA state register
is stored (FS and CONTEXT respectively).

libgcc/ChangeLog:

	* config/aarch64/aarch64-unwind.h
	(AARCH64_DWARF_RA_STATE_MASK): The mask for RA state register.
	(aarch64_ra_signing_method_t): The diversifiers used to sign a
	function's return address.
	(aarch64_pointer_auth_key): The key used to sign a function's
	return address.
	(aarch64_cie_signed_with_b_key): Deleted as the signing key is
	available now in _Unwind_FrameState.
	(MD_ARCH_EXTENSION_CIE_AUG_HANDLER): New CIE augmentation string
	handler for architecture extensions.
	(MD_ARCH_EXTENSION_FRAME_INIT): New architecture-extension
	initialization routine for DWARF frame state and context before
	execution of DWARF instructions.
	(aarch64_context_ra_state_get): Read RA state register from CONTEXT.
	(aarch64_ra_state_get): Read RA state register from FS.
	(aarch64_ra_state_set): Write RA state register into FS.
	(aarch64_ra_state_toggle): Toggle RA state register in FS.
	(aarch64_cie_aug_handler): Handler AArch64 augmentation strings.
	(aarch64_arch_extension_frame_init): Initialize defaults for the
	signing key (PAUTH_KEY_A), and RA state register (RA_no_signing).
	(aarch64_demangle_return_addr): Rely on the frame registers and
	the signing_key attribute in _Unwind_FrameState.
	* unwind-dw2-execute_cfa.h:
	Use the right alias DW_CFA_AARCH64_negate_ra_state for __aarch64__
	instead of DW_CFA_GNU_window_save.
	(DW_CFA_AARCH64_negate_ra_state): Save the signing method in RA
	state register. Toggle RA state register without resetting 'how'
	to REG_UNSAVED.
	* unwind-dw2.c:
	(extract_cie_info): Save the signing key in the current
	_Unwind_FrameState while parsing the augmentation data.
	(uw_frame_state_for): Reset some attributes related to architecture
	extensions in _Unwind_FrameState.
	(uw_update_context): Move authentication code to AArch64 unwinding.
	* unwind-dw2.h (enum register_rule): Give a name to the existing
	enum for the register rules, and replace 'unsigned char' by 'enum
	register_rule' to facilitate debugging in GDB.
	(_Unwind_FrameState): Add a new architecture-extension attribute
	to store the signing key.
2024-09-23 15:05:59 +01:00
GCC Administrator
ca12354fe2 Daily bump. 2024-09-23 00:18:00 +00:00
Iain Sandoe
43eab54939 libgcc, Darwin: From macOS 11, make that the earliest supported.
For libgcc, we have (so far) supported building a DSO that supports
earlier versions of the OS than the target.  From macOS 11, there are
APIs that do not exist on earlier OS versions, so limit the libgcc
range to macOS11..current.

libgcc/ChangeLog:

	* config.host: From macOS 11, limit earliest macOS support
	to macOS 11.
	* config/t-darwin-min-11: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-22 19:43:08 +01:00
GCC Administrator
ef84d2fea6 Daily bump. 2024-08-28 00:19:45 +00:00
YunQiang Su
9522fc8bb7 MIPS: Include missing mips16.S in libgcc/lib1funcs.S
mips16.S was missing since
commit 29b7454553
Date:   Thu Jun 1 10:14:24 2023 +0800

    MIPS: Add speculation_barrier support

Without mips16.S included, some symbols will miss for mips16, and
so some software will fail to build.

libgcc/ChangeLog:

	* config/mips/lib1funcs.S: Includes mips16.S.
2024-08-27 08:21:03 +08:00
GCC Administrator
471fb09260 Daily bump. 2024-06-15 00:16:29 +00:00
Georg-Johann Lay
2830b0b865 AVR: target/115419 - Tie breaks are rounded-to-even.
libgcc/config/avr/libf7/
	PR target/115419
	* libf7.c (f7_get_double): Round tie breaks to even LSB.
2024-06-14 18:33:05 +02:00
GCC Administrator
097bc0aeba Daily bump. 2024-06-11 00:18:01 +00:00
Jan Beulich
48d6d8c9e9 libgcc/aarch64: also provide AT_HWCAP2 fallback
Much like AT_HWCAP is already provided in case the platform headers
don't have the value (yet).

libgcc/

	* config/aarch64/cpuinfo.c: Provide AT_HWCAP2.
2024-06-10 08:47:58 +02:00
GCC Administrator
6af18e8c95 Daily bump. 2024-06-07 00:16:38 +00:00
Andre Vieira
c559353af4 arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]
This patch adds missing assembly directives to the CMSE library wrapper to call
functions with attribute cmse_nonsecure_call.  Without the .type directive the
linker will fail to produce the correct veneer if a call to this wrapper
function is to far from the wrapper itself.  The .size was added for
completeness, though we don't necessarily have a usecase for it.

libgcc/ChangeLog:

	PR target/115360
	* config/arm/cmse_nonsecure_call.S: Add .type and .size directives.
2024-06-06 16:02:50 +01:00
Thomas Schwinge
a29c5852a6 nvptx, libgcc: Stub unwinding implementation
Adding stub '_Unwind_Backtrace', '_Unwind_GetIPInfo' functions is necessary
for linking libbacktrace, as a normal (non-'LIBGFOR_MINIMAL') configuration
of libgfortran wants to do, for example.

The file 'libgcc/config/nvptx/unwind-nvptx.c' is copied from
'libgcc/config/gcn/unwind-gcn.c'.

libgcc/ChangeLog:

	* config/nvptx/t-nvptx: Add unwind-nvptx.c.
	* config/nvptx/unwind-nvptx.c: New file.

Co-authored-by: Andrew Stubbs <ams@gcc.gnu.org>
2024-06-06 13:41:47 +02:00
Thomas Schwinge
5bbe5350a0 nvptx offloading: Global constructor, destructor support, via nvptx-tools 'ld'
This extends commit d9c90c82d9
"nvptx target: Global constructor, destructor support, via nvptx-tools 'ld'"
for offloading.

	libgcc/
	* config/nvptx/gbl-ctors.c ["mgomp"]
	(__do_global_ctors__entry__mgomp)
	(__do_global_dtors__entry__mgomp): New.
	[!"mgomp"] (__do_global_ctors__entry, __do_global_dtors__entry):
	New.
	libgomp/
	* plugin/plugin-nvptx.c (nvptx_do_global_cdtors): New.
	(nvptx_close_device, GOMP_OFFLOAD_load_image)
	(GOMP_OFFLOAD_unload_image): Call it.
2024-06-06 13:41:47 +02:00