public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-13-branch)] Red Hat customizations.
@ 2022-12-15 18:36 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-12-15 18:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:75c21855ac707188d6e09bec81612ebeb650b713

commit 75c21855ac707188d6e09bec81612ebeb650b713
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Oct 14 12:07:05 2020 +0200

    Red Hat customizations.

Diff:
---
 gcc/ChangeLog                    |  37 +++
 gcc/Makefile.in                  |   3 +-
 gcc/ada/ChangeLog                |   4 +
 gcc/ada/gnat-style.texi          |   2 +-
 gcc/config.in                    |   6 +
 gcc/config/ia64/ia64.cc          |  42 ++--
 gcc/config/ia64/ia64.h           |   2 +-
 gcc/config/ia64/ia64.md          |  37 +++
 gcc/config/ia64/linux.h          |   7 +
 gcc/config/rs6000/ppc-asm.h      |   2 +-
 gcc/config/rs6000/rs6000.cc      |  19 +-
 gcc/configure                    |  25 +++
 gcc/configure.ac                 |  18 ++
 gcc/cppbuiltin.cc                |   4 +-
 gcc/po/sr.po                     |   4 +-
 gcc/po/tr.po                     |   2 +-
 gcc/testsuite/ChangeLog          |   4 +
 gcc/testsuite/g++.dg/opt/ctor1.C | 470 +++++++++++++++++++++++++++++++++++++++
 libgcc/ChangeLog                 |   9 +
 libgcc/config/ia64/crtbegin.S    |   4 +
 libgcc/config/ia64/crtend.S      |   4 +
 libgcc/config/ia64/crti.S        |   4 +
 libgcc/config/ia64/crtn.S        |   4 +
 libgcc/config/ia64/lib1funcs.S   |   4 +
 libgcc/crtstuff.c                |   8 +-
 25 files changed, 693 insertions(+), 32 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5299b0da895..bb31d798fcd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,40 @@
+2010-06-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* config/rs6000/rs6000.c (rs6000_elf_end_indicate_exec_stack): New.
+	* config/rs6000/linux64.h (TARGET_ASM_FILE_END): Use
+	rs6000_elf_end_indicate_exec_stack.
+	* config/ia64/ia64.c (ia64_linux_file_end): New.
+	* config/ia64/linux.h (TARGET_ASM_FILE_END): Use ia64_linux_file_end.
+
+	* cppbuiltin.c (define__GNUC__): Also define __GNUC_RH_RELEASE__.
+
+	* config/ia64/ia64.h (FRAME_GROWS_DOWNWARD): Define to 1 if
+	-fstack-protect.
+	* config/ia64/ia64.c (ia64_compute_frame_size): Make sure
+	size is a multiple of 16 if FRAME_GROWS_DOWNWARD.
+	(ia64_initial_elimination_offset): Support FRAME_GROWS_DOWNWARD
+	layout.
+	* config/ia64/linux.h (TARGET_LIBC_PROVIDES_SSP): Define.
+	* config/ia64/ia64.md (stack_protect_set, stack_protect_test): New
+	expanders.
+
+	Revert:
+	2005-04-29  Alan Modra  <amodra@bigpond.net.au>
+	PR target/21098
+	* config/rs6000/rs6000.c (rs6000_elf_end_indicate_exec_stack): New.
+	* config/rs6000/linux64.h (TARGET_ASM_FILE_END): Use the above.
+
+	* config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
+	on ppc64-linux.
+
+	* config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
+
+	* configure.ac (HAVE_LD_OVERLAPPING_OPD): New test.
+	* configure: Rebuilt.
+	* config.in: Rebuilt.
+	* config/rs6000/rs6000.c (OVERLAPPING_OPD): Define.
+	(rs6000_elf_declare_function_name): Use it.
+
 2022-12-14  David Faust  <david.faust@oracle.com>
 
 	PR target/106773
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 995d77f96c4..d2e2e546746 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3064,7 +3064,8 @@ PREPROCESSOR_DEFINES = \
   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
   @TARGET_SYSTEM_ROOT_DEFINE@
 
-CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s)
+CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s) \
+		       -DDEVPHASE=$(DEVPHASE_s)
 cppbuiltin.o: $(BASEVER)
 
 CFLAGS-cppdefault.o += $(PREPROCESSOR_DEFINES)
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7ecefd88ba4..2352185159b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* gnat-style.texi: Change dircategory to GNU Ada tools.
+
 2022-12-06  Yannick Moy  <moy@adacore.com>
 
 	* contracts.adb (Add_Contract_Item): Allow No_Caching on types.
diff --git a/gcc/ada/gnat-style.texi b/gcc/ada/gnat-style.texi
index f3b1c29a24f..8403bce0181 100644
--- a/gcc/ada/gnat-style.texi
+++ b/gcc/ada/gnat-style.texi
@@ -12,7 +12,7 @@
 @finalout
 @dircategory GNU Ada Tools 
 @direntry
-* gnat-style: (gnat-style.info). gnat-style
+* gnat-style: (gnat-style).      GNAT Coding Style
 @end direntry
 
 @c %**end of header
diff --git a/gcc/config.in b/gcc/config.in
index 4cad077bfbe..474e0bbe126 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1678,6 +1678,12 @@
 #endif
 
 
+/* Define if your PowerPC64 linker handles overlapping .opd entries. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_OVERLAPPING_OPD
+#endif
+
+
 /* Define if your linker can relax absolute .eh_frame personality pointers
    into PC-relative form. */
 #ifndef USED_FOR_TARGET
diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index 6df1ce736bc..a0939f91528 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -289,6 +289,8 @@ static section *ia64_select_rtx_section (machine_mode, rtx,
 static void ia64_output_dwarf_dtprel (FILE *, int, rtx)
      ATTRIBUTE_UNUSED;
 static unsigned int ia64_section_type_flags (tree, const char *, int);
+static void ia64_linux_file_end (void)
+     ATTRIBUTE_UNUSED;
 static void ia64_init_libfuncs (void)
      ATTRIBUTE_UNUSED;
 static void ia64_hpux_init_libfuncs (void)
@@ -2950,6 +2952,9 @@ ia64_compute_frame_size (HOST_WIDE_INT size)
   else
     pretend_args_size = crtl->args.pretend_args_size;
 
+  if (FRAME_GROWS_DOWNWARD)
+    size = IA64_STACK_ALIGN (size);
+
   total_size = (spill_size + extra_spill_size + size + pretend_args_size
 		+ crtl->outgoing_args_size);
   total_size = IA64_STACK_ALIGN (total_size);
@@ -2984,29 +2989,19 @@ ia64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
 HOST_WIDE_INT
 ia64_initial_elimination_offset (int from, int to)
 {
-  HOST_WIDE_INT offset;
+  HOST_WIDE_INT offset, size = get_frame_size ();
 
-  ia64_compute_frame_size (get_frame_size ());
+  ia64_compute_frame_size (size);
   switch (from)
     {
     case FRAME_POINTER_REGNUM:
-      switch (to)
-	{
-	case HARD_FRAME_POINTER_REGNUM:
-	  offset = -current_frame_info.total_size;
-	  if (!crtl->is_leaf || cfun->calls_alloca)
-	    offset += 16 + crtl->outgoing_args_size;
-	  break;
-
-	case STACK_POINTER_REGNUM:
-	  offset = 0;
-	  if (!crtl->is_leaf || cfun->calls_alloca)
-	    offset += 16 + crtl->outgoing_args_size;
-	  break;
-
-	default:
-	  gcc_unreachable ();
-	}
+      offset = FRAME_GROWS_DOWNWARD ? IA64_STACK_ALIGN (size) : 0;
+      if (!crtl->is_leaf || cfun->calls_alloca)
+	offset += 16 + crtl->outgoing_args_size;
+      if (to == HARD_FRAME_POINTER_REGNUM)
+	offset -= current_frame_info.total_size;
+      else
+	gcc_assert (to == STACK_POINTER_REGNUM);
       break;
 
     case ARG_POINTER_REGNUM:
@@ -11936,4 +11931,13 @@ ia64_can_change_mode_class (machine_mode from, machine_mode to,
   return true;
 }
 
+static void
+ia64_linux_file_end (void)
+{
+  int saved_trampolines_created = trampolines_created;
+  trampolines_created = 0;
+  file_end_indicate_exec_stack ();
+  trampolines_created = saved_trampolines_created;
+}
+
 #include "gt-ia64.h"
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index b7415c53596..a3ca5664b9b 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -745,7 +745,7 @@ enum reg_class
 
 /* Define this macro to nonzero if the addresses of local variable slots
    are at negative offsets from the frame pointer.  */
-#define FRAME_GROWS_DOWNWARD 0
+#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0)
 
 /* Offset from the stack pointer register to the first location at which
    outgoing arguments are placed.  If not specified, the default value of zero
diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md
index 5d1d47da55b..0a57a6d172d 100644
--- a/gcc/config/ia64/ia64.md
+++ b/gcc/config/ia64/ia64.md
@@ -5238,6 +5238,43 @@
   [(set_attr "itanium_class" "unknown")
    (set_attr "predicable" "no")])
 
+;;
+;; Stack guard expanders
+
+(define_expand "stack_protect_set"
+  [(set (match_operand 0 "memory_operand" "")
+        (match_operand 1 "memory_operand" ""))]
+  ""
+{
+#ifdef TARGET_THREAD_SSP_OFFSET
+  rtx thread_pointer_rtx = gen_rtx_REG (Pmode, 13);
+  rtx canary = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, thread_pointer_rtx,
+					GEN_INT (TARGET_THREAD_SSP_OFFSET)));
+  MEM_VOLATILE_P (canary) = MEM_VOLATILE_P (operands[1]);
+  operands[1] = canary;
+#endif
+  emit_move_insn (operands[0], operands[1]);
+  DONE;
+})
+
+(define_expand "stack_protect_test"
+  [(match_operand 0 "memory_operand" "")
+   (match_operand 1 "memory_operand" "")
+   (match_operand 2 "" "")]
+  ""
+{
+#ifdef TARGET_THREAD_SSP_OFFSET
+  rtx thread_pointer_rtx = gen_rtx_REG (Pmode, 13);
+  rtx canary = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, thread_pointer_rtx,
+					GEN_INT (TARGET_THREAD_SSP_OFFSET)));
+  MEM_VOLATILE_P (canary) = MEM_VOLATILE_P (operands[1]);
+  operands[1] = canary;
+#endif
+  emit_cmp_and_jump_insns (operands[0], operands[1], EQ, NULL_RTX,
+			   ptr_mode, 1, operands[2]);
+  DONE;
+})
+
 ;; Vector operations
 (include "vect.md")
 ;; Atomic operations
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index 93510098ccc..1f7573d2d05 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -23,6 +23,8 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define TARGET_ASM_FILE_END ia64_linux_file_end
+
 /* This is for -profile to use -lc_p instead of -lc.  */
 #undef CC1_SPEC
 #define CC1_SPEC "%{profile:-p} %{G*}"
@@ -81,3 +83,8 @@ do {						\
 
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+/* IA-64 glibc provides __stack_chk_guard in [r13-8].  */
+#define TARGET_THREAD_SSP_OFFSET	-8
+#endif
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 6b8f8f55a10..e2380df5ae6 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -384,7 +384,7 @@ GLUE(.L,name): \
 #endif
 #endif
 
-#if defined __linux__ && !defined __powerpc64__
+#if defined __linux__
 	.section .note.GNU-stack
 	.previous
 #endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index b3a609f3aa3..848bec48278 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -20925,6 +20925,15 @@ rs6000_elf_asm_out_destructor (rtx symbol, int priority)
     assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 
+#ifdef HAVE_LD_OVERLAPPING_OPD
+/* If the linker supports overlapping .opd entries and we know this function
+   doesn't ever use r11 passed to it, we can overlap the fd_aux function
+   descriptor field with next function descriptor's fd_func field.  */
+# define OVERLAPPING_OPD (cfun->static_chain_decl == NULL)
+#else
+# define OVERLAPPING_OPD 0
+#endif
+
 void
 rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl)
 {
@@ -20934,7 +20943,8 @@ rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl)
       ASM_OUTPUT_LABEL (file, name);
       fputs (DOUBLE_INT_ASM_OP, file);
       rs6000_output_function_entry (file, name);
-      fputs (",.TOC.@tocbase,0\n\t.previous\n", file);
+      fprintf (file, ",.TOC.@tocbase%s\n\t.previous\n",
+	       OVERLAPPING_OPD ? "" : ",0");
       if (DOT_SYMBOLS)
 	{
 	  fputs ("\t.size\t", file);
@@ -21060,6 +21070,13 @@ rs6000_elf_file_end (void)
 #if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
   if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2)
     file_end_indicate_exec_stack ();
+  else
+    {
+      int saved_trampolines_created = trampolines_created;
+      trampolines_created = 0;
+      file_end_indicate_exec_stack ();
+      trampolines_created = saved_trampolines_created;
+    }
 #endif
 
   if (flag_split_stack)
diff --git a/gcc/configure b/gcc/configure
index 61b3cedbe69..d7491a04987 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -30886,6 +30886,31 @@ cat >>confdefs.h <<_ACEOF
 #define POWERPC64_TOC_POINTER_ALIGNMENT $gcc_cv_ld_toc_align
 _ACEOF
 
+    fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker support for overlapping .opd entries" >&5
+$as_echo_n "checking linker support for overlapping .opd entries... " >&6; }
+if test "${gcc_cv_ld_overlapping_opd+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_ld_overlapping_opd=no
+    if test $in_tree_ld = yes ; then
+      if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
+        gcc_cv_ld_overlapping_opd=yes
+      fi
+    elif test x$gcc_cv_ld != x ; then
+      if $gcc_cv_ld -melf64ppc --help 2>/dev/null | grep non-overlapping-opd > /dev/null; then
+        gcc_cv_ld_overlapping_opd=yes
+      fi
+    fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_overlapping_opd" >&5
+$as_echo "$gcc_cv_ld_overlapping_opd" >&6; }
+    if test x"$gcc_cv_ld_overlapping_opd" = xyes; then
+
+$as_echo "#define HAVE_LD_OVERLAPPING_OPD 1" >>confdefs.h
+
     fi
     ;;
 esac
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5efbf11793c..674134e086b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6559,6 +6559,24 @@ EOF
       AC_DEFINE_UNQUOTED(POWERPC64_TOC_POINTER_ALIGNMENT, $gcc_cv_ld_toc_align,
     [Define to .TOC. alignment forced by your linker.])
     fi
+
+    AC_CACHE_CHECK(linker support for overlapping .opd entries,
+    gcc_cv_ld_overlapping_opd,
+    [gcc_cv_ld_overlapping_opd=no
+    if test $in_tree_ld = yes ; then
+      if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
+        gcc_cv_ld_overlapping_opd=yes
+      fi
+    elif test x$gcc_cv_ld != x ; then
+      if $gcc_cv_ld -melf64ppc --help 2>/dev/null | grep non-overlapping-opd > /dev/null; then
+        gcc_cv_ld_overlapping_opd=yes
+      fi
+    fi
+    ])
+    if test x"$gcc_cv_ld_overlapping_opd" = xyes; then
+      AC_DEFINE(HAVE_LD_OVERLAPPING_OPD, 1,
+    [Define if your PowerPC64 linker handles overlapping .opd entries.])
+    fi
     ;;
 esac
 
diff --git a/gcc/cppbuiltin.cc b/gcc/cppbuiltin.cc
index 8c918bee54a..15875205048 100644
--- a/gcc/cppbuiltin.cc
+++ b/gcc/cppbuiltin.cc
@@ -58,13 +58,15 @@ parse_basever (int *major, int *minor, int *patchlevel)
 static void
 define__GNUC__ (cpp_reader *pfile)
 {
-  int major, minor, patchlevel;
+  int major, minor, patchlevel, rhrevision;
 
   parse_basever (&major, &minor, &patchlevel);
   cpp_define_formatted (pfile, "__GNUC__=%d", major);
   cpp_define_formatted (pfile, "__GNUC_MINOR__=%d", minor);
   cpp_define_formatted (pfile, "__GNUC_PATCHLEVEL__=%d", patchlevel);
   cpp_define_formatted (pfile, "__VERSION__=\"%s\"", version_string);
+  if (sscanf (DEVPHASE, " (Red Hat %*d.%*d.%*d-%d", &rhrevision) == 1)
+    cpp_define_formatted (pfile, "__GNUC_RH_RELEASE__=%d", rhrevision);
   cpp_define_formatted (pfile, "__ATOMIC_RELAXED=%d", MEMMODEL_RELAXED);
   cpp_define_formatted (pfile, "__ATOMIC_SEQ_CST=%d", MEMMODEL_SEQ_CST);
   cpp_define_formatted (pfile, "__ATOMIC_ACQUIRE=%d", MEMMODEL_ACQUIRE);
diff --git a/gcc/po/sr.po b/gcc/po/sr.po
index 20da7dcbe2b..20b063143d8 100644
--- a/gcc/po/sr.po
+++ b/gcc/po/sr.po
@@ -83397,7 +83397,7 @@ msgstr "Не могу се променити атрибути USE-придру
 #, fuzzy, gcc-internal-format, gfc-internal-format
 #| msgid "Duplicate %s attribute specified at %L"
 msgid "Duplicate %s attribute specified at %L"
-msgstr "Удвостручени атрибут %S наведен код %L"
+msgstr "Удвостручени атрибут %s наведен код %L"
 
 #: fortran/symbol.cc:1027
 #, gcc-internal-format, gfc-internal-format
@@ -83498,7 +83498,7 @@ msgstr "Одредница ACCESS код %L је већ наведена "
 #, fuzzy, gcc-internal-format, gfc-internal-format
 #| msgid "Duplicate %s attribute specified at %L"
 msgid "Duplicate BIND attribute specified at %L"
-msgstr "Удвостручени атрибут %S наведен код %L"
+msgstr "Удвостручени атрибут BIND наведен код %L"
 
 #: fortran/symbol.cc:1914
 #, gcc-internal-format, gfc-internal-format
diff --git a/gcc/po/tr.po b/gcc/po/tr.po
index 536b00e55d8..1110167035f 100644
--- a/gcc/po/tr.po
+++ b/gcc/po/tr.po
@@ -79447,7 +79447,7 @@ msgstr "PURE yordamda %s deyimine izin verilmez (%C'de)"
 #, fuzzy, gcc-internal-format, gfc-internal-format
 #| msgid "%s statement must appear in a MODULE"
 msgid "%s statement must appear in a MODULE"
-msgstr "%S deyimi bir MODULE'de görünmemeli"
+msgstr "%s deyimi bir MODULE'de görünmemeli"
 
 #: fortran/parse.cc:4144
 #, gcc-internal-format, gfc-internal-format
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a3a6de8a59d..1e528c79944 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* g++.dg/opt/ctor1.C: New test.
+
 2022-12-14  David Malcolm  <dmalcolm@redhat.com>
 
 	PR analyzer/108065
diff --git a/gcc/testsuite/g++.dg/opt/ctor1.C b/gcc/testsuite/g++.dg/opt/ctor1.C
new file mode 100644
index 00000000000..1f406e57c49
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/ctor1.C
@@ -0,0 +1,470 @@
+// http://bugzilla.redhat.com/show_bug.cgi?id=547286
+// { dg-do compile }
+// { dg-options "-Os -w" }
+
+struct A
+{
+  void dispose ();
+  void release () { dispose (); }
+};
+struct B
+{
+  A *pi_;
+  B () { pi_ = __null; }
+  ~B () { pi_->release (); }
+  B (B const &) : pi_ () {}
+};
+template <class>
+struct C
+{
+  B pn;
+};
+struct D
+{
+  char *getStr ();
+};
+struct E
+{
+};
+D EToD (E, unsigned = 0x4406U);
+struct F;
+enum G
+{
+  GX1,
+  GX2,
+  GX3,
+  GX4,
+  GX5,
+  GX6,
+  GX7
+};
+struct H;
+typedef C <H> I;
+struct J {};
+template <typename T, bool, bool>
+struct K
+{
+  typedef T param_type;
+};
+template <typename T>
+struct L
+{
+  typedef T const_reference;
+  typedef typename K <T, false, false>::param_type param_type;
+};
+struct M;
+template <bool, typename, typename>
+struct N;
+template <typename T1, typename T2>
+struct N <false, T1, T2>
+{
+  typedef T2 type;
+};
+template <typename T1 = M, typename T2 = M, typename T3 = M>
+struct O
+{
+  typedef N <static_cast <bool> (T1::value), T2, T3> almost_type_;
+  typedef typename almost_type_::type type;
+};
+template <typename T>
+struct P
+{
+  typedef T type;
+};
+template <typename>
+struct Q
+{
+};
+template <typename T>
+struct R
+{
+  typedef T *TP;
+  typedef TP R::*type;
+};
+template <typename DerivedT, typename BaseT = Q <DerivedT> >
+struct S : BaseT
+{
+  typedef R <DerivedT> impl_t;
+  typedef typename impl_t::type bool_type;
+  operator bool_type ();
+};
+template <typename = J>
+struct U : public S <U <> >
+{
+};
+struct parser_tag_base
+{
+};
+struct parser_address_tag : parser_tag_base
+{
+};
+struct iteration_policy;
+struct action_policy;
+struct U_policy;
+template <typename = iteration_policy, typename = U_policy, typename = action_policy>
+struct scanner_policies;
+template <typename = char *, typename = scanner_policies <> >
+struct scanner;
+struct iteration_policy
+{
+};
+struct U_policy
+{
+  template <typename>
+  struct result
+  {
+    typedef U <> type;
+  };
+};
+template <typename MatchPolicyT, typename T>
+struct U_result
+{
+  typedef typename MatchPolicyT::template result <T>::type type;
+};
+struct action_policy
+{
+};
+template <typename IterationPolicyT, typename MatchPolicyT, typename ActionPolicyT>
+struct scanner_policies:public IterationPolicyT, MatchPolicyT, ActionPolicyT
+{
+};
+struct scanner_base;
+template <typename IteratorT, typename PoliciesT>
+struct scanner : public PoliciesT
+{
+  typedef typename L <IteratorT>::param_type iter_param_t;
+  scanner (IteratorT, iter_param_t, PoliciesT = PoliciesT ()) : PoliciesT (), first (), last () {}
+  IteratorT first;
+  IteratorT last;
+};
+template <typename, typename>
+struct action;
+template <typename ParserT, typename ScannerT>
+struct parser_result
+{
+  typedef typename P <ParserT>::type parser_type;
+  typedef typename parser_type::template result <ScannerT>::type type;
+};
+template <typename DerivedT>
+struct parser
+{
+  typedef DerivedT embed_t;
+  template <typename ScannerT>
+  struct result
+  {
+    typedef typename U_result <ScannerT, J>::type type;
+  };
+  DerivedT derived () const;
+  template <typename ActionT>
+  action <DerivedT, ActionT> operator[] (ActionT);
+};
+template <typename = char *>
+struct parse_info
+{
+};
+struct space_parser;
+template <typename SkipT>
+struct phrase_parser
+{
+  template <typename IteratorT, typename ParserT>
+  static parse_info <> parse (IteratorT first_, IteratorT last, ParserT p, space_parser const &)
+  {
+    typedef scanner <> scanner_t;
+    IteratorT first = first_;
+    scanner_t scan (first, last);
+    U <> hit = p.parse (scan);
+    return parse_info <> ();
+  }
+};
+template <typename IteratorT, typename ParserT, typename SkipT>
+parse_info <> parse (IteratorT first, IteratorT last, parser <ParserT> p, parser <SkipT> skip)
+{
+  phrase_parser <SkipT>::parse (first, last, p.derived (), skip.derived ());
+  return parse_info <> ();
+}
+template <typename DerivedT>
+struct char_parser : public parser <DerivedT>
+{
+};
+template <typename = char>
+struct chlit : public char_parser <chlit <> >
+{
+};
+template <typename = char *>
+struct strlit : public parser <strlit <> >
+{
+};
+template <typename CharT>
+strlit <CharT *> str_p (CharT)
+{
+  return strlit <CharT *> ();
+}
+struct space_parser : public char_parser <space_parser>
+{
+};
+space_parser space_p = space_parser ();
+struct end_parser : public parser <end_parser>
+{
+};
+end_parser end_p = end_parser ();
+template <class, class, bool, bool, bool>
+struct compressed_pair_switch;
+template <class T1, class T2>
+struct compressed_pair_switch <T1, T2, false, false, false>
+{
+  static const int value = 0;
+};
+template <class, class, int>
+struct compressed_pair_imp;
+template <class T1, class T2>
+struct compressed_pair_imp <T1, T2, 0>
+{
+  typedef T1 first_type;
+  typedef T2 second_type;
+  typedef typename L <first_type>::param_type first_param_type;
+  typedef typename L <second_type>::param_type second_param_type;
+  compressed_pair_imp (first_param_type x, second_param_type y) : first_ (x), second_ (y) {}
+  first_type first_;
+  second_type second_;
+};
+template <class T1, class T2>
+struct compressed_pair : private compressed_pair_imp <T1, T2, compressed_pair_switch <T1, T2, false, false, false>::value>
+{
+  typedef compressed_pair_imp <T1, T2, compressed_pair_switch <T1, T2, false, false, false>::value> base;
+  typedef T1 first_type;
+  typedef T2 second_type;
+  typedef typename L <first_type>::param_type first_param_type;
+  typedef typename L <second_type>::param_type second_param_type;
+  compressed_pair (first_param_type x, second_param_type y):base (x, y) {}
+};
+template <typename S, typename BaseT>
+struct unary : public BaseT
+{
+  typedef typename S::embed_t subject_embed_t;
+  subject_embed_t subj;
+};
+template <typename A, typename B, typename BaseT>
+struct binary : public BaseT
+{
+  typedef BaseT base_t;
+  typedef typename L <A>::param_type left_param_t;
+  typedef typename L <A>::const_reference left_return_t;
+  typedef typename L <B>::param_type right_param_t;
+  typedef typename A::embed_t left_embed_t;
+  typedef typename B::embed_t right_embed_t;
+  binary (left_param_t a, right_param_t b) : base_t (), subj (a, b) {}
+  left_return_t left ();
+  compressed_pair <left_embed_t, right_embed_t> subj;
+};
+struct parser_context_base
+{
+};
+template <typename>
+struct parser_context_linker;
+template <typename AttrT = J>
+struct parser_context : parser_context_base
+{
+  typedef AttrT attr_t;
+  typedef parser_context_linker <parser_context <> > context_linker_t;
+};
+template <typename ContextT, typename DerivedT>
+struct context_aux : public ContextT::base_t::template aux <DerivedT>
+{
+};
+template <typename ContextT>
+struct parser_context_linker : ContextT
+{
+};
+template <class T>
+struct scoped_ptr
+{
+  T *px;
+  scoped_ptr (T * = 0) {}
+};
+template < typename Base, typename Derived > struct is_base_and_derived
+{
+  static const bool value = false;
+};
+template <typename BaseT, typename DefaultT, typename T0, typename T1, typename T2>
+struct get_param
+{
+  typedef typename O <is_base_and_derived <BaseT, T0>, T0, typename O <is_base_and_derived <BaseT, T1>, T1, typename O <is_base_and_derived <BaseT, T2>, T2, DefaultT>::type>::type>::type type;
+};
+template <typename T0, typename T1, typename T2>
+struct get_context
+{
+  typedef typename get_param <parser_context_base, parser_context <>, T0, T1, T2>::type type;
+};
+template <typename T0, typename T1, typename T2>
+struct get_tag
+{
+  typedef typename get_param <parser_tag_base, parser_address_tag, T0, T1, T2>::type type;
+};
+template <typename T0, typename T1, typename T2>
+struct get_scanner
+{
+  typedef typename get_param <scanner_base, scanner <>, T0, T1, T2>::type type;
+};
+template <typename DerivedT, typename, typename T0, typename T1, typename T2>
+struct rule_base : parser <DerivedT>, get_tag <T0, T1, T2>::type
+{
+  typedef typename get_scanner <T0, T1, T2>::type scanner_t;
+  typedef typename get_context <T0, T1, T2>::type context_t;
+  typedef typename context_t::context_linker_t linked_context_t;
+  typedef typename linked_context_t::attr_t attr_t;
+};
+template <typename ScannerT, typename AttrT>
+struct abstract_parser
+{
+  virtual ~abstract_parser () {}
+};
+template <typename ParserT, typename ScannerT, typename AttrT>
+struct concrete_parser : abstract_parser <ScannerT, AttrT>
+{
+  concrete_parser (ParserT const &p) : p (p) {}
+  virtual abstract_parser <ScannerT, AttrT> *
+  clone ()
+  {
+    return new concrete_parser (p);
+  }
+  typename ParserT::embed_t p;
+};
+template <typename T0, typename T1 = J, typename T2 = J>
+struct rule : rule_base <rule <T2>, rule <T0>, T0, T1, T2>
+{
+  typedef rule <T2> base_t;
+  typedef typename base_t::scanner_t scanner_t;
+  typedef typename base_t::attr_t attr_t;
+  typedef abstract_parser <scanner_t, attr_t> abstract_parser_t;
+  rule () : ptr () {}
+  template <typename ParserT>
+  rule (ParserT const &p) : ptr (new concrete_parser <ParserT, scanner_t, attr_t> (p))
+  {
+  }
+  scoped_ptr <abstract_parser_t> ptr;
+};
+template <typename, typename>
+struct grammar;
+template <typename DerivedT, typename ContextT, typename ScannerT>
+typename DerivedT::template definition <ScannerT> get_definition (grammar <DerivedT, ContextT> *self)
+{
+  typedef typename DerivedT::template definition <ScannerT> definition_t;
+  definition_t d (self->derived ());
+  return d;
+}
+template <int, typename DerivedT, typename ContextT, typename ScannerT>
+typename parser_result <grammar <DerivedT, ContextT>, ScannerT>::type
+grammar_parser_parse (grammar < DerivedT, ContextT > *self, ScannerT)
+{
+  typedef typename parser_result <grammar <DerivedT, ContextT>, ScannerT>::type result_t;
+  get_definition <DerivedT, ContextT, ScannerT> (self);
+  return result_t ();
+}
+template <typename DerivedT, typename ContextT = parser_context <> >
+struct grammar : parser <DerivedT>
+{
+  typedef grammar <DerivedT> self_t;
+  template <typename ScannerT>
+  typename parser_result <self_t, ScannerT>::type parse_main (ScannerT & scan)
+  {
+    typedef typename parser_result <self_t, ScannerT>::type tt;
+    grammar_parser_parse <0> (this, scan);
+    return tt ();
+  }
+  template <typename ScannerT>
+  typename parser_result <self_t, ScannerT>::type parse (ScannerT & scan)
+  {
+    return parse_main (scan);
+  }
+};
+template <typename ParserT, typename ActionT>
+struct action : unary <ParserT, parser <action <ParserT, ActionT> > >
+{
+  ActionT actor;
+};
+template <typename A, typename B>
+struct sequence : binary <A, B, parser <sequence <A, B> > >
+{
+  typedef sequence <A, B> self_t;
+  template <typename ScannerT>
+  typename parser_result <self_t, ScannerT>::type parse (ScannerT & scan)
+  {
+    typedef typename parser_result <self_t, ScannerT>::type result_t;
+    if (result_t ma = this->left ().parse (scan))
+      {
+      }
+    return this->left ().parse (scan);
+  }
+};
+template <typename A, typename B>
+sequence <A, B> operator>> (parser <A>, parser <B>);
+template <typename B>
+sequence <chlit <>, B> operator>> (char, parser <B>);
+template <typename A, typename B>
+struct alternative : binary <A, B, parser <alternative <A, B> > >
+{
+  typedef alternative <A, B> self_t;
+  typedef binary <A, B, parser <self_t> > base_t;
+  alternative (A const &a, B const &b):
+  base_t (a, b) {}
+};
+template <typename A, typename B>
+alternative <A, B> operator| (parser <A> const &a, parser <B> const &b)
+{
+  alternative <A, B> c (a.derived (), b.derived ());
+  return c;
+}
+namespace
+{
+  typedef char *StringIteratorT;
+  struct ParserContext;
+  typedef C <ParserContext> ParserContextSharedPtr;
+  struct EnumFunctor
+  {
+    G meFunct;
+    double mnValue;
+    ParserContextSharedPtr mpContext;
+    EnumFunctor (G, ParserContextSharedPtr):
+    mpContext () {}
+  };
+  struct BinaryFunctionFunctor
+  {
+    G meFunct;
+    ParserContextSharedPtr mpContext;
+    BinaryFunctionFunctor (G, ParserContextSharedPtr):
+    mpContext () {}
+  };
+  struct ExpressionGrammar : grammar <ExpressionGrammar>
+  {
+    ExpressionGrammar (ParserContextSharedPtr) {}
+    template <typename ScannerT>
+    struct definition
+    {
+      definition (ExpressionGrammar self)
+      {
+	id = str_p ("pi")[EnumFunctor (GX1, self.getContext ())] |
+	     str_p ("left")[EnumFunctor (GX2, self.getContext ())] |
+	     str_p ("bottom")[EnumFunctor (GX3, self.getContext ())] |
+	     str_p ("xstretch")[EnumFunctor (GX4, self.getContext ())] |
+	     str_p ("ystretch")[EnumFunctor (GX5, self.getContext ())] |
+	     modifierReference |
+	     (('+' >> multiplicativeExpression)[BinaryFunctionFunctor (GX6, self.getContext ())] |
+	      ('-' >> multiplicativeExpression)[BinaryFunctionFunctor (GX7, self.getContext ())]);
+      }
+      rule <ScannerT> multiplicativeExpression;
+      rule <ScannerT> modifierReference;
+      rule <ScannerT> id;
+    };
+    ParserContextSharedPtr getContext ();
+  };
+}
+void
+FunctionParser (E rFunction, F &)
+{
+  D rAsciiFunction (EToD (rFunction, 11U));
+  StringIteratorT aStart (rAsciiFunction.getStr ());
+  StringIteratorT aEnd;
+  ParserContextSharedPtr pContext;
+  ExpressionGrammar aExpressionGrammer (pContext);
+  parse_info <> x (parse (aStart, aEnd, aExpressionGrammer >> end_p, space_p));
+}
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 03119bbe2c5..60f724197c6 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* config/ia64/lib1funcs.S: Add .note.GNU-stack section on
+	ia64-linux.
+	* config/ia64/crtbegin.S: Likewise.
+	* config/ia64/crtend.S: Likewise.
+	* config/ia64/crti.S: Likewise.
+	* config/ia64/crtn.S: Likewise.
+
 2022-12-08  Max Filippov  <jcmvbkbc@gmail.com>
 
 	* config/xtensa/xtensa-config-builtin.h (XCHAL_NUM_AREGS)
diff --git a/libgcc/config/ia64/crtbegin.S b/libgcc/config/ia64/crtbegin.S
index c3b7afbe5fc..5ad661118f7 100644
--- a/libgcc/config/ia64/crtbegin.S
+++ b/libgcc/config/ia64/crtbegin.S
@@ -185,3 +185,7 @@ __do_global_dtors_aux:
 .weak __cxa_finalize
 #endif
 .weak _Jv_RegisterClasses
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
diff --git a/libgcc/config/ia64/crtend.S b/libgcc/config/ia64/crtend.S
index 4491bbebb80..e84450f0377 100644
--- a/libgcc/config/ia64/crtend.S
+++ b/libgcc/config/ia64/crtend.S
@@ -114,3 +114,7 @@ __do_global_ctors_aux:
 
 	br.ret.sptk.many rp
 	.endp __do_global_ctors_aux
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
diff --git a/libgcc/config/ia64/crti.S b/libgcc/config/ia64/crti.S
index f2a630a250d..fea67257f80 100644
--- a/libgcc/config/ia64/crti.S
+++ b/libgcc/config/ia64/crti.S
@@ -51,3 +51,7 @@ _fini:
 	.body
 
 # end of crti.S
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
diff --git a/libgcc/config/ia64/crtn.S b/libgcc/config/ia64/crtn.S
index c8d2756f260..c8eef7623c6 100644
--- a/libgcc/config/ia64/crtn.S
+++ b/libgcc/config/ia64/crtn.S
@@ -41,3 +41,7 @@
 	br.ret.sptk.many b0
 
 # end of crtn.S
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
diff --git a/libgcc/config/ia64/lib1funcs.S b/libgcc/config/ia64/lib1funcs.S
index 5aea76b10c2..5f48842f43a 100644
--- a/libgcc/config/ia64/lib1funcs.S
+++ b/libgcc/config/ia64/lib1funcs.S
@@ -793,3 +793,7 @@ __floattitf:
 	.endp __floattitf
 #endif
 #endif
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index b0d0062ad5b..0fbd934f9bb 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -336,15 +336,15 @@ register_tm_clones (void)
    doesn't need to be defined.  */
 
 #ifdef TARGET_LIBGCC_SDATA_SECTION
-extern void *__dso_handle __attribute__ ((__section__ (TARGET_LIBGCC_SDATA_SECTION)));
+extern void *const __dso_handle __attribute__ ((__section__ (TARGET_LIBGCC_SDATA_SECTION)));
 #endif
 #ifdef HAVE_GAS_HIDDEN
-extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
+extern void *const __dso_handle __attribute__ ((__visibility__ ("hidden")));
 #endif
 #ifdef CRTSTUFFS_O
-void *__dso_handle = &__dso_handle;
+void *const __dso_handle = (void * const)&__dso_handle;
 #else
-void *__dso_handle = 0;
+void *const __dso_handle = 0;
 #endif
 #endif /* DEFAULT_USE_CXA_ATEXIT */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-15 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 18:36 [gcc(refs/vendors/redhat/heads/gcc-13-branch)] Red Hat customizations Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).