diff --git a/SOURCES/0001-Remove-PROVIDE-qualifiers.patch b/SOURCES/0001-Remove-PROVIDE-qualifiers.patch new file mode 100644 index 0000000..6549d1f --- /dev/null +++ b/SOURCES/0001-Remove-PROVIDE-qualifiers.patch @@ -0,0 +1,146 @@ +From a985e9b9deabd81e16754584f4397a638e9d3f36 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 5 Feb 2018 09:12:42 +0000 +Subject: [PATCH] Import patch from mainline to remove PROVODE qualifiers + around definitions of __CTOR_LIST__ and __DTOR_LIST__ in PE linker scripts. + + PR 22762 + * scripttempl/pe.sc: Remove PROVIDE()s from __CTOR_LIST__ and + __DTOR_LIST__ symbols. Add a comment explaining why this is + necessary. + * scripttemp/pep.sc: Likewise. + * ld.texinfo (PROVIDE): Add a note about the effect of common + symbols. +--- + ld/ChangeLog | 14 ++++++++++++++ + ld/ld.texinfo | 6 ++++++ + ld/scripttempl/pe.sc | 24 ++++++++++++++++++++---- + ld/scripttempl/pep.sc | 24 ++++++++++++++++++++---- + 4 files changed, 60 insertions(+), 8 deletions(-) + +diff --git a/ld/ChangeLog b/ld/ChangeLog +index 0f00265029c..bf129a121cc 100644 +--- a/ld/ChangeLog ++++ b/ld/ChangeLog +@@ -1,3 +1,17 @@ ++2018-02-05 Nick Clifton ++ ++ Import from mainline: ++ ++ 2018-02-03 Nick Clifton ++ ++ PR 22762 ++ * scripttempl/pe.sc: Remove PROVIDE()s from __CTOR_LIST__ and ++ __DTOR_LIST__ symbols. Add a comment explaining why this is ++ necessary. ++ * scripttemp/pep.sc: Likewise. ++ * ld.texinfo (PROVIDE): Add a note about the effect of common ++ symbols. ++ + 2018-01-27 Nick Clifton + + This is the 2.30 release: +diff --git a/ld/ld.texinfo b/ld/ld.texinfo +index c89915f1aaa..764c4017c7b 100644 +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -4001,6 +4001,12 @@ underscore), the linker will silently use the definition in the program. + If the program references @samp{etext} but does not define it, the + linker will use the definition in the linker script. + ++Note - the @code{PROVIDE} directive considers a common symbol to be ++defined, even though such a symbol could be combined with the symbol ++that the @code{PROVIDE} would create. This is particularly important ++when considering constructor and destructor list symbols such as ++@samp{__CTOR_LIST__} as these are often defined as common symbols. ++ + @node PROVIDE_HIDDEN + @subsection PROVIDE_HIDDEN + @cindex PROVIDE_HIDDEN +diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc +index c8a45ca09d1..f56d783ea03 100644 +--- a/ld/scripttempl/pe.sc ++++ b/ld/scripttempl/pe.sc +@@ -98,8 +98,22 @@ SECTIONS + ${RELOCATING+*(.glue_7t)} + ${RELOCATING+*(.glue_7)} + ${CONSTRUCTING+ +- PROVIDE(___CTOR_LIST__ = .); +- PROVIDE(__CTOR_LIST__ = .); ++ /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here, ++ we do not PROVIDE them. This is because the ctors.o startup ++ code in libgcc defines them as common symbols, with the ++ expectation that they will be overridden by the definitions ++ here. If we PROVIDE the symbols then they will not be ++ overridden and global constructors will not be run. ++ ++ This does mean that it is not possible for a user to define ++ their own __CTOR_LIST__ and __DTOR_LIST__ symbols. If that ++ ability is needed a custom linker script will have to be ++ used. (The custom script can just be a copy of this script ++ with the PROVIDE() qualifiers added). ++ ++ See PR 22762 for more details. */ ++ ___CTOR_LIST__ = .; ++ __CTOR_LIST__ = .; + LONG (-1); + KEEP(*(.ctors)); + KEEP(*(.ctor)); +@@ -107,8 +121,10 @@ SECTIONS + LONG (0); + } + ${CONSTRUCTING+ +- PROVIDE(___DTOR_LIST__ = .); +- PROVIDE(__DTOR_LIST__ = .); ++ /* See comment about __CTOR_LIST__ above. The same reasoning ++ applies here too. */ ++ ___DTOR_LIST__ = .; ++ __DTOR_LIST__ = .; + LONG (-1); + KEEP(*(.dtors)); + KEEP(*(.dtor)); +diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc +index 8daacb27630..3c6c84da9bf 100644 +--- a/ld/scripttempl/pep.sc ++++ b/ld/scripttempl/pep.sc +@@ -99,8 +99,22 @@ SECTIONS + ${RELOCATING+*(.glue_7)} + ${CONSTRUCTING+. = ALIGN(8);} + ${CONSTRUCTING+ +- PROVIDE(___CTOR_LIST__ = .); +- PROVIDE(__CTOR_LIST__ = .); ++ /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here, ++ we do not PROVIDE them. This is because the ctors.o startup ++ code in libgcc defines them as common symbols, with the ++ expectation that they will be overridden by the definitions ++ here. If we PROVIDE the symbols then they will not be ++ overridden and global constructors will not be run. ++ ++ This does mean that it is not possible for a user to define ++ their own __CTOR_LIST__ and __DTOR_LIST__ symbols. If that ++ ability is needed a custom linker script will have to be ++ used. (The custom script can just be a copy of this script ++ with the PROVIDE() qualifiers added). ++ ++ See PR 22762 for more details. */ ++ ___CTOR_LIST__ = .; ++ __CTOR_LIST__ = .; + LONG (-1); LONG (-1); + KEEP (*(.ctors)); + KEEP (*(.ctor)); +@@ -108,8 +122,10 @@ SECTIONS + LONG (0); LONG (0); + } + ${CONSTRUCTING+ +- PROVIDE(___DTOR_LIST__ = .); +- PROVIDE(__DTOR_LIST__ = .); ++ /* See comment about __CTOR_LIST__ above. The same reasoning ++ applies here too. */ ++ ___DTOR_LIST__ = .; ++ __DTOR_LIST__ = .; + LONG (-1); LONG (-1); + KEEP (*(.dtors)); + KEEP (*(.dtor)); +-- +2.18.2 + diff --git a/SPECS/mingw-binutils.spec b/SPECS/mingw-binutils.spec index 2bc4acd..0f63d3f 100644 --- a/SPECS/mingw-binutils.spec +++ b/SPECS/mingw-binutils.spec @@ -2,7 +2,7 @@ Name: mingw-binutils Version: 2.30 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Cross-compiled version of binutils for Win32 and Win64 environments License: GPLv2+ and LGPLv2+ and GPLv3+ and LGPLv3+ @@ -10,7 +10,9 @@ Group: Development/Libraries URL: http://www.gnu.org/software/binutils/ Source0: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.bz2 -#Source0: http://www.kernel.org/pub/linux/devel/binutils/binutils-%{version}.tar.bz2 +#Source0: http://www.kernel.org/pub/linux/devel/binutils/binutils-% {version}.tar.bz2 + +Patch0001: 0001-Remove-PROVIDE-qualifiers.patch BuildRequires: flex BuildRequires: bison @@ -61,7 +63,7 @@ understand Windows executables and DLLs. %prep %setup -q -n binutils-%{version} - +%patch0001 -p1 -b .0001 %build mkdir build_win32 @@ -251,6 +253,13 @@ rm -rf $RPM_BUILD_ROOT/multilib %changelog +* Tue Dec 01 2020 Uri Lublin - 2.30-3 +- rebuilt + +* Thu Jun 11 2020 Uri Lublin - 2.30-2 +- Remove PROVIDE() qualifiers from definition of __CTOR_LIST__ and __DTOR_LIST__ + Resolves: rhbz#1846152 + * Wed Aug 22 2018 Victor Toso - 2.30-1 - Update to 2.30 - Related: rhbz#1615874