public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/gcc] rhel-f41-base: Merge #11 `Add test via annobin`
Date: Mon, 29 Jun 2026 12:28:52 GMT	[thread overview]
Message-ID: <178273613275.1.1982973785907921827.rpms-gcc-6358fb610c08@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/gcc
Branch : rhel-f41-base
Commit : 6358fb610c0842342a9d058aa16fe7ff67f16a21
Author : Jakub Jelinek <jakub@fedoraproject.org>
Date   : 2020-08-31T10:13:34+00:00
Stats  : +441/-12 in 10 file(s)
URL    : https://src.fedoraproject.org/rpms/gcc/c/6358fb610c0842342a9d058aa16fe7ff67f16a21?branch=rhel-f41-base

Log:
Merge #11 `Add test via annobin`

---
diff --git a/tests/build_hello_world.sh b/tests/build_hello_world.sh
new file mode 100755
index 0000000..f6aae70
--- /dev/null
+++ b/tests/build_hello_world.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -ex
+
+gcc -x c $(rpm --eval %build_cflags) data/hello.c -o hello_c.out
+./hello_c.out | grep -q "Hello World"
+
+g++ -x c++ $(rpm --eval %build_cxxflags) data/hello.cpp -o hello_cpp.out
+./hello_cpp.out | grep -q "Hello World"

diff --git a/tests/data/hello.c b/tests/data/hello.c
new file mode 100644
index 0000000..fe064a2
--- /dev/null
+++ b/tests/data/hello.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+int main() {
+	printf("Hello World!\n");
+	return 0;
+}

diff --git a/tests/data/hello.cpp b/tests/data/hello.cpp
new file mode 100644
index 0000000..2131d8a
--- /dev/null
+++ b/tests/data/hello.cpp
@@ -0,0 +1,5 @@
+#include <iostream>
+int main() {
+	std::cout << "Hello World!\n";
+	return 0;
+}

diff --git a/tests/tests.yml b/tests/tests.yml
new file mode 100644
index 0000000..dfe09e0
--- /dev/null
+++ b/tests/tests.yml
@@ -0,0 +1,14 @@
+- hosts: localhost
+  roles:
+    - role: standard-test-basic                         
+      tags:
+        - classic
+      
+      required_packages:
+        - redhat-rpm-config
+        - annobin
+
+      tests:
+        - build_hello_world:
+            dir: .
+            run: "./build_hello_world.sh" 

diff --git a/.gitignore b/.gitignore
index a1ab839..55534ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,5 @@
 /gcc-10.1.1-20200507.tar.xz
 /gcc-10.1.1-20200618.tar.xz
 /gcc-10.2.1-20200723.tar.xz
+/gcc-10.2.1-20200804.tar.xz
+/gcc-10.2.1-20200826.tar.xz

diff --git a/gcc.spec b/gcc.spec
index 9085b66..00598ca 100644
--- a/gcc.spec
+++ b/gcc.spec
@@ -1,10 +1,10 @@
-%global DATE 20200723
-%global gitrev 3fc88aa16f1bf661db4518d6d62869f081981981
+%global DATE 20200826
+%global gitrev c59c8927f43fb78d6a72a0ff93a47b36e43282d5
 %global gcc_version 10.2.1
 %global gcc_major 10
 # Note, gcc_release must be integer, if you want to add suffixes to
 # %%{release}, append them after %%{gcc_release} on Release: line.
-%global gcc_release 1
+%global gcc_release 3
 %global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e
 %global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0
 %global _unpackaged_files_terminate_build 0
@@ -86,7 +86,11 @@
 %else
 %global build_libitm 0
 %endif
+%if 0%{?rhel} > 8
+%global build_isl 0
+%else
 %global build_isl 1
+%endif
 %global build_libstdcxx_docs 1
 %ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64 %{mips}
 %global attr_ifunc 1
@@ -115,7 +119,7 @@
 Summary: Various compilers (C, C++, Objective-C, ...)
 Name: gcc
 Version: %{gcc_version}
-Release: %{gcc_release}%{?dist}.2
+Release: %{gcc_release}%{?dist}
 # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
 # GCC Runtime Exception.
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@@ -264,6 +268,9 @@ Patch8: gcc10-foffload-default.patch
 Patch9: gcc10-Wno-format-security.patch
 Patch10: gcc10-rh1574936.patch
 Patch11: gcc10-d-shared-libphobos.patch
+Patch12: gcc10-pr96383.patch
+Patch13: gcc10-pr96385.patch
+Patch14: gcc10-pr96690.patch
 
 # On ARM EABI systems, we do want -gnueabi to be part of the
 # target triple.
@@ -775,6 +782,9 @@ to NVidia PTX capable devices if available.
 %patch10 -p0 -b .rh1574936~
 %endif
 %patch11 -p0 -b .d-shared-libphobos~
+%patch12 -p0 -b .pr96383~
+%patch13 -p0 -b .pr96385~
+%patch14 -p0 -b .pr96690~
 
 echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
 
@@ -814,7 +824,7 @@ export CONFIG_SITE=NONE
 CC=gcc
 CXX=g++
 OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
-OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-flto//g;s/-ffat-lto-objects//g'`
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-flto=auto//g;s/-flto//g;s/-ffat-lto-objects//g'`
 OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
 OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'`
 OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'`
@@ -1922,8 +1932,39 @@ LC_ALL=C make %{?_smp_mflags} -k check ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=
 %else
      RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector}'" || :
 %endif
+if [ -f %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/annobin.so ]; then
+  # Test whether current annobin plugin won't fail miserably with the newly built gcc.
+  echo -e '#include <stdio.h>\nint main () { printf ("Hello, world!\\n"); return 0; }' > annobin-test.c
+  echo -e '#include <iostream>\nint main () { std::cout << "Hello, world!" << std::endl; return 0; }' > annobin-test.C
+  `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cc` \
+  -O2 -g -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS \
+  -fexceptions -fstack-protector-strong -grecord-gcc-switches -o annobin-test{c,.c} \
+  -Wl,-rpath,%{gcc_target_platform}/libgcc/ \
+  -fplugin=%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/annobin.so \
+  2> ANNOBINOUT1 || echo Annobin test 1 FAIL > ANNOBINOUT2;
+  `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cxx` \
+  `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-includes` \
+  -O2 -g -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS \
+  -fexceptions -fstack-protector-strong -grecord-gcc-switches -o annobin-test{C,.C} \
+  -Wl,-rpath,%{gcc_target_platform}/libgcc/:%{gcc_target_platform}/libstdc++-v3/src/.libs/ \
+  -fplugin=%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/annobin.so \
+  -B %{gcc_target_platform}/libstdc++-v3/src/.libs/ \
+  2> ANNOBINOUT3 || echo Annobin test 2 FAIL > ANNOBINOUT4;
+  [ -f ./annobin-testc ] || echo Annobin test 1 MISSING > ANNOBINOUT5;
+  [ -f ./annobin-testc ] && \
+  ( ./annobin-testc > ANNOBINRES1 2>&1 || echo Annobin test 1 RUNFAIL > ANNOBINOUT6 );
+  [ -f ./annobin-testC ] || echo Annobin test 2 MISSING > ANNOBINOUT7;
+  [ -f ./annobin-testC ] && \
+  ( ./annobin-testC > ANNOBINRES2 2>&1 || echo Annobin test 2 RUNFAIL > ANNOBINOUT8 );
+  cat ANNOBINOUT[1-8] > ANNOBINOUT
+  touch ANNOBINRES1 ANNOBINRES2
+  [ -s ANNOBINOUT ] && echo Annobin testing FAILed > ANNOBINRES
+  cat ANNOBINOUT ANNOBINRES[12] >> ANNOBINRES
+  rm -f ANNOBINOUT* ANNOBINRES[12] annobin-test{c,C}
+fi
 echo ====================TESTING=========================
 ( LC_ALL=C ../contrib/test_summary || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}'
+[ -f ANNOBINRES ] && cat ANNOBINRES
 echo ====================TESTING END=====================
 mkdir testlogs-%{_target_platform}-%{version}-%{release}
 for i in `find . -name \*.log | grep -F testsuite/ | grep -v 'config.log\|acats.*/tests/'`; do
@@ -3010,12 +3051,37 @@ end
 %endif
 
 %changelog
-* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 10.2.1-1.2
-- Second attempt - Rebuilt for
-  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
-
-* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 10.2.1-1.1
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
+* Wed Aug 26 2020 Jakub Jelinek <jakub@redhat.com> 10.2.1-3
+- update from releases/gcc-10 branch
+  - PRs c++/95428, c++/96082, c++/96106, c++/96164, c++/96199, c++/96497,
+	c/96545, c/96549, c/96571, d/96250, d/96254, d/96301, debug/96354,
+	fortran/93553, fortran/96312, fortran/96486, ipa/95320, ipa/96291,
+	ipa/96482, libstdc++/89760, libstdc++/95749, libstdc++/96303,
+	libstdc++/96484, libstdc++/96718, lto/95362, lto/95548,
+	middle-end/96426, middle-end/96459, target/93897, target/95450,
+	target/96191, target/96243, target/96446, target/96493, target/96506,
+	target/96525, target/96530, target/96536, target/96562, target/96682,
+	tree-optimization/96483, tree-optimization/96535,
+	tree-optimization/96722, tree-optimization/96730,
+	tree-optimization/96758
+- mangle some further symbols needed for debug info during early dwarf
+  (#1862029, PR debug/96690)
+- during %%check perform tests whether annobin is usable with the newly built
+  compiler or whether it might need to be rebuilt
+- disable graphite for ELN
+
+* Tue Aug  4 2020 Jakub Jelinek <jakub@redhat.com> 10.2.1-2
+- update from releases/gcc-10 branch
+  - PRs c++/95591, c++/95599, c++/95823, c++/95824, c++/95895, c/96377,
+	d/96140, fortran/89574, fortran/93567, fortran/93592, fortran/95585,
+	fortran/95612, fortran/95980, fortran/96018, fortran/96086,
+	fortran/96220, fortran/96319, lto/45375, middle-end/96335,
+	target/95435, target/96190, target/96236, target/96260, target/96402,
+	tree-optimization/96058
+- emit debug info for C/C++ external function declarations used in the TU
+  (PR debug/96383)
+- discard SHN_UNDEF global symbols from LTO debuginfo (PR lto/96385)
+- strip also -flto=auto from optflags
 
 * Thu Jul 23 2020 Jakub Jelinek <jakub@redhat.com> 10.2.1-1
 - update from releases/gcc-10 branch

diff --git a/gcc10-pr96383.patch b/gcc10-pr96383.patch
new file mode 100644
index 0000000..950a2f4
--- /dev/null
+++ b/gcc10-pr96383.patch
@@ -0,0 +1,236 @@
+2020-07-30  Richard Biener  <rguenther@suse.de>
+
+	PR debug/96383
+	* langhooks-def.h (lhd_finalize_early_debug): Declare.
+	(LANG_HOOKS_FINALIZE_EARLY_DEBUG): Define.
+	(LANG_HOOKS_INITIALIZER): Amend.
+	* langhooks.c: Include cgraph.h and debug.h.
+	(lhd_finalize_early_debug): Default implementation from
+	former code in finalize_compilation_unit.
+	* langhooks.h (lang_hooks::finalize_early_debug): Add.
+	* cgraphunit.c (symbol_table::finalize_compilation_unit):
+	Call the finalize_early_debug langhook.
+
+gcc/c-family/
+	* c-common.h (c_common_finalize_early_debug): Declare.
+	* c-common.c: Include debug.h.
+	(c_common_finalize_early_debug): finalize_early_debug langhook
+	implementation generating debug for extern declarations.
+
+gcc/c/
+	* c-objc-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
+	Define to c_common_finalize_early_debug.
+
+gcc/cp/
+	* cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
+	Define to c_common_finalize_early_debug.
+
+gcc/testsuite/
+	* gcc.dg/debug/dwarf2/pr96383-1.c: New testcase.
+	* gcc.dg/debug/dwarf2/pr96383-2.c: Likewise.
+
+libstdc++-v3/
+	* testsuite/20_util/assume_aligned/3.cc: Use -g0.
+
+--- gcc/c-family/c-common.c
++++ gcc/c-family/c-common.c
+@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3.  If not see
+ #include "spellcheck.h"
+ #include "c-spellcheck.h"
+ #include "selftest.h"
++#include "debug.h"
+ 
+ cpp_reader *parse_in;		/* Declared in c-pragma.h.  */
+ 
+@@ -9086,4 +9087,20 @@ braced_lists_to_strings (tree type, tree ctor)
+   return braced_lists_to_strings (type, ctor, false);
+ }
+ 
++
++/* Emit debug for functions before finalizing early debug.  */
++
++void
++c_common_finalize_early_debug (void)
++{
++  /* Emit early debug for reachable functions, and by consequence,
++     locally scoped symbols.  Also emit debug for extern declared
++     functions that are still reachable at this point.  */
++  struct cgraph_node *cnode;
++  FOR_EACH_FUNCTION (cnode)
++    if (!cnode->alias && !cnode->thunk.thunk_p
++	&& (cnode->has_gimple_body_p () || !DECL_IS_BUILTIN (cnode->decl)))
++      (*debug_hooks->early_global_decl) (cnode->decl);
++}
++
+ #include "gt-c-family-c-common.h"
+--- gcc/c-family/c-common.h
++++ gcc/c-family/c-common.h
+@@ -885,6 +885,8 @@ extern bool bool_promoted_to_int_p (tree);
+ extern tree fold_for_warn (tree);
+ extern tree c_common_get_narrower (tree, int *);
+ extern bool get_attribute_operand (tree, unsigned HOST_WIDE_INT *);
++extern void c_common_finalize_early_debug (void);
++
+ 
+ #define c_sizeof(LOC, T)  c_sizeof_or_alignof_type (LOC, T, true, false, 1)
+ #define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1)
+--- gcc/c/c-objc-common.h
++++ gcc/c/c-objc-common.h
+@@ -65,6 +65,8 @@ along with GCC; see the file COPYING3.  If not see
+   c_simulate_builtin_function_decl
+ #undef LANG_HOOKS_EMITS_BEGIN_STMT
+ #define LANG_HOOKS_EMITS_BEGIN_STMT true
++#undef LANG_HOOKS_FINALIZE_EARLY_DEBUG
++#define LANG_HOOKS_FINALIZE_EARLY_DEBUG c_common_finalize_early_debug
+ 
+ /* Attribute hooks.  */
+ #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
+--- gcc/cgraphunit.c
++++ gcc/cgraphunit.c
+@@ -2998,11 +2998,9 @@ symbol_table::finalize_compilation_unit (void)
+ 
+   if (!seen_error ())
+     {
+-      /* Emit early debug for reachable functions, and by consequence,
+-	 locally scoped symbols.  */
+-      struct cgraph_node *cnode;
+-      FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (cnode)
+-	(*debug_hooks->early_global_decl) (cnode->decl);
++      /* Give the frontends the chance to emit early debug based on
++	 what is still reachable in the TU.  */
++      (*lang_hooks.finalize_early_debug) ();
+ 
+       /* Clean up anything that needs cleaning up after initial debug
+ 	 generation.  */
+--- gcc/cp/cp-objcp-common.h
++++ gcc/cp/cp-objcp-common.h
+@@ -115,6 +115,8 @@ extern tree cxx_simulate_enum_decl (location_t, const char *,
+ #define LANG_HOOKS_BLOCK_MAY_FALLTHRU cxx_block_may_fallthru
+ #undef LANG_HOOKS_EMITS_BEGIN_STMT
+ #define LANG_HOOKS_EMITS_BEGIN_STMT true
++#undef LANG_HOOKS_FINALIZE_EARLY_DEBUG
++#define LANG_HOOKS_FINALIZE_EARLY_DEBUG c_common_finalize_early_debug
+ 
+ /* Attribute hooks.  */
+ #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
+--- gcc/langhooks-def.h
++++ gcc/langhooks-def.h
+@@ -92,6 +92,7 @@ extern const char *lhd_get_substring_location (const substring_loc &,
+ 					       location_t *out_loc);
+ extern int lhd_decl_dwarf_attribute (const_tree, int);
+ extern int lhd_type_dwarf_attribute (const_tree, int);
++extern void lhd_finalize_early_debug (void);
+ 
+ #define LANG_HOOKS_NAME			"GNU unknown"
+ #define LANG_HOOKS_IDENTIFIER_SIZE	sizeof (struct lang_identifier)
+@@ -139,6 +140,7 @@ extern int lhd_type_dwarf_attribute (const_tree, int);
+ #define LANG_HOOKS_EMITS_BEGIN_STMT	false
+ #define LANG_HOOKS_RUN_LANG_SELFTESTS   lhd_do_nothing
+ #define LANG_HOOKS_GET_SUBSTRING_LOCATION lhd_get_substring_location
++#define LANG_HOOKS_FINALIZE_EARLY_DEBUG lhd_finalize_early_debug
+ 
+ /* Attribute hooks.  */
+ #define LANG_HOOKS_ATTRIBUTE_TABLE		NULL
+@@ -364,7 +366,8 @@ extern void lhd_end_section (void);
+   LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS, \
+   LANG_HOOKS_EMITS_BEGIN_STMT, \
+   LANG_HOOKS_RUN_LANG_SELFTESTS, \
+-  LANG_HOOKS_GET_SUBSTRING_LOCATION \
++  LANG_HOOKS_GET_SUBSTRING_LOCATION, \
++  LANG_HOOKS_FINALIZE_EARLY_DEBUG \
+ }
+ 
+ #endif /* GCC_LANG_HOOKS_DEF_H */
+--- gcc/langhooks.c
++++ gcc/langhooks.c
+@@ -36,6 +36,8 @@ along with GCC; see the file COPYING3.  If not see
+ #include "output.h"
+ #include "timevar.h"
+ #include "stor-layout.h"
++#include "cgraph.h"
++#include "debug.h"
+ 
+ /* Do nothing; in many cases the default hook.  */
+ 
+@@ -866,6 +868,18 @@ lhd_unit_size_without_reusable_padding (tree t)
+   return TYPE_SIZE_UNIT (t);
+ }
+ 
++/* Default implementation for the finalize_early_debug hook.  */
++
++void
++lhd_finalize_early_debug (void)
++{
++  /* Emit early debug for reachable functions, and by consequence,
++     locally scoped symbols.  */
++  struct cgraph_node *cnode;
++  FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (cnode)
++    (*debug_hooks->early_global_decl) (cnode->decl);
++}
++
+ /* Returns true if the current lang_hooks represents the GNU C frontend.  */
+ 
+ bool
+--- gcc/langhooks.h
++++ gcc/langhooks.h
+@@ -580,6 +580,9 @@ struct lang_hooks
+   const char *(*get_substring_location) (const substring_loc &,
+ 					 location_t *out_loc);
+ 
++  /* Invoked before the early_finish debug hook is invoked.  */
++  void (*finalize_early_debug) (void);
++
+   /* Whenever you add entries here, make sure you adjust langhooks-def.h
+      and langhooks.c accordingly.  */
+ };
+--- gcc/testsuite/gcc.dg/debug/dwarf2/pr96383-1.c
++++ gcc/testsuite/gcc.dg/debug/dwarf2/pr96383-1.c
+@@ -0,0 +1,17 @@
++/* { dg-do compile } */
++/* { dg-options "-g -gdwarf -dA" } */
++
++extern void foo (int);
++extern void unusedbar (int);
++
++int main()
++{
++  foo (1);
++}
++
++/* We want subprogram DIEs for both foo and main and a DIE for
++   the formal parameter of foo.  We do not want a DIE for
++   unusedbar.  */
++/* { dg-final { scan-assembler-times "DW_TAG_subprogram" 4 } } */
++/* { dg-final { scan-assembler-times "DW_TAG_formal_parameter" 2 } } */
++/* { dg-final { scan-assembler-not "unusedbar" } } */
+--- gcc/testsuite/gcc.dg/debug/dwarf2/pr96383-2.c
++++ gcc/testsuite/gcc.dg/debug/dwarf2/pr96383-2.c
+@@ -0,0 +1,17 @@
++/* { dg-do compile } */
++/* { dg-options "-g -O2 -gdwarf -dA" } */
++
++extern void foo (int);
++extern void unusedbar (int);
++
++int main()
++{
++  foo (1);
++}
++
++/* We want subprogram DIEs for both foo and main and a DIE for
++   the formal parameter of foo.  We do not want a DIE for
++   unusedbar.  */
++/* { dg-final { scan-assembler-times "DW_TAG_subprogram" 4 } } */
++/* { dg-final { scan-assembler-times "DW_TAG_formal_parameter" 2 } } */
++/* { dg-final { scan-assembler-not "unusedbar" } } */
+--- libstdc++-v3/testsuite/20_util/assume_aligned/3.cc
++++ libstdc++-v3/testsuite/20_util/assume_aligned/3.cc
+@@ -15,7 +15,7 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// { dg-options "-std=gnu++2a -O2" }
++// { dg-options "-std=gnu++2a -O2 -g0" }
+ // { dg-do compile { target c++2a } }
+ // { dg-final { scan-assembler-not "undefined" } }
+ 

diff --git a/gcc10-pr96385.patch b/gcc10-pr96385.patch
new file mode 100644
index 0000000..22fe68e
--- /dev/null
+++ b/gcc10-pr96385.patch
@@ -0,0 +1,22 @@
+2020-08-03  Richard Biener  <rguenther@suse.de>
+
+	PR lto/96385
+libiberty/
+	* simple-object-elf.c
+	(simple_object_elf_copy_lto_debug_sections): Localize global
+	UNDEFs and reuse the prevailing name.
+
+--- libiberty/simple-object-elf.c
++++ libiberty/simple-object-elf.c
+@@ -1467,6 +1467,11 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
+ 		       && st_shndx < shnum
+ 		       && pfnret[st_shndx - 1] == -1)
+ 		discard = 1;
++	      /* We also need to remove global UNDEFs which can
++		 cause link fails later.  */
++	      else if (st_shndx == SHN_UNDEF
++		       && ELF_ST_BIND (*st_info) == STB_GLOBAL)
++		discard = 1;
+ 
+ 	      if (discard)
+ 		{

diff --git a/gcc10-pr96690.patch b/gcc10-pr96690.patch
new file mode 100644
index 0000000..bab66d4
--- /dev/null
+++ b/gcc10-pr96690.patch
@@ -0,0 +1,70 @@
+2020-08-25  Richard Biener  <rguenther@suse.de>
+
+	PR debug/96690
+	* dwarf2out.c (reference_to_unused): Make FUNCTION_DECL
+	processing more consistent with respect to
+	symtab->global_info_ready.
+	(tree_add_const_value_attribute): Unconditionally call
+	rtl_for_decl_init to do all mangling early but throw
+	away the result if early_dwarf.
+
+	* g++.dg/lto/pr96690_0.C: New testcase.
+
+--- gcc/dwarf2out.c
++++ gcc/dwarf2out.c
+@@ -19756,7 +19756,7 @@ reference_to_unused (tree * tp, int * walk_subtrees,
+   /* ???  The C++ FE emits debug information for using decls, so
+      putting gcc_unreachable here falls over.  See PR31899.  For now
+      be conservative.  */
+-  else if (!symtab->global_info_ready && VAR_OR_FUNCTION_DECL_P (*tp))
++  else if (!symtab->global_info_ready && VAR_P (*tp))
+     return *tp;
+   else if (VAR_P (*tp))
+     {
+@@ -19771,7 +19771,7 @@ reference_to_unused (tree * tp, int * walk_subtrees,
+          optimizing and gimplifying the CU by now.
+ 	 So if *TP has no call graph node associated
+ 	 to it, it means *TP will not be emitted.  */
+-      if (!cgraph_node::get (*tp))
++      if (!symtab->global_info_ready || !cgraph_node::get (*tp))
+ 	return *tp;
+     }
+   else if (TREE_CODE (*tp) == STRING_CST && !TREE_ASM_WRITTEN (*tp))
+@@ -20295,12 +20295,11 @@ tree_add_const_value_attribute (dw_die_ref die, tree t)
+ 	  return true;
+ 	}
+     }
+-  if (! early_dwarf)
+-    {
+-      rtl = rtl_for_decl_init (init, type);
+-      if (rtl)
+-	return add_const_value_attribute (die, rtl);
+-    }
++  /* Generate the RTL even if early_dwarf to force mangling of all refered to
++     symbols.  */
++  rtl = rtl_for_decl_init (init, type);
++  if (rtl && !early_dwarf)
++    return add_const_value_attribute (die, rtl);
+   /* If the host and target are sane, try harder.  */
+   if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
+       && initializer_constant_valid_p (init, type))
+--- gcc/testsuite/g++.dg/lto/pr96690_0.C
++++ gcc/testsuite/g++.dg/lto/pr96690_0.C
+@@ -0,0 +1,17 @@
++// { dg-lto-do assemble }
++// { dg-lto-options { { -flto -ffat-lto-objects -g } } }
++struct A { A (int); };
++template <class T> class B { T f; };
++unsigned char *foo (int *, bool *, const int &);
++template <typename, unsigned char *F (int *, bool *, const int &)> struct C {};
++struct D { B<C<unsigned char, foo> > d; };
++struct E { D e; };
++struct F {};
++struct G { static int bar (A, F, E, int); };
++
++void
++baz ()
++{
++  F f;
++  G::bar (0, f, E (), 0);
++}

diff --git a/sources b/sources
index 0e888d0..5f420de 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
-SHA512 (gcc-10.2.1-20200723.tar.xz) = e1719e4a18f43bb76acb91c0d768711e78d7e8c478b72e691911094e233570597997ed108ba7ed4fb136542993af935ea38ec462a1972689c9220d4cc0e2933f
+SHA512 (gcc-10.2.1-20200826.tar.xz) = b6949ea780618400dec06b8fc7b2728414d46e5972970ed70949ce16100547e4a9a6a5ce84ae1f47309a0610607b5454b0acc5fe5ecbb2889c84346bcdbdc8ab
 SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c
 SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7

                 reply	other threads:[~2026-06-29 12:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178273613275.1.1982973785907921827.rpms-gcc-6358fb610c08@fedoraproject.org \
    --to=jakub@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox