diff options
author | Khem Raj <raj.khem@gmail.com> | 2013-06-26 23:52:59 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-07-05 15:34:26 +0100 |
commit | 7450ff24160864bf93804eac6985782a4784e565 (patch) | |
tree | d943500125e8f803ea5a7c28162b6f4923570147 /meta | |
parent | 470fe276799732633b56c1cf88b7d1a157686e90 (diff) | |
download | poky-7450ff24160864bf93804eac6985782a4784e565.tar.gz |
binutils: Backport emulation template fixes
This fixes the linking errors seen on mips64 when linking
sln/ from eglibc 2.18
/builds1/angstrom/build/tmp-angstrom_next-eglibc/sysroots/x86_64-linux/usr/libexec/mips64-angstrom-linux.gcc-cross-initial/gcc/mips64-angstrom-linux/4.8.1/ld:
BFD (GNU Binutils) 2.23.2 assertion fail
/builds1/angstrom/build/tmp-angstrom_next-eglibc/work/mips64-angstrom-linux/binutils-cross/2.23.2-r4/binutils-2.23.2/bfd/elfxx-mips.c:3453
| collect2: error: ld returned 1 exit status
(From OE-Core rev: eda721f0c85afa30c2b3030ef76522cc3451af21)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
4 files changed, 280 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.2.inc b/meta/recipes-devtools/binutils/binutils-2.23.2.inc index f5b5a99a46..99fe2e558f 100644 --- a/meta/recipes-devtools/binutils/binutils-2.23.2.inc +++ b/meta/recipes-devtools/binutils/binutils-2.23.2.inc | |||
@@ -43,6 +43,9 @@ BACKPORT = "\ | |||
43 | file://backport/aarch64-movi.patch \ | 43 | file://backport/aarch64-movi.patch \ |
44 | file://backport/0001-config-tc-ppc.c-PPC_VLE_SPLIT16A-Delete-unused-macro.patch \ | 44 | file://backport/0001-config-tc-ppc.c-PPC_VLE_SPLIT16A-Delete-unused-macro.patch \ |
45 | file://backport/0002-config-tc-ppc.c-md_apply_fix-Sign-extend-fieldval-un.patch \ | 45 | file://backport/0002-config-tc-ppc.c-md_apply_fix-Sign-extend-fieldval-un.patch \ |
46 | file://backport/0001-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch \ | ||
47 | file://backport/0002-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch \ | ||
48 | file://backport/0003-gold.patch \ | ||
46 | " | 49 | " |
47 | SRC_URI[md5sum] = "4f8fa651e35ef262edc01d60fb45702e" | 50 | SRC_URI[md5sum] = "4f8fa651e35ef262edc01d60fb45702e" |
48 | SRC_URI[sha256sum] = "fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097" | 51 | SRC_URI[sha256sum] = "fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097" |
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0001-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch b/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0001-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch new file mode 100644 index 0000000000..050450fae2 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0001-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 4c147afe1796611c431aa86ea12342c1d80c2c4b Mon Sep 17 00:00:00 2001 | ||
2 | From: "Maciej W. Rozycki" <macro@linux-mips.org> | ||
3 | Date: Wed, 1 May 2013 17:18:43 +0000 | ||
4 | Subject: [PATCH] * emultempl/elf32.em | ||
5 | (gld${EMULATION_NAME}_before_allocation): Use | ||
6 | is_elf_hash_table rather than a handcoded condition. | ||
7 | |||
8 | --- | ||
9 | ld/ChangeLog | 5 +++++ | ||
10 | ld/emultempl/elf32.em | 2 +- | ||
11 | 2 files changed, 6 insertions(+), 1 deletion(-) | ||
12 | |||
13 | 2013-05-01 Maciej W. Rozycki <macro@codesourcery.com> | ||
14 | |||
15 | * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): | ||
16 | Use is_elf_hash_table rather than a handcoded condition. | ||
17 | |||
18 | Upstream-Status: Backport | ||
19 | Index: binutils-2.23.2/ld/emultempl/elf32.em | ||
20 | =================================================================== | ||
21 | --- binutils-2.23.2.orig/ld/emultempl/elf32.em 2013-06-26 23:29:32.000000000 -0700 | ||
22 | +++ binutils-2.23.2/ld/emultempl/elf32.em 2013-06-26 23:35:45.798428256 -0700 | ||
23 | @@ -1494,7 +1494,7 @@ | ||
24 | asection *sinterp; | ||
25 | bfd *abfd; | ||
26 | |||
27 | - if (link_info.hash->type == bfd_link_elf_hash_table) | ||
28 | + if (is_elf_hash_table (link_info.hash)) | ||
29 | _bfd_elf_tls_setup (link_info.output_bfd, &link_info); | ||
30 | |||
31 | /* If we are going to make any variable assignments, we need to let | ||
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0002-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch b/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0002-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch new file mode 100644 index 0000000000..36e5924d48 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0002-emultempl-elf32.em-gld-EMULATION_NAME-_before_alloca.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From b0d2b7b6eae7b7f4fbfd1695d4d2f1b45198d597 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Maciej W. Rozycki" <macro@linux-mips.org> | ||
3 | Date: Fri, 3 May 2013 15:01:19 +0000 | ||
4 | Subject: [PATCH] * emultempl/elf32.em | ||
5 | (gld${EMULATION_NAME}_before_allocation): Only call | ||
6 | lang_for_each_statement if an ELF hash table is used. | ||
7 | |||
8 | --- | ||
9 | ld/ChangeLog | 5 +++++ | ||
10 | ld/emultempl/elf32.em | 12 +++++++----- | ||
11 | 2 files changed, 12 insertions(+), 5 deletions(-) | ||
12 | |||
13 | 2013-05-03 Alan Modra <amodra@gmail.com> | ||
14 | |||
15 | * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): | ||
16 | Only call lang_for_each_statement if an ELF hash table is used. | ||
17 | |||
18 | Upstream-Status: Backport | ||
19 | |||
20 | Index: binutils-2.23.2/ld/emultempl/elf32.em | ||
21 | =================================================================== | ||
22 | --- binutils-2.23.2.orig/ld/emultempl/elf32.em 2013-06-26 23:35:45.000000000 -0700 | ||
23 | +++ binutils-2.23.2/ld/emultempl/elf32.em 2013-06-26 23:37:04.530429733 -0700 | ||
24 | @@ -1495,12 +1495,14 @@ | ||
25 | bfd *abfd; | ||
26 | |||
27 | if (is_elf_hash_table (link_info.hash)) | ||
28 | - _bfd_elf_tls_setup (link_info.output_bfd, &link_info); | ||
29 | + { | ||
30 | + _bfd_elf_tls_setup (link_info.output_bfd, &link_info); | ||
31 | |||
32 | - /* If we are going to make any variable assignments, we need to let | ||
33 | - the ELF backend know about them in case the variables are | ||
34 | - referred to by dynamic objects. */ | ||
35 | - lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment); | ||
36 | + /* If we are going to make any variable assignments, we need to | ||
37 | + let the ELF backend know about them in case the variables are | ||
38 | + referred to by dynamic objects. */ | ||
39 | + lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment); | ||
40 | + } | ||
41 | |||
42 | /* Let the ELF backend work out the sizes of any sections required | ||
43 | by dynamic linking. */ | ||
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0003-gold.patch b/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0003-gold.patch new file mode 100644 index 0000000000..141e66bce2 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.2/backport/0003-gold.patch | |||
@@ -0,0 +1,203 @@ | |||
1 | From a347c1bd9be53513f60ed0e5f440c1f5cd78dec4 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Maciej W. Rozycki" <macro@linux-mips.org> | ||
3 | Date: Fri, 3 May 2013 15:19:26 +0000 | ||
4 | Subject: [PATCH] gold/ PR ld/15365 * layout.cc | ||
5 | (Layout::finalize): Make __ehdr_start STV_HIDDEN. | ||
6 | |||
7 | ld/ | ||
8 | PR ld/15365 | ||
9 | * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): | ||
10 | Restrict __ehdr_start's export class to no less than STV_HIDDEN. | ||
11 | |||
12 | ld/testsuite/ | ||
13 | PR ld/15365 | ||
14 | * ld-elf/ehdr_start.d: Expect __ehdr_start to be STB_LOCAL. | ||
15 | * ld-mips-elf/ehdr_start-1.nd: New test. | ||
16 | * ld-mips-elf/ehdr_start-2.nd: New test. | ||
17 | * ld-mips-elf/ehdr_start-1.ld: New test linker script. | ||
18 | * ld-mips-elf/ehdr_start-2.ld: New test linker script. | ||
19 | * ld-mips-elf/ehdr_start-new.s: New test source. | ||
20 | * ld-mips-elf/ehdr_start-o32.s: New test source. | ||
21 | * ld-mips-elf/mips-elf.exp: Run the new tests. | ||
22 | --- | ||
23 | gold/ChangeLog | 5 +++++ | ||
24 | gold/layout.cc | 2 +- | ||
25 | ld/ChangeLog | 6 ++++++ | ||
26 | ld/emultempl/elf32.em | 7 +++++++ | ||
27 | ld/testsuite/ChangeLog | 12 ++++++++++++ | ||
28 | ld/testsuite/ld-elf/ehdr_start.d | 2 +- | ||
29 | ld/testsuite/ld-mips-elf/ehdr_start-1.ld | 9 +++++++++ | ||
30 | ld/testsuite/ld-mips-elf/ehdr_start-1.nd | 4 ++++ | ||
31 | ld/testsuite/ld-mips-elf/ehdr_start-2.ld | 10 ++++++++++ | ||
32 | ld/testsuite/ld-mips-elf/ehdr_start-2.nd | 4 ++++ | ||
33 | ld/testsuite/ld-mips-elf/ehdr_start-new.s | 13 +++++++++++++ | ||
34 | ld/testsuite/ld-mips-elf/ehdr_start-o32.s | 14 ++++++++++++++ | ||
35 | ld/testsuite/ld-mips-elf/mips-elf.exp | 25 +++++++++++++++++++++++++ | ||
36 | 13 files changed, 111 insertions(+), 2 deletions(-) | ||
37 | create mode 100644 ld/testsuite/ld-mips-elf/ehdr_start-1.ld | ||
38 | create mode 100644 ld/testsuite/ld-mips-elf/ehdr_start-1.nd | ||
39 | create mode 100644 ld/testsuite/ld-mips-elf/ehdr_start-2.ld | ||
40 | create mode 100644 ld/testsuite/ld-mips-elf/ehdr_start-2.nd | ||
41 | create mode 100644 ld/testsuite/ld-mips-elf/ehdr_start-new.s | ||
42 | create mode 100644 ld/testsuite/ld-mips-elf/ehdr_start-o32.s | ||
43 | |||
44 | Upstream-Status: Backport | ||
45 | Index: binutils-2.23.2/gold/layout.cc | ||
46 | =================================================================== | ||
47 | --- binutils-2.23.2.orig/gold/layout.cc 2013-06-26 23:29:32.000000000 -0700 | ||
48 | +++ binutils-2.23.2/gold/layout.cc 2013-06-26 23:39:22.170432315 -0700 | ||
49 | @@ -2516,7 +2516,7 @@ | ||
50 | symtab->define_in_output_segment("__ehdr_start", NULL, | ||
51 | Symbol_table::PREDEFINED, load_seg, 0, 0, | ||
52 | elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, | ||
53 | - elfcpp::STV_DEFAULT, 0, | ||
54 | + elfcpp::STV_HIDDEN, 0, | ||
55 | Symbol::SEGMENT_START, true); | ||
56 | |||
57 | // Set the file offsets of all the non-data sections we've seen so | ||
58 | Index: binutils-2.23.2/ld/emultempl/elf32.em | ||
59 | =================================================================== | ||
60 | --- binutils-2.23.2.orig/ld/emultempl/elf32.em 2013-06-26 23:37:04.000000000 -0700 | ||
61 | +++ binutils-2.23.2/ld/emultempl/elf32.em 2013-06-26 23:39:22.174432315 -0700 | ||
62 | @@ -1498,6 +1498,13 @@ | ||
63 | { | ||
64 | _bfd_elf_tls_setup (link_info.output_bfd, &link_info); | ||
65 | |||
66 | + /* Make __ehdr_start hidden if it has been referenced, to | ||
67 | + prevent the symbol from being dynamic. */ | ||
68 | + if (!bfd_elf_record_link_assignment (link_info.output_bfd, &link_info, | ||
69 | + "__ehdr_start", TRUE, TRUE)) | ||
70 | + einfo ("%P%F: failed to record assignment to %s: %E\n", | ||
71 | + "__ehdr_start"); | ||
72 | + | ||
73 | /* If we are going to make any variable assignments, we need to | ||
74 | let the ELF backend know about them in case the variables are | ||
75 | referred to by dynamic objects. */ | ||
76 | Index: binutils-2.23.2/ld/testsuite/ld-elf/ehdr_start.d | ||
77 | =================================================================== | ||
78 | --- binutils-2.23.2.orig/ld/testsuite/ld-elf/ehdr_start.d 2013-06-26 23:29:32.000000000 -0700 | ||
79 | +++ binutils-2.23.2/ld/testsuite/ld-elf/ehdr_start.d 2013-06-26 23:39:22.174432315 -0700 | ||
80 | @@ -4,5 +4,5 @@ | ||
81 | #target: *-*-linux* *-*-gnu* *-*-nacl* | ||
82 | |||
83 | #... | ||
84 | -[0-9a-f]*000 [ADRT] __ehdr_start | ||
85 | +[0-9a-f]*000 [Adrt] __ehdr_start | ||
86 | #pass | ||
87 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-1.ld | ||
88 | =================================================================== | ||
89 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
90 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-1.ld 2013-06-26 23:39:22.174432315 -0700 | ||
91 | @@ -0,0 +1,9 @@ | ||
92 | +ENTRY (__start) | ||
93 | +SECTIONS | ||
94 | +{ | ||
95 | + . = 0x12300000 + SIZEOF_HEADERS; | ||
96 | + .text : { *(.text) } | ||
97 | + . = 0x23400000; | ||
98 | + HIDDEN (_gp = ALIGN (16) + 0x7ff0); | ||
99 | + .got : { *(.got) } | ||
100 | +} | ||
101 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-1.nd | ||
102 | =================================================================== | ||
103 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
104 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-1.nd 2013-06-26 23:39:22.174432315 -0700 | ||
105 | @@ -0,0 +1,4 @@ | ||
106 | +Symbol table '\.symtab' contains [0-9]+ entries: | ||
107 | +#... | ||
108 | + *[0-9]+: 0*12300000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +[0-9]+ __ehdr_start | ||
109 | +#pass | ||
110 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-2.ld | ||
111 | =================================================================== | ||
112 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
113 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-2.ld 2013-06-26 23:39:22.174432315 -0700 | ||
114 | @@ -0,0 +1,10 @@ | ||
115 | +ENTRY (__start) | ||
116 | +SECTIONS | ||
117 | +{ | ||
118 | + . = 0x12300000 + SIZEOF_HEADERS; | ||
119 | + .text : { *(.text) } | ||
120 | + . = 0x23400000; | ||
121 | + __ehdr_start = .; | ||
122 | + HIDDEN (_gp = ALIGN (16) + 0x7ff0); | ||
123 | + .got : { *(.got) } | ||
124 | +} | ||
125 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-2.nd | ||
126 | =================================================================== | ||
127 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
128 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-2.nd 2013-06-26 23:39:22.178432315 -0700 | ||
129 | @@ -0,0 +1,4 @@ | ||
130 | +Symbol table '\.symtab' contains [0-9]+ entries: | ||
131 | +#... | ||
132 | + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +[0-9]+ __ehdr_start | ||
133 | +#pass | ||
134 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-new.s | ||
135 | =================================================================== | ||
136 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
137 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-new.s 2013-06-26 23:39:22.178432315 -0700 | ||
138 | @@ -0,0 +1,13 @@ | ||
139 | + .abicalls | ||
140 | + .text | ||
141 | + .weak __ehdr_start | ||
142 | + .globl __start | ||
143 | + .ent __start | ||
144 | + .frame $29, 0, $31 | ||
145 | + .mask 0x00000000, 0 | ||
146 | +__start: | ||
147 | + .cplocal $2 | ||
148 | + .cpsetup $t9, $zero, __start | ||
149 | + lw $2, __ehdr_start | ||
150 | + jr $31 | ||
151 | + .end __start | ||
152 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-o32.s | ||
153 | =================================================================== | ||
154 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
155 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/ehdr_start-o32.s 2013-06-26 23:39:22.178432315 -0700 | ||
156 | @@ -0,0 +1,14 @@ | ||
157 | + .abicalls | ||
158 | + .text | ||
159 | + .weak __ehdr_start | ||
160 | + .globl __start | ||
161 | + .ent __start | ||
162 | + .frame $29, 0, $31 | ||
163 | + .mask 0x00000000, 0 | ||
164 | +__start: | ||
165 | + .set noreorder | ||
166 | + .cpload $25 | ||
167 | + .set reorder | ||
168 | + lw $2, __ehdr_start | ||
169 | + jr $31 | ||
170 | + .end __start | ||
171 | Index: binutils-2.23.2/ld/testsuite/ld-mips-elf/mips-elf.exp | ||
172 | =================================================================== | ||
173 | --- binutils-2.23.2.orig/ld/testsuite/ld-mips-elf/mips-elf.exp 2013-06-26 23:29:32.000000000 -0700 | ||
174 | +++ binutils-2.23.2/ld/testsuite/ld-mips-elf/mips-elf.exp 2013-06-26 23:39:22.178432315 -0700 | ||
175 | @@ -669,3 +669,28 @@ | ||
176 | "readelf -A export-class-call16-${abi}.gd"] \ | ||
177 | "export-class-call16-${abi}.so"]] | ||
178 | } | ||
179 | + | ||
180 | +# Magic __ehdr_start symbol tests. | ||
181 | +set abis [concat o32 [expr {$has_newabi ? "n32 n64" : ""}]] | ||
182 | +foreach { abi } $abis { | ||
183 | + set suff [string map {o32 o32 n32 new n64 new} $abi] | ||
184 | + run_ld_link_tests [list \ | ||
185 | + [list \ | ||
186 | + "MIPS magic __ehdr_start symbol test 1 ($abi)" \ | ||
187 | + "$abi_ldflags($abi) -T ehdr_start-1.ld" "" \ | ||
188 | + "$abi_asflags($abi)" \ | ||
189 | + [list ehdr_start-${suff}.s] \ | ||
190 | + [list "readelf -s ehdr_start-1.nd"] \ | ||
191 | + "ehdr_start-1-${abi}"]] | ||
192 | + if [regexp "(?:n32|n64)" "$abi"] { | ||
193 | + setup_kfail "mips*-*-*" "ld/15428" | ||
194 | + } | ||
195 | + run_ld_link_tests [list \ | ||
196 | + [list \ | ||
197 | + "MIPS magic __ehdr_start symbol test 2 ($abi)" \ | ||
198 | + "$abi_ldflags($abi) -T ehdr_start-2.ld" "" \ | ||
199 | + "$abi_asflags($abi)" \ | ||
200 | + [list ehdr_start-${suff}.s] \ | ||
201 | + [list "readelf -s ehdr_start-2.nd"] \ | ||
202 | + "ehdr_start-2-${abi}"]] | ||
203 | +} | ||