diff options
Diffstat (limited to 'meta/recipes-devtools/binutils')
5 files changed, 329 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.31.inc b/meta/recipes-devtools/binutils/binutils-2.31.inc index bc951d73e4..76add0fe4b 100644 --- a/meta/recipes-devtools/binutils/binutils-2.31.inc +++ b/meta/recipes-devtools/binutils/binutils-2.31.inc | |||
@@ -37,6 +37,10 @@ SRC_URI = "\ | |||
37 | file://0015-sync-with-OE-libtool-changes.patch \ | 37 | file://0015-sync-with-OE-libtool-changes.patch \ |
38 | file://0016-add-i386pep-emulation-for-x86_64.patch \ | 38 | file://0016-add-i386pep-emulation-for-x86_64.patch \ |
39 | file://0017-improve-check-for-input-file-matching-output-file.patch \ | 39 | file://0017-improve-check-for-input-file-matching-output-file.patch \ |
40 | file://0018-Refactored-location-where-GOT-information-is-collect.patch \ | ||
41 | file://0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch \ | ||
42 | file://0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch \ | ||
43 | file://0021-PLT-information-was-still-being-generated-when-symbo.patch \ | ||
40 | " | 44 | " |
41 | S = "${WORKDIR}/git" | 45 | S = "${WORKDIR}/git" |
42 | 46 | ||
diff --git a/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch b/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch new file mode 100644 index 0000000000..d41339a9a6 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch | |||
@@ -0,0 +1,201 @@ | |||
1 | From d930affa2d475d1cc6792f1e6d56bef3d6c617db Mon Sep 17 00:00:00 2001 | ||
2 | From: Cupertino Miranda <cmiranda@synopsys.com> | ||
3 | Date: Fri, 2 Mar 2018 17:16:21 +0100 | ||
4 | Subject: [PATCH] Refactored location where GOT information is collected. | ||
5 | |||
6 | Change location where GOT information is collected for ARC target, avoiding | ||
7 | posible use conflicts of the previous .got field in the symbols hash_entry. | ||
8 | |||
9 | bfd/ | ||
10 | 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> | ||
11 | |||
12 | * arc-got.h (get_got_entry_list_for_symbol): Changed. | ||
13 | * ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed. | ||
14 | (elf_arc_link_hash_newfunc): Changed. | ||
15 | (arc_elf_link_hash_table_create): Removed old initializations. | ||
16 | (elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed. | ||
17 | |||
18 | Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com> | ||
19 | Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> | ||
20 | [Romain: rebase on top of 2.31] | ||
21 | Signed-off-by: Romain Naour <romain.naour@gmail.com> | ||
22 | |||
23 | Upstream-Status: Pending | ||
24 | --- | ||
25 | bfd/arc-got.h | 6 +++-- | ||
26 | bfd/elf32-arc.c | 77 +++++++++++++++++++++++++++++++-------------------------- | ||
27 | 2 files changed, 46 insertions(+), 37 deletions(-) | ||
28 | |||
29 | diff --git a/bfd/arc-got.h b/bfd/arc-got.h | ||
30 | index a86061bcb38..81ce88fe21a 100644 | ||
31 | --- a/bfd/arc-got.h | ||
32 | +++ b/bfd/arc-got.h | ||
33 | @@ -156,9 +156,11 @@ get_got_entry_list_for_symbol (bfd *abfd, | ||
34 | unsigned long r_symndx, | ||
35 | struct elf_link_hash_entry *h) | ||
36 | { | ||
37 | - if (h != NULL) | ||
38 | + struct elf_arc_link_hash_entry *h1 = | ||
39 | + ((struct elf_arc_link_hash_entry *) h); | ||
40 | + if (h1 != NULL) | ||
41 | { | ||
42 | - return &h->got.glist; | ||
43 | + return &h1->got_ents; | ||
44 | } | ||
45 | else | ||
46 | { | ||
47 | diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c | ||
48 | index a48ef0ca15f..ab84de43815 100644 | ||
49 | --- a/bfd/elf32-arc.c | ||
50 | +++ b/bfd/elf32-arc.c | ||
51 | @@ -160,6 +160,18 @@ struct arc_relocation_data | ||
52 | const char * symbol_name; | ||
53 | }; | ||
54 | |||
55 | +/* ARC ELF linker hash entry. */ | ||
56 | +struct elf_arc_link_hash_entry | ||
57 | +{ | ||
58 | + struct elf_link_hash_entry root; | ||
59 | + | ||
60 | + /* Track dynamic relocs copied for this symbol. */ | ||
61 | + struct elf_dyn_relocs *dyn_relocs; | ||
62 | + | ||
63 | + struct got_entry *got_ents; | ||
64 | +}; | ||
65 | + | ||
66 | + | ||
67 | /* Should be included at this location due to static declarations | ||
68 | defined before this point. */ | ||
69 | #include "arc-got.h" | ||
70 | @@ -281,15 +293,6 @@ struct arc_reloc_map | ||
71 | unsigned char elf_reloc_val; | ||
72 | }; | ||
73 | |||
74 | -/* ARC ELF linker hash entry. */ | ||
75 | -struct elf_arc_link_hash_entry | ||
76 | -{ | ||
77 | - struct elf_link_hash_entry root; | ||
78 | - | ||
79 | - /* Track dynamic relocs copied for this symbol. */ | ||
80 | - struct elf_dyn_relocs *dyn_relocs; | ||
81 | -}; | ||
82 | - | ||
83 | /* ARC ELF linker hash table. */ | ||
84 | struct elf_arc_link_hash_table | ||
85 | { | ||
86 | @@ -301,28 +304,28 @@ elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry, | ||
87 | struct bfd_hash_table *table, | ||
88 | const char *string) | ||
89 | { | ||
90 | + struct elf_arc_link_hash_entry * ret = | ||
91 | + (struct elf_arc_link_hash_entry *) entry; | ||
92 | + | ||
93 | /* Allocate the structure if it has not already been allocated by a | ||
94 | subclass. */ | ||
95 | - if (entry == NULL) | ||
96 | - { | ||
97 | - entry = (struct bfd_hash_entry *) | ||
98 | - bfd_hash_allocate (table, | ||
99 | - sizeof (struct elf_arc_link_hash_entry)); | ||
100 | - if (entry == NULL) | ||
101 | - return entry; | ||
102 | - } | ||
103 | + if (ret == NULL) | ||
104 | + ret = (struct elf_arc_link_hash_entry *) | ||
105 | + bfd_hash_allocate (table, sizeof (struct elf_arc_link_hash_entry)); | ||
106 | + if (ret == NULL) | ||
107 | + return (struct bfd_hash_entry *) ret; | ||
108 | |||
109 | /* Call the allocation method of the superclass. */ | ||
110 | - entry = _bfd_elf_link_hash_newfunc (entry, table, string); | ||
111 | - if (entry != NULL) | ||
112 | + ret = ((struct elf_arc_link_hash_entry *) | ||
113 | + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, | ||
114 | + table, string)); | ||
115 | + if (ret != NULL) | ||
116 | { | ||
117 | - struct elf_arc_link_hash_entry *eh; | ||
118 | - | ||
119 | - eh = (struct elf_arc_link_hash_entry *) entry; | ||
120 | - eh->dyn_relocs = NULL; | ||
121 | + ret->dyn_relocs = NULL; | ||
122 | + ret->got_ents = NULL; | ||
123 | } | ||
124 | |||
125 | - return entry; | ||
126 | + return (struct bfd_hash_entry *) ret; | ||
127 | } | ||
128 | |||
129 | /* Destroy an ARC ELF linker hash table. */ | ||
130 | @@ -352,11 +355,6 @@ arc_elf_link_hash_table_create (bfd *abfd) | ||
131 | return NULL; | ||
132 | } | ||
133 | |||
134 | - ret->elf.init_got_refcount.refcount = 0; | ||
135 | - ret->elf.init_got_refcount.glist = NULL; | ||
136 | - ret->elf.init_got_offset.offset = 0; | ||
137 | - ret->elf.init_got_offset.glist = NULL; | ||
138 | - | ||
139 | ret->elf.root.hash_table_free = elf_arc_link_hash_table_free; | ||
140 | |||
141 | return &ret->elf.root; | ||
142 | @@ -1615,10 +1613,14 @@ elf_arc_relocate_section (bfd * output_bfd, | ||
143 | while (h->root.type == bfd_link_hash_indirect | ||
144 | || h->root.type == bfd_link_hash_warning) | ||
145 | { | ||
146 | - struct elf_link_hash_entry *h_old = h; | ||
147 | + struct elf_arc_link_hash_entry *ah_old = | ||
148 | + (struct elf_arc_link_hash_entry *) h; | ||
149 | h = (struct elf_link_hash_entry *) h->root.u.i.link; | ||
150 | - if (h->got.glist == 0 && h_old->got.glist != h->got.glist) | ||
151 | - h->got.glist = h_old->got.glist; | ||
152 | + struct elf_arc_link_hash_entry *ah = | ||
153 | + (struct elf_arc_link_hash_entry *) h; | ||
154 | + | ||
155 | + if (ah->got_ents == 0 && ah_old->got_ents != ah->got_ents) | ||
156 | + ah->got_ents = ah_old->got_ents; | ||
157 | } | ||
158 | |||
159 | /* TODO: Need to validate what was the intention. */ | ||
160 | @@ -1636,6 +1638,8 @@ elf_arc_relocate_section (bfd * output_bfd, | ||
161 | |||
162 | if (is_reloc_for_GOT (howto) && !bfd_link_pic (info)) | ||
163 | { | ||
164 | + struct elf_arc_link_hash_entry *ah = | ||
165 | + (struct elf_arc_link_hash_entry *) h; | ||
166 | /* TODO: Change it to use arc_do_relocation with | ||
167 | ARC_32 reloc. Try to use ADD_RELA macro. */ | ||
168 | bfd_vma relocation = | ||
169 | @@ -1645,8 +1649,8 @@ elf_arc_relocate_section (bfd * output_bfd, | ||
170 | + reloc_data.sym_section->output_section->vma) | ||
171 | : 0); | ||
172 | |||
173 | - BFD_ASSERT (h->got.glist); | ||
174 | - bfd_vma got_offset = h->got.glist->offset; | ||
175 | + BFD_ASSERT (ah->got_ents); | ||
176 | + bfd_vma got_offset = ah->got_ents->offset; | ||
177 | bfd_put_32 (output_bfd, relocation, | ||
178 | htab->sgot->contents + got_offset); | ||
179 | } | ||
180 | @@ -1958,6 +1962,7 @@ elf_arc_check_relocs (bfd * abfd, | ||
181 | else /* Global one. */ | ||
182 | h = sym_hashes[r_symndx - symtab_hdr->sh_info]; | ||
183 | |||
184 | + | ||
185 | switch (r_type) | ||
186 | { | ||
187 | case R_ARC_32: | ||
188 | @@ -2404,7 +2409,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd, | ||
189 | create respective dynamic relocs. */ | ||
190 | /* TODO: Make function to get list and not access the list directly. */ | ||
191 | /* TODO: Move function to relocate_section create this relocs eagerly. */ | ||
192 | - create_got_dynrelocs_for_got_info (&h->got.glist, | ||
193 | + struct elf_arc_link_hash_entry *ah = | ||
194 | + (struct elf_arc_link_hash_entry *) h; | ||
195 | + create_got_dynrelocs_for_got_info (&ah->got_ents, | ||
196 | output_bfd, | ||
197 | info, | ||
198 | h); | ||
199 | -- | ||
200 | 2.14.4 | ||
201 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch b/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch new file mode 100644 index 0000000000..6a58ee06ac --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From 955176bd999fe80c5b937ab8786665079e35c387 Mon Sep 17 00:00:00 2001 | ||
2 | From: Cupertino Miranda <cmiranda@synopsys.com> | ||
3 | Date: Fri, 2 Mar 2018 17:33:48 +0100 | ||
4 | Subject: [PATCH] Improved robustness. Return FALSE in case of NULL pointer. | ||
5 | |||
6 | bfd/ | ||
7 | 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> | ||
8 | |||
9 | * elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case | ||
10 | arc_htab is NULL. | ||
11 | |||
12 | Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com> | ||
13 | Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> | ||
14 | [Romain: rebase on top of 2.31] | ||
15 | Signed-off-by: Romain Naour <romain.naour@gmail.com> | ||
16 | |||
17 | Upstream-Status: Pending | ||
18 | --- | ||
19 | bfd/elf32-arc.c | 3 +++ | ||
20 | 1 file changed, 3 insertions(+) | ||
21 | |||
22 | diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c | ||
23 | index ab84de43815..33fc72cff6e 100644 | ||
24 | --- a/bfd/elf32-arc.c | ||
25 | +++ b/bfd/elf32-arc.c | ||
26 | @@ -2420,6 +2420,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd, | ||
27 | { | ||
28 | struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info); | ||
29 | |||
30 | + if(arc_htab == NULL) | ||
31 | + return FALSE; | ||
32 | + | ||
33 | if (h->dynindx == -1 | ||
34 | || (h->root.type != bfd_link_hash_defined | ||
35 | && h->root.type != bfd_link_hash_defweak) | ||
36 | -- | ||
37 | 2.14.4 | ||
38 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch b/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch new file mode 100644 index 0000000000..01e42c03bb --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From 9d09ce14b4eef2b56f24660fd69a44acd45128b2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Cupertino Miranda <cmiranda@synopsys.com> | ||
3 | Date: Fri, 2 Mar 2018 17:38:14 +0100 | ||
4 | Subject: [PATCH] Make sure global symbol is not an indirect or warning. | ||
5 | |||
6 | Problem identified in the context of glibc with latest upstream binutils. | ||
7 | Dynamic symbol space was being reserved but, no actual information for the | ||
8 | symbol was being set. Data for the symbol was kept initialized with -1. | ||
9 | No easy test case was possible to be created. | ||
10 | |||
11 | bfd/ | ||
12 | 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> | ||
13 | |||
14 | * elf32-arc.c (elf_arc_check_relocs): Changed. | ||
15 | |||
16 | Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com> | ||
17 | Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> | ||
18 | [Romain: rebase on top of 2.31] | ||
19 | Signed-off-by: Romain Naour <romain.naour@gmail.com> | ||
20 | |||
21 | Upstream-Status: Pending | ||
22 | --- | ||
23 | bfd/elf32-arc.c | 7 ++++++- | ||
24 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
25 | |||
26 | diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c | ||
27 | index 33fc72cff6e..9b72c5b4f4f 100644 | ||
28 | --- a/bfd/elf32-arc.c | ||
29 | +++ b/bfd/elf32-arc.c | ||
30 | @@ -1960,7 +1960,12 @@ elf_arc_check_relocs (bfd * abfd, | ||
31 | if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */ | ||
32 | h = NULL; | ||
33 | else /* Global one. */ | ||
34 | - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; | ||
35 | + { | ||
36 | + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; | ||
37 | + while (h->root.type == bfd_link_hash_indirect | ||
38 | + || h->root.type == bfd_link_hash_warning) | ||
39 | + h = (struct elf_link_hash_entry *) h->root.u.i.link; | ||
40 | + } | ||
41 | |||
42 | |||
43 | switch (r_type) | ||
44 | -- | ||
45 | 2.14.4 | ||
46 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch b/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch new file mode 100644 index 0000000000..9e942399c0 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From e4861c68067cb2166b4c2bb9c052abeb6ad9aaa1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Cupertino Miranda <cmiranda@synopsys.com> | ||
3 | Date: Fri, 2 Mar 2018 17:44:29 +0100 | ||
4 | Subject: [PATCH] PLT information was still being generated when symbol was | ||
5 | forced_local. | ||
6 | |||
7 | A change upstream reveiled this issue, triggering an assert when linking glibc. | ||
8 | |||
9 | bfd/ | ||
10 | 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> | ||
11 | |||
12 | * elf32-arc.c (elf_arc_check_relocs): Changed. | ||
13 | |||
14 | Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com> | ||
15 | Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> | ||
16 | [Romain: rebase on top of 2.31] | ||
17 | Signed-off-by: Romain Naour <romain.naour@gmail.com> | ||
18 | |||
19 | Upstream-Status: Pending | ||
20 | --- | ||
21 | bfd/elf32-arc.c | 3 ++- | ||
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
23 | |||
24 | diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c | ||
25 | index 9b72c5b4f4f..b40b463d34d 100644 | ||
26 | --- a/bfd/elf32-arc.c | ||
27 | +++ b/bfd/elf32-arc.c | ||
28 | @@ -2041,7 +2041,8 @@ elf_arc_check_relocs (bfd * abfd, | ||
29 | if (h == NULL) | ||
30 | continue; | ||
31 | else | ||
32 | - h->needs_plt = 1; | ||
33 | + if(h->forced_local == 0) | ||
34 | + h->needs_plt = 1; | ||
35 | } | ||
36 | |||
37 | /* Add info to the symbol got_entry_list. */ | ||
38 | -- | ||
39 | 2.14.4 | ||
40 | |||