summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils')
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.24.inc2
-rw-r--r--meta/recipes-devtools/binutils/binutils/fix-pr16476.patch220
-rw-r--r--meta/recipes-devtools/binutils/binutils/fix-pr2404.patch76
3 files changed, 298 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.24.inc b/meta/recipes-devtools/binutils/binutils-2.24.inc
index 86ff9999c0..42d4ede229 100644
--- a/meta/recipes-devtools/binutils/binutils-2.24.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.24.inc
@@ -26,6 +26,8 @@ SRC_URI = "\
26 file://mips64-default-ld-emulation.patch \ 26 file://mips64-default-ld-emulation.patch \
27 file://binutils-xlp-support.patch \ 27 file://binutils-xlp-support.patch \
28 file://fix-pr15815.patch \ 28 file://fix-pr15815.patch \
29 file://fix-pr2404.patch \
30 file://fix-pr16476.patch \
29 " 31 "
30 32
31SRC_URI[md5sum] = "e0f71a7b2ddab0f8612336ac81d9636b" 33SRC_URI[md5sum] = "e0f71a7b2ddab0f8612336ac81d9636b"
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 0000000000..65d62bcde4
--- /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+}
diff --git a/meta/recipes-devtools/binutils/binutils/fix-pr2404.patch b/meta/recipes-devtools/binutils/binutils/fix-pr2404.patch
new file mode 100644
index 0000000000..41f35046fa
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/fix-pr2404.patch
@@ -0,0 +1,76 @@
1From: H.J. Lu <hjl.tools@gmail.com>
2Date: Tue, 21 Jan 2014 13:33:48 +0000 (-0800)
3Subject: Don't check shared/export_dynamic/ref_dynamic for type mismatch
4X-Git-Tag: hjl/linux/release/2.24.51.0.3~1^2~8^2~22
5X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=22ef172a21663abb477d72284b4d59c8eabcbb82
6
7Don't check shared/export_dynamic/ref_dynamic for type mismatch
8
9There is nothing linker can do when a type mismatched default definition
10are made dynamic by info->shared, info->export_dynamic or h->ref_dynamic.
11But we do want to avoid exporting it when building PIE. Let's remove
12those checks.
13
14bfd/
15
16 PR ld/2404
17 * elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
18 info->export_dynamic, nor !h->ref_dynamic for type mismatch when
19 adding the default version.
20
21ld/testsuite/
22
23 PR ld/2404
24 * ld-elf/shared.exp: Add a PIE test for PR ld/2404.
25
26Upstream-Status: Backport
27---
28
29Index: binutils-2.24/bfd/elflink.c
30===================================================================
31--- binutils-2.24.orig/bfd/elflink.c 2014-02-08 13:20:08.628378267 +0000
32+++ binutils-2.24/bfd/elflink.c 2014-02-08 13:20:08.624378267 +0000
33@@ -1090,9 +1090,6 @@
34 the type of existing regular definition mismatch. We only do it
35 if the existing regular definition won't be dynamic. */
36 if (pold_alignment == NULL
37- && !info->shared
38- && !info->export_dynamic
39- && !h->ref_dynamic
40 && newdyn
41 && newdef
42 && !olddyn
43Index: binutils-2.24/ld/testsuite/ld-elf/shared.exp
44===================================================================
45--- binutils-2.24.orig/ld/testsuite/ld-elf/shared.exp 2014-02-08 13:20:08.628378267 +0000
46+++ binutils-2.24/ld/testsuite/ld-elf/shared.exp 2014-02-08 13:20:08.624378267 +0000
47@@ -432,3 +432,29 @@
48
49 run_cc_link_tests $build_cxx_tests
50 run_ld_link_exec_tests [] $run_cxx_tests
51+
52+if { [istarget *-*-linux*]
53+ || [istarget *-*-nacl*]
54+ || [istarget *-*-gnu*] } {
55+ run_cc_link_tests [list \
56+ [list \
57+ "Build libpr2404b.a with PIE" \
58+ "" \
59+ "-fPIE" \
60+ { pr2404b.c } \
61+ {} \
62+ "libpr2404b.a" \
63+ ] \
64+ ]
65+ run_ld_link_exec_tests [] [list \
66+ [list \
67+ "Run pr2404 with PIE" \
68+ "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
69+ "" \
70+ { dummy.c } \
71+ "pr2404pie" \
72+ "pr2404.out" \
73+ "-fPIE" \
74+ ] \
75+ ]
76+}