* [PATCH 0/1] Binutils/gold fix
@ 2015-09-02 23:45 Khem Raj
2015-09-02 23:46 ` [PATCH 1/1] binutils: Fix symbols with --dynamic-list when using gold linker Khem Raj
0 siblings, 1 reply; 2+ messages in thread
From: Khem Raj @ 2015-09-02 23:45 UTC (permalink / raw)
To: openembedded-core
While building QML apps using QT 4.8.7, there are problems seen in libQtCore
random hangs, crashes due to memory consumption etc. This is particular to gold linker
tested on minnow
The following changes since commit bdeb32b4cdbe316f17c2fd854d59e05e8f2e8ffc:
rt-tests: drop unnecessary added-missing-dependencies.patch (2015-09-01 11:43:38 +0100)
are available in the git repository at:
git://github.com/kraj/openembedded-core kraj/gold-dynamic-list
https://github.com/kraj/openembedded-core/tree/kraj/gold-dynamic-list
Khem Raj (1):
binutils: Fix symbols with --dynamic-list when using gold linker
meta/recipes-devtools/binutils/binutils-2.25.1.inc | 1 +
...-list-so-that-symbols-not-in-the-list-are.patch | 131 +++++++++++++++++++++
2 files changed, 132 insertions(+)
create mode 100644 meta/recipes-devtools/binutils/binutils/0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch
--
2.5.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] binutils: Fix symbols with --dynamic-list when using gold linker
2015-09-02 23:45 [PATCH 0/1] Binutils/gold fix Khem Raj
@ 2015-09-02 23:46 ` Khem Raj
0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2015-09-02 23:46 UTC (permalink / raw)
To: openembedded-core
There are random crashes and hangups, seen in libQtCore (QT4) as mentioned
in the binutils bugs as well, the reason is that
gold ignores all other symbols except specified in --dynamic-list which
is different in behavior as compared to bfd linker. The patch is a
backport from upstream master. This patch implements the bfd linker's
behaviour into gold.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-devtools/binutils/binutils-2.25.1.inc | 1 +
...-list-so-that-symbols-not-in-the-list-are.patch | 131 +++++++++++++++++++++
2 files changed, 132 insertions(+)
create mode 100644 meta/recipes-devtools/binutils/binutils/0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch
diff --git a/meta/recipes-devtools/binutils/binutils-2.25.1.inc b/meta/recipes-devtools/binutils/binutils-2.25.1.inc
index ef85fd4..120db87 100644
--- a/meta/recipes-devtools/binutils/binutils-2.25.1.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.25.1.inc
@@ -32,6 +32,7 @@ SRC_URI = "\
file://0012-Add-XLP-instructions-support.patch \
file://0013-Fix-an-internal-error-in-do_print_to_mapfile-seen-wi.patch \
file://0014-gold-arm-Skip-pic-check-for-R_ARM_REL32.patch \
+ file://0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch \
file://binutils-octeon3.patch \
"
S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch b/meta/recipes-devtools/binutils/binutils/0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch
new file mode 100644
index 0000000..ee49c38
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch
@@ -0,0 +1,131 @@
+From e9c1bdad269c0c3352eebcc9481ed65144001b0b Mon Sep 17 00:00:00 2001
+From: Cary Coutant <ccoutant@google.com>
+Date: Mon, 16 Feb 2015 22:15:12 -0800
+Subject: [PATCH] Fix --dynamic-list so that symbols not in the list are still
+ exported.
+
+In PR 13577, the complaint was that -Bsymbolic was overriding the binding
+behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
+tag in the dynamic table. In reading the Gnu ld manual, I decided that
+--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
+gold so that --dynamic-list would treat symbols listed as preemptible,
+and all other symbols as internally bound. I was wrong.
+
+PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
+not listed in the dynamic list is being internally bound within the
+shared library, but because it's still in the dynamic symbol table, we
+expose it to a COPY relocation, and things go really bad from there.
+
+(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
+with the Gnu linker. Even though the symbol is bound internally, it's
+still exported to the dynamic symbol table, and is exposed to a COPY
+relocation.)
+
+I've backed out part of the fix for PR 13577, and -Bsymbolic (or
+-Bsymbolic-functions) can now be used with --dynamic-list, but if the
+two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
+(this matches Gnu ld behavior). We now treat symbols listed in the
+dynamic list as premptible, but we do not automatically treat symbols
+not listed there as non-premptible.
+
+gold/
+ PR gold/13577
+ PR gold/16992
+ * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
+ DF_SYMBOLIC if --dynamic-list option is used.
+ * options.cc (General_options::finalize): --dynamic-list is not
+ mutually exclusive with -Bsymbolic.
+ * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
+ listed in --dynamic-list.
+ * testsuite/Makefile.am (dynamic_list_lib2.so): Add
+ -Bsymbolic-functions.
+ * testsuite/Makefile.in: Regenerate.
+---
+Upstream-Status: Backport
+
+ gold/ChangeLog | 14 ++++++++++++++
+ gold/layout.cc | 3 ++-
+ gold/options.cc | 7 -------
+ gold/symtab.h | 6 ++----
+ gold/testsuite/Makefile.am | 2 +-
+ gold/testsuite/Makefile.in | 2 +-
+ 6 files changed, 20 insertions(+), 14 deletions(-)
+
+diff --git a/gold/layout.cc b/gold/layout.cc
+index bcdaac8..7836640 100644
+--- a/gold/layout.cc
++++ b/gold/layout.cc
+@@ -4873,7 +4873,8 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
+ flags |= elfcpp::DF_STATIC_TLS;
+ if (parameters->options().origin())
+ flags |= elfcpp::DF_ORIGIN;
+- if (parameters->options().Bsymbolic())
++ if (parameters->options().Bsymbolic()
++ && !parameters->options().have_dynamic_list())
+ {
+ flags |= elfcpp::DF_SYMBOLIC;
+ // Add DT_SYMBOLIC for compatibility with older loaders.
+diff --git a/gold/options.cc b/gold/options.cc
+index 7eb8f27..7f1f69e 100644
+--- a/gold/options.cc
++++ b/gold/options.cc
+@@ -1200,13 +1200,6 @@ General_options::finalize()
+ // in the path, as appropriate.
+ this->add_sysroot();
+
+- // --dynamic-list overrides -Bsymbolic and -Bsymbolic-functions.
+- if (this->have_dynamic_list())
+- {
+- this->set_Bsymbolic(false);
+- this->set_Bsymbolic_functions(false);
+- }
+-
+ // Now that we've normalized the options, check for contradictory ones.
+ if (this->shared() && this->is_static())
+ gold_fatal(_("-shared and -static are incompatible"));
+diff --git a/gold/symtab.h b/gold/symtab.h
+index aa0cb68..9413360 100644
+--- a/gold/symtab.h
++++ b/gold/symtab.h
+@@ -604,10 +604,8 @@ class Symbol
+ if (parameters->options().in_dynamic_list(this->name()))
+ return true;
+
+- // If the user used -Bsymbolic or provided a --dynamic-list script,
+- // then nothing (else) is preemptible.
+- if (parameters->options().Bsymbolic()
+- || parameters->options().have_dynamic_list())
++ // If the user used -Bsymbolic, then nothing (else) is preemptible.
++ if (parameters->options().Bsymbolic())
+ return false;
+
+ // If the user used -Bsymbolic-functions, then functions are not
+diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
+index f767c21..7b73f9d 100644
+--- a/gold/testsuite/Makefile.am
++++ b/gold/testsuite/Makefile.am
+@@ -1518,7 +1518,7 @@ dynamic_list_lib1.o: dynamic_list_lib1.cc
+ $(CXXCOMPILE) -c -fpic -o $@ $<
+
+ dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
+- $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
++ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
+ dynamic_list_lib2.o: dynamic_list_lib2.cc
+ $(CXXCOMPILE) -c -fpic -o $@ $<
+
+diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
+index 217e472..b4ae3fd 100644
+--- a/gold/testsuite/Makefile.in
++++ b/gold/testsuite/Makefile.in
+@@ -5319,7 +5319,7 @@ uninstall-am:
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
+
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
+-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
++@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.o: dynamic_list_lib2.cc
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
+
+--
+1.9.1
+
--
2.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-02 23:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-02 23:45 [PATCH 0/1] Binutils/gold fix Khem Raj
2015-09-02 23:46 ` [PATCH 1/1] binutils: Fix symbols with --dynamic-list when using gold linker Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox