summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/fix-pr16476.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/fix-pr16476.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/fix-pr16476.patch220
1 files changed, 220 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/fix-pr16476.patch b/meta/recipes-devtools/binutils/binutils/fix-pr16476.patch
new file mode 100644
index 0000000..65d62bc
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/fix-pr16476.patch
@@ -0,0 +1,220 @@
1From: H.J. Lu <hjl.tools@gmail.com>
2Date: Tue, 21 Jan 2014 23:42:43 +0000 (-0800)
3Subject: Check incompatible existing default symbol definition
4X-Git-Tag: hjl/linux/release/2.24.51.0.3~1^2~8^2~16
5X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=4584ec12076e088cf36965b88ef8710ca85491f9
6
7Check incompatible existing default symbol definition
8
9After resolving a versioned reference, foo@VER1, to a default versioned
10definition, foo@@VER1, from a shared object, we also merge it with
11the existing regular default symbol definition, foo. When foo is IFUNC
12and foo@@VER1 aren't, we will merge 2 incompatible definitions. This
13patch avoids merging foo@@VER1 definition with foo definition if
14one is IFUNC and the other isn't.
15
16Upstream-Status: Backport
17---
18
19#diff --git a/bfd/ChangeLog b/bfd/ChangeLog
20#index 5923bc3..c70a7db 100644
21#--- a/bfd/ChangeLog
22#+++ b/bfd/ChangeLog
23#@@ -1,5 +1,13 @@
24# 2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
25#
26#+ PR ld/16467
27#+ * elflink.c (_bfd_elf_merge_symbol): When types of the existing
28#+ regular default symbol definition and the versioned dynamic
29#+ symbol definition mismatch, skip the default symbol definition
30#+ if one of them is IFUNC.
31#+
32#+2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
33#+
34# PR ld/2404
35# * elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
36# info->export_dynamic nor h->ref_dynamic for type mismatch when
37diff --git a/bfd/elflink.c b/bfd/elflink.c
38index d0006da..792e14e 100644
39--- a/bfd/elflink.c
40+++ b/bfd/elflink.c
41@@ -1092,11 +1092,14 @@ _bfd_elf_merge_symbol (bfd *abfd,
42 && newdyn
43 && newdef
44 && !olddyn
45- && (olddef || h->root.type == bfd_link_hash_common)
46- && ELF_ST_TYPE (sym->st_info) != h->type
47- && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
48- && h->type != STT_NOTYPE
49- && !(newfunc && oldfunc))
50+ && (((olddef || h->root.type == bfd_link_hash_common)
51+ && ELF_ST_TYPE (sym->st_info) != h->type
52+ && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
53+ && h->type != STT_NOTYPE
54+ && !(newfunc && oldfunc))
55+ || (olddef
56+ && ((h->type == STT_GNU_IFUNC)
57+ != (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))))
58 {
59 *skip = TRUE;
60 return TRUE;
61#diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
62#index ac65a3a..a092428 100644
63#--- a/ld/testsuite/ChangeLog
64#+++ b/ld/testsuite/ChangeLog
65#@@ -1,5 +1,19 @@
66# 2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
67#
68#+ PR ld/16467
69#+ * ld-ifunc/dummy.c: New file.
70#+ * ld-ifunc/pr16467.out: Likewise.
71##+ * ld-ifunc/pr16467a.c: Likewise.
72#+ * ld-ifunc/pr16467a.map: Likewise.
73#+ * ld-ifunc/pr16467b.c: Likewise.
74#+ * ld-ifunc/pr16467b.map: Likewise.
75#+ * ld-ifunc/pr16467c.c: Likewise.
76#+
77#+ * ld-ifunc/ifunc.exp (run_cc_link_tests): New.
78#+ (run_ld_link_exec_tests): Run pr16467.
79#+
80#+2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
81#+
82# PR ld/2404
83# * ld-elf/shared.exp: Add a PIE test for PR ld/2404.
84#
85diff --git a/ld/testsuite/ld-ifunc/dummy.c b/ld/testsuite/ld-ifunc/dummy.c
86new file mode 100644
87index 0000000..5c03287
88--- /dev/null
89+++ b/ld/testsuite/ld-ifunc/dummy.c
90@@ -0,0 +1 @@
91+/* An empty file. */
92diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
93index fb106c6..d7ff445 100644
94--- a/ld/testsuite/ld-ifunc/ifunc.exp
95+++ b/ld/testsuite/ld-ifunc/ifunc.exp
96@@ -349,6 +349,42 @@ if { $verbose < 1 } {
97 remote_file host delete "tmpdir/static_nonifunc_prog"
98 }
99
100+run_cc_link_tests [list \
101+ [list \
102+ "Build libpr16467a.so" \
103+ "-shared -Wl,--version-script=pr16467a.map" \
104+ "-fPIC" \
105+ { pr16467a.c } \
106+ {} \
107+ "libpr16467a.so" \
108+ ] \
109+ [list \
110+ "Build libpr16467b.a" \
111+ "" \
112+ "-fPIC" \
113+ { pr16467b.c } \
114+ {} \
115+ "libpr16467b.a" \
116+ ] \
117+ [list \
118+ "Build libpr16467b.so" \
119+ "-shared tmpdir/pr16467b.o tmpdir/libpr16467a.so \
120+ -Wl,--version-script=pr16467b.map" \
121+ "-fPIC" \
122+ { dummy.c } \
123+ {} \
124+ "libpr16467b.so" \
125+ ] \
126+ [list \
127+ "Build libpr16467c.a" \
128+ "" \
129+ "" \
130+ { pr16467c.c } \
131+ {} \
132+ "libpr16467c.a" \
133+ ] \
134+]
135+
136 run_ld_link_exec_tests [] [list \
137 [list \
138 "Common symbol override ifunc test 1a" \
139@@ -368,6 +404,15 @@ run_ld_link_exec_tests [] [list \
140 "ifunc-common-1.out" \
141 "-g" \
142 ] \
143+ [list \
144+ "Run pr16467" \
145+ "tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \
146+ "" \
147+ { dummy.c } \
148+ "pr16467" \
149+ "pr16467.out" \
150+ "" \
151+ ] \
152 ]
153
154 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
155diff --git a/ld/testsuite/ld-ifunc/pr16467.out b/ld/testsuite/ld-ifunc/pr16467.out
156new file mode 100644
157index 0000000..d86bac9
158--- /dev/null
159+++ b/ld/testsuite/ld-ifunc/pr16467.out
160@@ -0,0 +1 @@
161+OK
162diff --git a/ld/testsuite/ld-ifunc/pr16467a.c b/ld/testsuite/ld-ifunc/pr16467a.c
163new file mode 100644
164index 0000000..ae3f084
165--- /dev/null
166+++ b/ld/testsuite/ld-ifunc/pr16467a.c
167@@ -0,0 +1,5 @@
168+const char *
169+sd_get_seats(void)
170+{
171+ return "OK";
172+}
173diff --git a/ld/testsuite/ld-ifunc/pr16467a.map b/ld/testsuite/ld-ifunc/pr16467a.map
174new file mode 100644
175index 0000000..d677f37
176--- /dev/null
177+++ b/ld/testsuite/ld-ifunc/pr16467a.map
178@@ -0,0 +1,4 @@
179+LIBSYSTEMD_209 {
180+global:
181+ sd_get_seats;
182+};
183diff --git a/ld/testsuite/ld-ifunc/pr16467b.c b/ld/testsuite/ld-ifunc/pr16467b.c
184new file mode 100644
185index 0000000..264f6cf
186--- /dev/null
187+++ b/ld/testsuite/ld-ifunc/pr16467b.c
188@@ -0,0 +1,7 @@
189+void new_sd_get_seats(void);
190+__asm__(".symver new_sd_get_seats,sd_get_seats@LIBSYSTEMD_209");
191+void (*resolve_sd_get_seats(void)) (void) __asm__ ("sd_get_seats");
192+void (*resolve_sd_get_seats(void)) (void) {
193+ return new_sd_get_seats;
194+}
195+__asm__(".type sd_get_seats, %gnu_indirect_function");
196diff --git a/ld/testsuite/ld-ifunc/pr16467b.map b/ld/testsuite/ld-ifunc/pr16467b.map
197new file mode 100644
198index 0000000..1f263de
199--- /dev/null
200+++ b/ld/testsuite/ld-ifunc/pr16467b.map
201@@ -0,0 +1,4 @@
202+LIBSYSTEMD_208 {
203+global:
204+ sd_get_seats;
205+};
206diff --git a/ld/testsuite/ld-ifunc/pr16467c.c b/ld/testsuite/ld-ifunc/pr16467c.c
207new file mode 100644
208index 0000000..e2a901c
209--- /dev/null
210+++ b/ld/testsuite/ld-ifunc/pr16467c.c
211@@ -0,0 +1,9 @@
212+#include <stdio.h>
213+const char* sd_get_seats(void);
214+
215+int
216+main (int argc, char **argv)
217+{
218+ printf("%s\n", sd_get_seats());
219+ return 0;
220+}