summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-09-02 23:46:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-04 16:23:47 +0100
commit31c231c95d37819717f8390d2fd8f68da970aa2a (patch)
tree886f5d62d70f9b3567c44cf37a69aaf150a1b0bc /meta
parentbc6a1a23e3d1af3861288a7abdbc9d5010470204 (diff)
downloadpoky-31c231c95d37819717f8390d2fd8f68da970aa2a.tar.gz
binutils: Fix symbols with --dynamic-list when using gold linker
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. (From OE-Core rev: 0ee1e3b000137ebcb2e223e7a3f8e9eb53088c70) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.25.1.inc1
-rw-r--r--meta/recipes-devtools/binutils/binutils/0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch131
2 files changed, 132 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.25.1.inc b/meta/recipes-devtools/binutils/binutils-2.25.1.inc
index ef85fd460b..120db87e1a 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 = "\
32 file://0012-Add-XLP-instructions-support.patch \ 32 file://0012-Add-XLP-instructions-support.patch \
33 file://0013-Fix-an-internal-error-in-do_print_to_mapfile-seen-wi.patch \ 33 file://0013-Fix-an-internal-error-in-do_print_to_mapfile-seen-wi.patch \
34 file://0014-gold-arm-Skip-pic-check-for-R_ARM_REL32.patch \ 34 file://0014-gold-arm-Skip-pic-check-for-R_ARM_REL32.patch \
35 file://0015-Fix-dynamic-list-so-that-symbols-not-in-the-list-are.patch \
35 file://binutils-octeon3.patch \ 36 file://binutils-octeon3.patch \
36 " 37 "
37S = "${WORKDIR}/git" 38S = "${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 0000000000..ee49c3863b
--- /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 @@
1From e9c1bdad269c0c3352eebcc9481ed65144001b0b Mon Sep 17 00:00:00 2001
2From: Cary Coutant <ccoutant@google.com>
3Date: Mon, 16 Feb 2015 22:15:12 -0800
4Subject: [PATCH] Fix --dynamic-list so that symbols not in the list are still
5 exported.
6
7In PR 13577, the complaint was that -Bsymbolic was overriding the binding
8behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
9tag in the dynamic table. In reading the Gnu ld manual, I decided that
10--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
11gold so that --dynamic-list would treat symbols listed as preemptible,
12and all other symbols as internally bound. I was wrong.
13
14PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
15not listed in the dynamic list is being internally bound within the
16shared library, but because it's still in the dynamic symbol table, we
17expose it to a COPY relocation, and things go really bad from there.
18
19(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
20with the Gnu linker. Even though the symbol is bound internally, it's
21still exported to the dynamic symbol table, and is exposed to a COPY
22relocation.)
23
24I've backed out part of the fix for PR 13577, and -Bsymbolic (or
25-Bsymbolic-functions) can now be used with --dynamic-list, but if the
26two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
27(this matches Gnu ld behavior). We now treat symbols listed in the
28dynamic list as premptible, but we do not automatically treat symbols
29not listed there as non-premptible.
30
31gold/
32 PR gold/13577
33 PR gold/16992
34 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
35 DF_SYMBOLIC if --dynamic-list option is used.
36 * options.cc (General_options::finalize): --dynamic-list is not
37 mutually exclusive with -Bsymbolic.
38 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
39 listed in --dynamic-list.
40 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
41 -Bsymbolic-functions.
42 * testsuite/Makefile.in: Regenerate.
43---
44Upstream-Status: Backport
45
46 gold/ChangeLog | 14 ++++++++++++++
47 gold/layout.cc | 3 ++-
48 gold/options.cc | 7 -------
49 gold/symtab.h | 6 ++----
50 gold/testsuite/Makefile.am | 2 +-
51 gold/testsuite/Makefile.in | 2 +-
52 6 files changed, 20 insertions(+), 14 deletions(-)
53
54diff --git a/gold/layout.cc b/gold/layout.cc
55index bcdaac8..7836640 100644
56--- a/gold/layout.cc
57+++ b/gold/layout.cc
58@@ -4873,7 +4873,8 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
59 flags |= elfcpp::DF_STATIC_TLS;
60 if (parameters->options().origin())
61 flags |= elfcpp::DF_ORIGIN;
62- if (parameters->options().Bsymbolic())
63+ if (parameters->options().Bsymbolic()
64+ && !parameters->options().have_dynamic_list())
65 {
66 flags |= elfcpp::DF_SYMBOLIC;
67 // Add DT_SYMBOLIC for compatibility with older loaders.
68diff --git a/gold/options.cc b/gold/options.cc
69index 7eb8f27..7f1f69e 100644
70--- a/gold/options.cc
71+++ b/gold/options.cc
72@@ -1200,13 +1200,6 @@ General_options::finalize()
73 // in the path, as appropriate.
74 this->add_sysroot();
75
76- // --dynamic-list overrides -Bsymbolic and -Bsymbolic-functions.
77- if (this->have_dynamic_list())
78- {
79- this->set_Bsymbolic(false);
80- this->set_Bsymbolic_functions(false);
81- }
82-
83 // Now that we've normalized the options, check for contradictory ones.
84 if (this->shared() && this->is_static())
85 gold_fatal(_("-shared and -static are incompatible"));
86diff --git a/gold/symtab.h b/gold/symtab.h
87index aa0cb68..9413360 100644
88--- a/gold/symtab.h
89+++ b/gold/symtab.h
90@@ -604,10 +604,8 @@ class Symbol
91 if (parameters->options().in_dynamic_list(this->name()))
92 return true;
93
94- // If the user used -Bsymbolic or provided a --dynamic-list script,
95- // then nothing (else) is preemptible.
96- if (parameters->options().Bsymbolic()
97- || parameters->options().have_dynamic_list())
98+ // If the user used -Bsymbolic, then nothing (else) is preemptible.
99+ if (parameters->options().Bsymbolic())
100 return false;
101
102 // If the user used -Bsymbolic-functions, then functions are not
103diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
104index f767c21..7b73f9d 100644
105--- a/gold/testsuite/Makefile.am
106+++ b/gold/testsuite/Makefile.am
107@@ -1518,7 +1518,7 @@ dynamic_list_lib1.o: dynamic_list_lib1.cc
108 $(CXXCOMPILE) -c -fpic -o $@ $<
109
110 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
111- $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
112+ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
113 dynamic_list_lib2.o: dynamic_list_lib2.cc
114 $(CXXCOMPILE) -c -fpic -o $@ $<
115
116diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
117index 217e472..b4ae3fd 100644
118--- a/gold/testsuite/Makefile.in
119+++ b/gold/testsuite/Makefile.in
120@@ -5319,7 +5319,7 @@ uninstall-am:
121 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
122
123 @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
124-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
125+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
126 @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.o: dynamic_list_lib2.cc
127 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
128
129--
1301.9.1
131