[packages/binutils] - rel 2; fixes https://sourceware.org/bugzilla/show_bug.cgi?id=23409 in gold
arekm
arekm at pld-linux.org
Mon Jul 16 13:58:30 CEST 2018
commit 7334c9549f68625dec8a04b3ee5f78a0d9167008
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Mon Jul 16 13:58:22 2018 +0200
- rel 2; fixes https://sourceware.org/bugzilla/show_bug.cgi?id=23409 in gold
binutils.spec | 6 +-
bug-23409.patch | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 221 insertions(+), 3 deletions(-)
---
diff --git a/binutils.spec b/binutils.spec
index 8f5800b..65d655a 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -24,7 +24,7 @@ Summary(tr.UTF-8): GNU geliştirme araçları
Summary(uk.UTF-8): Набір інструментів GNU для побудови виконуваних програм
Name: binutils
Version: 2.31
-Release: 1
+Release: 2
Epoch: 4
License: GPL v3+
Group: Development/Tools
@@ -37,7 +37,7 @@ Patch1: %{name}-info.patch
Patch2: %{name}-libtool-relink.patch
Patch3: %{name}-pt_pax_flags.patch
Patch4: %{name}-libdir.patch
-
+Patch5: bug-23409.patch
Patch6: %{name}-absolute-gnu_debuglink-path.patch
Patch7: %{name}-libtool-m.patch
Patch8: %{name}-build-id.patch
@@ -165,7 +165,7 @@ niektórych pakietów.
%patch2 -p1
%{?with_pax:%patch3 -p1}
%patch4 -p1
-
+%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
diff --git a/bug-23409.patch b/bug-23409.patch
new file mode 100644
index 0000000..01002f8
--- /dev/null
+++ b/bug-23409.patch
@@ -0,0 +1,218 @@
+From 1b115e8e0e051d65d0747f0a8a84eb6453866729 Mon Sep 17 00:00:00 2001
+From: Cary Coutant <ccoutant at gmail.com>
+Date: Sat, 14 Jul 2018 12:29:03 -0700
+Subject: [PATCH 1/1] Fix problem causing duplicated linker-generated symbols
+ with versions.
+
+When generating _end, _edata, etc. symbols, and a version script provides
+a version name, and we are linking against another shared library that
+provides those symbols with a different version, gold ends up trying to
+resolve the other shared library's symbols to the new definitions, resulting
+in two copies of each symbol, one as default, and one as non-default.
+This patch tests for that condition, and ignores the symbols provided
+by the other shared library.
+
+gold/
+ PR gold/23409
+ * symtab.cc (Symbol_table::define_special_symbol): Add check for
+ version name on existing symbol.
+ * testsuite/Makefile.am (ver_test_pr23409): New test case.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/ver_test_pr23409.sh: New test script.
+ * testsuite/ver_test_pr23409_1.script: New version script.
+ * testsuite/ver_test_pr23409_2.script: New version script.
+---
+ gold/ChangeLog | 11 ++++++
+ gold/symtab.cc | 7 +++-
+ gold/testsuite/Makefile.am | 9 +++++
+ gold/testsuite/Makefile.in | 19 +++++++++-
+ gold/testsuite/ver_test_pr23409.sh | 64 ++++++++++++++++++++++++++++++++
+ gold/testsuite/ver_test_pr23409_1.script | 3 ++
+ gold/testsuite/ver_test_pr23409_2.script | 3 ++
+ 7 files changed, 112 insertions(+), 4 deletions(-)
+ create mode 100755 gold/testsuite/ver_test_pr23409.sh
+ create mode 100644 gold/testsuite/ver_test_pr23409_1.script
+ create mode 100644 gold/testsuite/ver_test_pr23409_2.script
+
+diff --git a/gold/symtab.cc b/gold/symtab.cc
+index c43d127..aa76441 100644
+--- a/gold/symtab.cc
++++ b/gold/symtab.cc
+@@ -1898,10 +1898,13 @@ Symbol_table::define_special_symbol(const char** pname, const char** pversion,
+ add_to_table = true;
+ add_loc = ins.first;
+
+- if (is_default_version && !insdefault.second)
++ if (is_default_version
++ && !insdefault.second
++ && insdefault.first->second->version() == NULL)
+ {
+ // We are adding NAME/VERSION, and it is the default
+- // version. We already have an entry for NAME/NULL.
++ // version. We already have an entry for NAME/NULL
++ // that does not already have a version.
+ oldsym = insdefault.first->second;
+ *resolve_oldsym = true;
+ }
+diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
+index 5f7d981..e15788e 100644
+--- a/gold/testsuite/Makefile.am
++++ b/gold/testsuite/Makefile.am
+@@ -1880,6 +1880,15 @@ ver_test_14.syms: ver_test_14
+ ver_test_14: gcctestdir/ld ver_test_main.o ver_test_1.so ver_test_2.so ver_test_4.so ver_test_14.script
+ $(CXXLINK) -Bgcctestdir/ -Wl,--version-script,$(srcdir)/ver_test_14.script -Wl,-E -Wl,-R,. ver_test_main.o ver_test_1.so ver_test_2.so ver_test_4.so
+
++check_SCRIPTS += ver_test_pr23409.sh
++check_DATA += ver_test_pr23409.syms
++ver_test_pr23409.syms: ver_test_pr23409_1.so
++ $(TEST_READELF) --dyn-syms -W $< >$@
++ver_test_pr23409_1.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_1.script ver_test_pr23409_2.so
++ gcctestdir/ld -shared -o $@ ver_test_1.o ver_test_pr23409_2.so --version-script $(srcdir)/ver_test_pr23409_1.script
++ver_test_pr23409_2.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_2.script
++ gcctestdir/ld -shared -o $@ ver_test_1.o --version-script $(srcdir)/ver_test_pr23409_2.script
++
+ check_SCRIPTS += weak_as_needed.sh
+ check_DATA += weak_as_needed.stdout
+ weak_as_needed.stdout: weak_as_needed_a.so
+diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
+index b4729bc..7305d32 100644
+--- a/gold/testsuite/Makefile.in
++++ b/gold/testsuite/Makefile.in
+@@ -479,8 +479,9 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh ver_test_8.sh \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_10.sh ver_test_13.sh \
+- at GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_14.sh weak_as_needed.sh \
+- at GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_test.sh \
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_14.sh \
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_pr23409.sh \
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_as_needed.sh relro_test.sh \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.sh \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.sh \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.sh \
+@@ -536,6 +537,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_10.syms \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_13.syms \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_14.syms \
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_pr23409.syms \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_as_needed.stdout \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_3.err \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_test.stdout \
+@@ -5807,6 +5809,13 @@ ver_test_14.sh.log: ver_test_14.sh
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
++ver_test_pr23409.sh.log: ver_test_pr23409.sh
++ @p='ver_test_pr23409.sh'; \
++ b='ver_test_pr23409.sh'; \
++ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
++ --log-file $$b.log --trs-file $$b.trs \
++ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
++ "$$tst" $(AM_TESTS_FD_REDIRECT)
+ weak_as_needed.sh.log: weak_as_needed.sh
+ @p='weak_as_needed.sh'; \
+ b='weak_as_needed.sh'; \
+@@ -8731,6 +8740,12 @@ uninstall-am:
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_OBJDUMP) -T $< | $(TEST_CXXFILT) >$@
+ @GCC_TRUE@@NATIVE_LINKER_TRUE at ver_test_14: gcctestdir/ld ver_test_main.o ver_test_1.so ver_test_2.so ver_test_4.so ver_test_14.script
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--version-script,$(srcdir)/ver_test_14.script -Wl,-E -Wl,-R,. ver_test_main.o ver_test_1.so ver_test_2.so ver_test_4.so
++ at GCC_TRUE@@NATIVE_LINKER_TRUE at ver_test_pr23409.syms: ver_test_pr23409_1.so
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) --dyn-syms -W $< >$@
++ at GCC_TRUE@@NATIVE_LINKER_TRUE at ver_test_pr23409_1.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_1.script ver_test_pr23409_2.so
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -shared -o $@ ver_test_1.o ver_test_pr23409_2.so --version-script $(srcdir)/ver_test_pr23409_1.script
++ at GCC_TRUE@@NATIVE_LINKER_TRUE at ver_test_pr23409_2.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_2.script
++ at GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -shared -o $@ ver_test_1.o --version-script $(srcdir)/ver_test_pr23409_2.script
+ @GCC_TRUE@@NATIVE_LINKER_TRUE at weak_as_needed.stdout: weak_as_needed_a.so
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -dW --dyn-syms $< >$@
+ @GCC_TRUE@@NATIVE_LINKER_TRUE at weak_as_needed_a.so: gcctestdir/ld weak_as_needed_a.o weak_as_needed_b.so weak_as_needed_c.so
+diff --git a/gold/testsuite/ver_test_pr23409.sh b/gold/testsuite/ver_test_pr23409.sh
+new file mode 100755
+index 0000000..ed1ef65
+--- /dev/null
++++ b/gold/testsuite/ver_test_pr23409.sh
+@@ -0,0 +1,64 @@
++#!/bin/sh
++
++# ver_test_pr23409.sh -- a test case for version scripts
++
++# Copyright (C) 2018 Free Software Foundation, Inc.
++# Written by Cary Coutant <ccoutant at gmail.com>.
++
++# This file is part of gold.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
++# MA 02110-1301, USA.
++
++# This test verifies that linker-generated symbols (e.g., _end)
++# get correct version information even in the presence of
++# a shared library that provides those symbols with different
++# versions.
++
++check()
++{
++ if ! grep -q "$2" "$1"
++ then
++ echo "Did not find expected symbol in $1:"
++ echo " $2"
++ echo ""
++ echo "Actual output below:"
++ cat "$1"
++ exit 1
++ fi
++}
++
++check_missing()
++{
++ if grep -q "$2" "$1"
++ then
++ echo "Found unexpected symbol in $1:"
++ echo " $2"
++ echo ""
++ echo "Actual output below:"
++ cat "$1"
++ exit 1
++ fi
++}
++
++check ver_test_pr23409.syms "_end@@VER1$"
++check ver_test_pr23409.syms "_edata@@VER1$"
++check ver_test_pr23409.syms "__bss_start@@VER1$"
++
++check_missing ver_test_pr23409.syms "_end at VER"
++check_missing ver_test_pr23409.syms "_edata at VER"
++check_missing ver_test_pr23409.syms "__bss_start at VER"
++
++exit 0
+diff --git a/gold/testsuite/ver_test_pr23409_1.script b/gold/testsuite/ver_test_pr23409_1.script
+new file mode 100644
+index 0000000..6969454
+--- /dev/null
++++ b/gold/testsuite/ver_test_pr23409_1.script
+@@ -0,0 +1,3 @@
++VER1 {
++ global: *;
++};
+diff --git a/gold/testsuite/ver_test_pr23409_2.script b/gold/testsuite/ver_test_pr23409_2.script
+new file mode 100644
+index 0000000..fa45184
+--- /dev/null
++++ b/gold/testsuite/ver_test_pr23409_2.script
+@@ -0,0 +1,3 @@
++VER2 {
++ global: *;
++};
+--
+2.9.3
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/binutils.git/commitdiff/7334c9549f68625dec8a04b3ee5f78a0d9167008
More information about the pld-cvs-commit
mailing list