Fix buffer read overrun by ensuring that DWARF sections containing strings always...
[external/binutils.git] / bfd / ChangeLog
1 2017-08-31  Nick Clifton  <nickc@redhat.com>
2
3         PR 22047
4         * dwarf2.c (read_section): If necessary add a terminating NUL byte
5         to dwarf string sections.
6
7 2017-08-31  Alan Modra  <amodra@gmail.com>
8
9         * po/SRC-POTFILES.in: Regenerate.
10
11 2017-08-31  Alan Modra  <amodra@gmail.com>
12
13         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't exit early
14         for a section containing just a terminator.  Allow multiple
15         terminators at end of section.
16         * elflink.c (bfd_elf_discard_info): Iterate over .eh_frame
17         sections when not adding alignment.  Assert on terminator in
18         the middle of FDEs.
19
20 2017-08-31  Alan Modra  <amodra@gmail.com>
21
22         PR 21441
23         PR 22048
24         * elflink.c (bfd_elf_discard_info): Don't pad embedded zero
25         terminators.
26
27 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
28
29         * configure.ac (bfd_backends): Add elf64.lo together with
30         elfxx-x86.lo for 64-bit BFD.
31         * configure: Regenerated.
32
33 2017-08-31  James Bowman  <james.bowman@ftdichip.com>
34
35         * elf32-ft32.c (ft32_elf_howto_table): Use complain_overflow_dont
36         for R_FT32_18.
37
38 2017-08-31  Alan Modra  <amodra@gmail.com>
39
40         PR binutils/22032
41         * opncls.c (bfd_close_all_done): Don't call bfd_cache_close
42         before _close_and_cleanup.  Call iovec->bclose after.
43         (bfd_close): Remove code common to, and call, bfd_close_all_done.
44
45 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
46
47         * elf32-i386.c (elf_i386_plt_type): Removed.
48         (elf_i386_plt): Likewise.
49         (elf_i386_get_synthetic_symtab): Updated.   Call
50         _bfd_x86_elf_get_synthetic_symtab.
51         * elf64-x86-64.c (elf_x86_64_plt_type): Removed.
52         (elf_x86_64_plt): Likewise.
53         (elf_x86_64_get_synthetic_symtab): Updated.  Call
54         _bfd_x86_elf_get_synthetic_symtab.
55         * elfxx-x86.c (elf_i386_get_plt_got_vma): New function.
56         (elf_x86_64_get_plt_got_vma): Likewise.
57         (elf_i386_valid_plt_reloc_p): Likewise.
58         (elf_x86_64_valid_plt_reloc_p): Likewise.
59         (_bfd_x86_elf_get_synthetic_symtab): Likewise.
60         * elfxx-x86.h (elf_x86_plt_type): New.
61         (elf_x86_plt): Likewise.
62         (_bfd_x86_elf_get_synthetic_symtab): Likewise.
63
64 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
65
66         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Check
67         target_id instead of elf_machine_code.
68
69 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
70
71         * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed.
72         (elf_i386_lazy_plt_layout): Likewise.
73         (elf_i386_non_lazy_plt_layout): Likewise.
74         (elf_i386_plt_layout): Likewise.
75         (elf_i386_link_hash_table): Likewise.
76         (elf_i386_next_tls_desc_index): Likewise.
77         (elf_i386_srelplt2): Likewise.
78         (elf_i386_plt): Likewise.
79         (elf_i386_lazy_plt): Likewise.
80         (elf_i386_non_lazy_plt): Likewise.
81         (elf_i386_link_hash_table_create): Likewise.
82         (bfd_elf32_bfd_link_hash_table_create): Likewise.
83         (elf_i386_lazy_plt): Updated.
84         (elf_i386_non_lazy_plt): Likewise.
85         (elf_i386_lazy_ibt_plt): Likewise.
86         (elf_i386_non_lazy_ibt_plt): Likewise.
87         (elf_i386_allocate_dynrelocs): Likewise.
88         (elf_i386_size_dynamic_sections): Likewise.
89         (elf_i386_relocate_section): Likewise.
90         (elf_i386_finish_dynamic_symbol): Likewise.
91         (elf_i386_finish_dynamic_sections): Likewise.
92         (elf_i386_get_synthetic_symtab): Likewise.
93         (elf_i386_link_setup_gnu_properties): Likewise.
94         (elf_i386_nacl_plt): Likewise.
95         * elf64-x86-64.c (ABI_64_P): Removed.
96         (ELF64_DYNAMIC_INTERPRETER): Likewise.
97         (ELF32_DYNAMIC_INTERPRETER): Likewise.
98         (elf_x86_64_lazy_plt_layout): Likewise.
99         (elf_x86_64_non_lazy_plt_layout): Likewise.
100         (elf_x86_64_plt_layout): Likewise.
101         (elf_x86_64_link_hash_table): Likewise.
102         (elf_x86_64_plt): Likewise.
103         (elf_x86_64_lazy_plt): Likewise.
104         (elf_x86_64_non_lazy_plt): Likewise.
105         (elf_x86_64_link_hash_table_create): Likewise.
106         (bfd_elf64_bfd_link_hash_table_create): Likewise.
107         (bfd_elf32_bfd_link_hash_table_create): Likewise.
108         (elf_x86_64_lazy_plt): Updated.
109         (elf_x86_64_non_lazy_plt): Likewise.
110         (elf_x86_64_lazy_bnd_plt): Likewise.
111         (elf_x86_64_non_lazy_bnd_plt): Likewise.
112         (elf_x86_64_lazy_ibt_plt): Likewise.
113         (elf_x32_lazy_ibt_plt): Likewise.
114         (elf_x86_64_non_lazy_ibt_plt): Likewise.
115         (elf_x32_non_lazy_ibt_plt): Likewise.
116         (elf_x86_64_allocate_dynrelocs): Likewise.
117         (elf_x86_64_size_dynamic_sections): Likewise.
118         (elf_x86_64_relocate_section): Likewise.
119         (elf_x86_64_finish_dynamic_symbol): Likewise.
120         (elf_x86_64_finish_dynamic_sections): Likewise.
121         (elf_x86_64_get_synthetic_symtab): Likewise.
122         (elf_x86_64_link_setup_gnu_properties): Likewise.
123         (elf_x86_64_nacl_plt): Likewise.
124         * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and
125         "elf/x86-64.h".
126         (ELF32_DYNAMIC_INTERPRETER): New.
127         (ELF64_DYNAMIC_INTERPRETER): Likewise.
128         (ELFX32_DYNAMIC_INTERPRETER): Likewise.
129         (_bfd_x86_elf_link_hash_table_create): Likewise.
130         (_bfd_x86_elf_link_hash_table_free): Renamed to ...
131         (elf_x86_link_hash_table_free): This.  Make it static.
132         * elfxx-x86.h: Don't include "objalloc.h".
133         (ABI_64_P): New.
134         (elf_x86_lazy_plt_layout): Likewise.
135         (elf_x86_non_lazy_plt_layout): Likewise.
136         (elf_x86_plt_layout): Likewise.
137         (_bfd_x86_elf_link_hash_table_create): Likewise.
138         (bfd_elf64_bfd_link_hash_table_create): Likewise.
139         (bfd_elf32_bfd_link_hash_table_create): Likewise.
140         (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt,
141         srelplt2 and next_tls_desc_index.
142         (_bfd_x86_elf_link_hash_table_free): Removed.
143
144 2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
145
146         * elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
147         branch offset interpretation.
148
149 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
150
151         PR binutils/22032
152         * opncls.c (bfd_close_all_done): Call _close_and_cleanup.
153
154 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
155
156         * elf64-x86-64.c (elf_x86_64_next_tls_desc_index): Removed.
157         (elf_x86_64_srelplt2): Likewise.
158
159 2017-08-30  Alan Modra  <amodra@gmail.com>
160
161         * elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
162         (ppc64_elf_tls_optimize): Set it.
163         (ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
164         insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
165         addis would add zero.
166         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
167         (ppc_elf_tls_optimize): Set it.
168         (ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
169         insn on TPREL16_LO relocs to use r2 when addis would add zero.
170
171 2017-08-30  Alan Modra  <amodra@gmail.com>
172
173         * elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
174         __tls_get_addr call sequences to LE, don't move the addi down
175         to the nop.  Replace the bl with addi and leave the nop alone.
176
177 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
178
179         * elf32-i386.c (elf_i386_pie_finish_undefweak_symbol):
180         Re-indent.
181         * elf64-x86-64.c (elf_x86_64_finish_local_dynamic_symbol):
182         Likewise.
183         (elf_x86_64_pie_finish_undefweak_symbol): Likewise.
184
185 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
186
187         * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo.
188         (BFD64_BACKENDS): Likewise.
189         (BFD32_BACKENDS_CFILES): Add elfxx-x86.c.
190         (BFD64_BACKENDS_CFILES): Likewise.
191         * Makefile.in: Regenerated.
192         * configure.ac (bfd_backends): Add elfxx-x86.lo together with
193         elf32-i386.lo and elf64-x86-64.lo.
194         * configure: Regenerated.
195         * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h",
196         "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
197         "objalloc.h" and "hashtab.h".
198         (ELIMINATE_COPY_RELOCS): Removed.
199         (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
200         (SYMBOL_NO_COPYRELOC): Likewise.
201         (elf_i386_link_hash_entry): Likewise.
202         (GOT_UNKNOWN): Likewise.
203         (GOT_NORMAL): Likewise.
204         (GOT_TLS_GD): Likewise.
205         (elf_i386_hash_entry): Likewise.
206         (elf_i386_obj_tdata): Likewise.
207         (elf_i386_tdata): Likewise.
208         (elf_i386_local_got_tls_type): Likewise.
209         (elf_i386_local_tlsdesc_gotent): Likewise.
210         (elf_i386_hash_table): Likewise.
211         (elf_i386_link_hash_newfunc): Likewise.
212         (elf_i386_local_htab_hash): Likewise.
213         (elf_i386_local_htab_eq): Likewise.
214         (elf_i386_get_local_sym_hash): Likewise.
215         (elf_i386_link_hash_table_free): Likewise.
216         (elf_i386_copy_indirect_symbol): Likewise.
217         (elf_i386_fixup_symbol): Likewise.
218         (elf_i386_readonly_dynrelocs): Likewise.
219         (elf_i386_always_size_sections): Likewise.
220         (elf_i386_set_tls_module_base): Likewise.
221         (elf_i386_dtpoff_base): Likewise.
222         (compare_relocs): Likewise.
223         (elf_i386_hash_symbol): Likewise.
224         (elf_i386_parse_gnu_properties): Likewise.
225         (elf_i386_merge_gnu_properties): Likewise.
226         (elf_i386_link_check_relocs): Likewise.
227         (elf_i386_merge_symbol_attribute): Likewise.
228         (bfd_elf32_bfd_link_check_relocs): Likewise.
229         (elf_backend_copy_indirect_symbol): Likewise.
230         (elf_backend_always_size_sections): Likewise.
231         (elf_backend_omit_section_dynsym): Likewise.
232         (elf_backend_hash_symbol): Likewise.
233         (elf_backend_fixup_symbol): Likewise.
234         (elf_backend_parse_gnu_properties): Likewise.
235         (elf_backend_merge_gnu_properties): Likewise.
236         (elf_backend_merge_symbol_attribute): Likewise.
237         (elf_i386_mkobject): Updated.
238         (elf_i386_link_hash_table_create): Likewise.
239         (elf_i386_check_tls_transition): Likewise.
240         (elf_i386_tls_transition): Likewise.
241         (elf_i386_convert_load_reloc): Likewise.
242         (elf_i386_check_relocs): Likewise.
243         (elf_i386_adjust_dynamic_symbol): Likewise.
244         (elf_i386_allocate_dynrelocs): Likewise.
245         (elf_i386_convert_load): Likewise.
246         (elf_i386_size_dynamic_sections): Likewise.
247         (elf_i386_relocate_section): Likewise.
248         (elf_i386_finish_dynamic_symbol ): Likewise.
249         (elf_i386_finish_dynamic_sections): Likewise.
250         (elf_i386_output_arch_local_syms): Likewise.
251         (elf_i386_get_synthetic_symtab): Likewise.
252         (elf_i386_link_setup_gnu_properties): Likewise.
253         (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead
254         of elf_link_hash_table, as base.
255         (elf_i386_next_tls_desc_index): New.
256         (elf_i386_srelplt2): Likewise.
257         (elf_i386_plt): Likewise.
258         (elf_i386_lazy_plt): Likewise.
259         (elf_i386_non_lazy_plt): Likewise.
260         * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h",
261         "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
262         "objalloc.h" and "hashtab.h".
263         (ELIMINATE_COPY_RELOCS): Removed.
264         (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
265         (SYMBOL_NO_COPYRELOC): Likewise.
266         (elf_x86_64_link_hash_entry): Likewise.
267         (GOT_UNKNOWN): Likewise.
268         (GOT_NORMAL): Likewise.
269         (GOT_TLS_GD): Likewise.
270         (elf_x86_64_hash_entry): Likewise.
271         (elf_x86_64_obj_tdata): Likewise.
272         (elf_x86_64_tdata): Likewise.
273         (elf_x86_64_local_got_tls_type): Likewise.
274         (elf_x86_64_local_tlsdesc_gotent): Likewise.
275         (elf_x86_64_hash_table): Likewise.
276         (elf_x86_64_link_hash_newfunc): Likewise.
277         (elf_x86_64_local_htab_hash): Likewise.
278         (elf_x86_64_local_htab_eq): Likewise.
279         (elf_x86_64_get_local_sym_hash): Likewise.
280         (elf_x86_64_link_hash_table_free): Likewise.
281         (elf_x86_64_copy_indirect_symbol): Likewise.
282         (elf_x86_64_fixup_symbol): Likewise.
283         (elf_x86_64_readonly_dynrelocs): Likewise.
284         (elf_x86_64_always_size_sections): Likewise.
285         (elf_x86_64_set_tls_module_base): Likewise.
286         (elf_x86_64_dtpoff_base): Likewise.
287         (compare_relocs): Likewise.
288         (elf_x86_64_merge_symbol_attribute): Likewise.
289         (elf_x86_64_hash_symbol): Likewise.
290         (elf_x86_64_parse_gnu_properties): Likewise.
291         (elf_x86_64_merge_gnu_properties): Likewise.
292         (elf_x86_64_link_check_relocs): Likewise.
293         (elf_backend_copy_indirect_symbol): Likewise.
294         (elf_backend_always_size_sections): Likewise.
295         (bfd_elf64_bfd_link_check_relocs): Likewise.
296         (elf_backend_merge_symbol_attribute): Likewise.
297         (elf_backend_hash_symbol): Likewise.
298         (elf_backend_omit_section_dynsym): Likewise.
299         (elf_backend_fixup_symbol): Likewise.
300         (elf_backend_parse_gnu_properties): Likewise.
301         (elf_backend_merge_gnu_properties): Likewise.
302         (bfd_elf32_bfd_link_check_relocs): Likewise.
303         (elf_x86_64_mkobject): Updated.
304         (elf_x86_64_link_hash_table_create): Likewise.
305         (elf_x86_64_check_tls_transition): Likewise.
306         (elf_x86_64_tls_transition): Likewise.
307         (elf_x86_64_convert_load_reloc): Likewise.
308         (elf_x86_64_check_relocs): Likewise.
309         (elf_x86_64_adjust_dynamic_symbol): Likewise.
310         (elf_x86_64_allocate_dynrelocs): Likewise.
311         (elf_x86_64_convert_load): Likewise.
312         (elf_x86_64_size_dynamic_sections): Likewise.
313         (elf_x86_64_relocate_section): Likewise.
314         (elf_x86_64_finish_dynamic_symbol ): Likewise.
315         (elf_x86_64_finish_dynamic_sections): Likewise.
316         (elf_x86_64_output_arch_local_syms): Likewise.
317         (elf_x86_64_get_synthetic_symtab): Likewise.
318         (elf_x86_64_link_setup_gnu_properties): Likewise.
319         (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table,
320         instead of elf_link_hash_table, as base.
321         (elf_x86_64_next_tls_desc_index): New.
322         (elf_x86_64_srelplt2): Likewise.
323         (elf_x86_64_plt): Likewise.
324         (elf_x86_64_lazy_plt): Likewise.
325         (elf_x86_64_non_lazy_plt): Likewise.
326         * elfxx-x86.c: New file.
327         * elfxx-x86.h: Likewise.
328
329 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
330
331         * elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad
332         return.
333         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
334
335 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
336
337         * elf32-i386.c (elf_i386_get_synthetic_symtab): Check valid PLT
338         sections before checking dynamic relocations and free invalid
339         PLT section contents.
340         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
341
342 2017-08-28  H.J. Lu  <hongjiu.lu@intel.com>
343
344         * elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): Removed.
345         * elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): Likewise.
346
347 2017-08-28  H.J. Lu  <hongjiu.lu@intel.com>
348
349         PR binutils/22018
350         * elf32-i386.c (elf_i386_get_synthetic_symtab): Check for valid
351         PLT section size.
352         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
353
354 2017-08-27  H.J. Lu  <hongjiu.lu@intel.com>
355
356         * elf32-i386.c (elf_i386_link_hash_newfunc): Initialize
357         def_protected.
358         * elf64-x86-64.c (elf_x86_64_link_hash_newfunc): Likewise.
359
360 2017-08-26  H.J. Lu  <hongjiu.lu@intel.com>
361
362         PR ld/21997
363         * elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id,
364         dyn_lib_class and has_gnu_symbols.  Change bad_symtab to bitfield.
365         Add a has_no_copy_on_protected bitfield.
366         (elf_has_no_copy_on_protected): New.
367         * elf-properties.c (_bfd_elf_parse_gnu_properties): Set
368         elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED.
369         (elf_merge_gnu_property_list): Likewise.
370         (_bfd_elf_link_setup_gnu_properties): Set extern_protected_data
371         to FALSE for elf_has_no_copy_on_protected.
372         * elf32-i386.c (SYMBOL_NO_COPYRELOC): New.
373         (elf_i386_link_hash_entry): Add def_protected.
374         (elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
375         when checking info->nocopyreloc.
376         (elf_i386_link_setup_gnu_properties): Don't set
377         extern_protected_data here.
378         (elf_i386_merge_symbol_attribute): New function.
379         (elf_backend_merge_symbol_attribute): New.
380         * elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New.
381         (elf_x86_64_link_hash_entry): Add def_protected.
382         (elf_x86_64_need_pic): Report protected symbol for def_protected.
383         (elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
384         when checking info->nocopyreloc.
385         (elf_x86_64_relocate_section): Also check for R_X86_64_PC32
386         relocation run-time overflow and unresolvable R_X86_64_32S
387         relocation against protected data symbol defined in shared object
388         with GNU_PROPERTY_NO_COPY_ON_PROTECTED.
389         (elf_x86_64_link_setup_gnu_properties): Don't set
390         extern_protected_data here.
391         (elf_x86_64_merge_symbol_attribute): New function.
392         (elf_backend_merge_symbol_attribute): New.
393
394 2017-08-26  Alan Modra  <amodra@gmail.com>
395
396         * elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
397         (ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
398         (ppc_elf_relocate_section): Comment fix.
399         * elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
400         (ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
401         Support dynamic relocs for TPREL16 when non-pic too.
402         (dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
403         (ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
404         when non-pic too.
405
406 2017-08-25  H.J. Lu  <hongjiu.lu@intel.com>
407
408         * elf32-i386.c (elf_i386_link_hash_entry): Remove redundant
409         "symbol" in comments.
410         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
411
412 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
413
414         PR ld/22001
415         * elf64-x86-64.c (elf_x86_64_relocate_section): Check for
416         R_X86_64_PC32 relocation run-time overflow and unresolvable
417         R_X86_64_32S relocation with -z nocopyreloc.
418
419 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
420
421         * elf32-i386.c (elf_i386_check_relocs): Revert the last change.
422         Undefined symbols may not have a type.
423         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
424
425 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
426
427         * elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
428         bfd_link_info.  Report shared, PIE or PDE object based on
429         bfd_link_info.
430         (elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
431         (elf_x86_64_relocate_section): Likewise.
432
433 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
434
435         * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
436         for function symbols.
437         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
438
439 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
440
441         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
442         extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
443         is set on any input relocatable file.
444         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
445
446 2017-08-23  Alan Modra  <amodra@gmail.com>
447
448         PR 21988
449         * elf64-ppc.c (ensure_undef_dynamic): Rename from
450         ensure_undefweak_dynamic.  Handle undefined too.
451         * elf32-ppc.c (ensure_undef_dynamic): Likewise.
452         * elf32-hppa.c (ensure_undef_dynamic): Likewise.
453         (allocate_dynrelocs): Discard undefined non-default visibility
454         relocs first.  Make undefined syms dynamic.  Tidy goto.
455
456 2017-08-21  Alan Modra  <amodra@gmail.com>
457             H.J. Lu  <hongjiu.lu@intel.com>
458
459         PR ld/21964
460         * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols.
461         * elflink.c (bfd_elf_define_start_stop): Rewrite.
462
463 2017-08-21  Hans-Peter Nilsson  <hp@bitrange.com>
464
465         PR ld/20125
466         * elf64-mmix.c (mmix_elf_relax_section): Correct handling of
467         undefined weak symbols.
468
469 2017-08-18  Nick Clifton  <nickc@redhat.com>
470
471         PR binutils/21962
472         * tekhex.c (getsym): Fix check for source pointer walking off the
473         end of the input buffer.
474
475 2017-08-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>
476
477         PR ld/18808
478         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
479         relocations in debug sections, change abort to _bfd_error_handler.
480
481 2017-08-14  Nick Clifton  <nickc@redhat.com>
482
483         PR 21957
484         * elf.c (setup_group): Check for an empty or very small group
485         section.
486         * po/bfd.pot: Regenerate.
487
488 2017-08-14  Alan Modra  <amodra@gmail.com>
489
490         PR 21441
491         * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add
492         alignment padding here.
493         * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here
494         in a reverse pass over sections.
495
496 2017-08-11  H.J. Lu  <hongjiu.lu@intel.com>
497
498         PR binutils/21943
499         * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
500         for @plt suffixes first.
501         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
502
503 2017-08-08  Nick Clifton  <nickc@redhat.com>
504
505         PR 21916
506         * elf-attrs.c (_bfd_elf_parse_attributes): Complain about very
507         small section lengths.
508         * elf.c (_bfd_elf_setup_sections): Skip empty entries in the group
509         table.
510         (elfcore_grok_freebsd_prstatus): Add checks to make sure that
511         there is enough data present in the note.
512
513 2017-08-08  Alan Modra  <amodra@gmail.com>
514
515         PR 21017
516         * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
517         got.refcount for GOTOFF relocs, just create .got section.
518
519 2017-08-07  H.J. Lu  <hongjiu.lu@intel.com>
520
521         * elflink.c (elf_link_add_object_symbols): Move common symbol
522         check after bed->common_definition.
523
524 2017-08-07  Alan Modra  <amodra@gmail.com>
525
526         PR 21910
527         * elflink.c (bfd_elf_final_link): Don't segfault when sections
528         needed to define various dynamic tags have been discarded.
529
530 2017-08-07  Nick Clifton  <nickc@redhat.com>
531
532         PR 21884
533         * elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj
534         has not been set then use the bfd returned by
535         _bfd_elf_link_setup_gnu_properties.  If that is null then search
536         through all the input bfds selecting the first normal, ELF format
537         one.
538         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
539
540 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
541
542         * elf32-i386.c (elf_i386_link_hash_entry): Change tls_get_addr
543         to 1 bit.
544         (elf_i386_link_hash_newfunc): Initialize tls_get_addr to 0.
545         (elf_i386_check_tls_transition): Check tls_get_addr directly.
546         (elf_i386_convert_load_reloc): Update tls_get_addr check.
547         (elf_i386_link_check_relocs): New function.
548         (bfd_elf32_bfd_link_check_relocs): New.
549         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Change tls_get_addr
550         to 1 bit.
551         (elf_x86_64_link_hash_newfunc): Initialize tls_get_addr to 0.
552         (elf_x86_64_check_tls_transition): Check tls_get_addr directly.
553         (elf_x86_64_convert_load_reloc): Update tls_get_addr check.
554         (elf_x86_64_link_check_relocs): New function.
555         (bfd_elf64_bfd_link_check_relocs): New.
556         (bfd_elf32_bfd_link_check_relocs): Likewise.
557
558 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
559
560         PR ld/21903:
561         * elflink.c (elf_link_add_object_symbols): Treat common symbol
562         as undefined for --no-define-common.
563
564 2017-08-05  Alan Modra  <amodra@gmail.com>
565
566         * elf32-hppa.c (elf32_hppa_set_gp): Don't require an
567         hppa_link_hash_table.
568
569 2017-08-02  Max Filippov  <jcmvbkbc@gmail.com>
570
571         * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
572         entries for sysregs with negative indices.
573
574 2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
575
576         * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
577         isn't the S/390 specific elf data.
578         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
579
580 2017-07-31  Kuan-Lin Chen  <rufus@andestech.com>
581
582         * elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
583         * (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc.
584         [R_RISCV_ADD16]: Likewise.
585         [R_RISCV_ADD32]: Likewise.
586         [R_RISCV_ADD64]: Likewise.
587         [R_RISCV_SUB6]: Likewise.
588         [R_RISCV_SUB8]: Likewise.
589         [R_RISCV_SUB16]: Likewise.
590         [R_RISCV_SUB32]: Likewise.
591         [R_RISCV_SUB64]: Likewise.
592
593 2017-07-31  Alan Modra  <amodra@gmail.com>
594
595         * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
596         without ld.so checks.
597
598 2017-07-29  Alan Modra  <amodra@gmail.com>
599
600         PR 21847
601         * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
602         (ppc64_elf_merge_symbol): Set non_zero_localentry.
603         (is_elfv2_localentry0): Test non_zero_localentry.
604         (ppc64_elf_tls_setup): Default to --no-plt-localentry.
605
606 2017-07-28  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
607
608         * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
609         pointer check for htab->elf.irelplt.
610         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
611
612 2017-07-27  Nick Clifton  <nickc@redhat.com>
613
614         PR 21840
615         * mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab
616         size is -1.
617         * nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion
618         with error return.
619         * section.c (bfd_make_section_with_flags): Fail if the name or bfd
620         are NULL.
621         * vms-alpha.c (bfd_make_section_with_flags): Correct computation
622         of end pointer.
623         (evax_bfd_print_emh): Check for invalid string lengths.
624
625 2017-07-25  Nick Clifton  <nickc@redhat.com>
626
627         * po/fr.po: Updated French translation.
628
629 2017-07-25  Benjamin Green  <bengreen5mx@gmail.com>
630
631         PR 21824
632         * elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
633         16-bit absolute branches into 10-bit pc-relative branches on the
634         MSP430 as well as the MSP430X.
635
636 2017-07-25  Alan Modra  <amodra@gmail.com>
637
638         * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
639         (stub_eh_frame_size): New function.
640         (ppc_size_one_stub): Set group tls_get_addr_opt_bctrl.
641         (group_sections): Init group tls_get_addr_opt_bctrl.
642         (ppc64_elf_size_stubs): Update sizing and initialization of
643         .eh_frame.  Iteration over stubs via group list.
644         (ppc64_elf_build_stubs): Iterate over stubs via group list.
645         (ppc64_elf_finish_dynamic_sections): Update finalization of
646         .eh_frame.
647
648 2017-07-24  Nick Clifton  <nickc@redhat.com>
649
650         PR 21813
651         * mach-o.c (bfd_mach_o_canonicalize_relocs): Pass the base address
652         of the relocs to the canonicalize_one_reloc routine.
653         * mach-o.h (struct bfd_mach_o_backend_data): Update the prototype
654         for the _bfd_mach_o_canonicalize_one_reloc field.
655         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add
656         res_base parameter.  Use to check for corrupt pair relocs.
657         * mach-o-aarch64.c (bfd_mach_o_arm64_canonicalize_one_reloc):
658         Likewise.
659         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc):
660         Likewise.
661         * mach-o-x86-64.c (bfd_mach_o_x86_64_canonicalize_one_reloc):
662         Likewise.
663
664         * vms-alpha.c (_bfd_vms_slurp_eihd): Make sure that there is
665         enough data in the record before attempting to parse it.
666         (_bfd_vms_slurp_eeom): Likewise.
667
668         (_bfd_vms_slurp_egsd): Check for an invalid section index.
669         (image_set_ptr): Likewise.
670         (alpha_vms_slurp_relocs): Likewise.
671
672         (alpha_vms_object_p): Check for a truncated record.
673
674 2017-07-24  Nick Clifton  <nickc@redhat.com>
675
676         PR 21803
677         * reloc.c (_bfd_unrecognized_reloc): New function.  Reports
678         an unrecognized reloc and sets the bfd_error value.
679         * libbfd.h: Regenerate.
680         * elf32-arm.c (elf32_arm_final_link_relocate): Use the new
681         function.
682         * elf32-i386.c (elf_i386_relocate_section): Likewise.
683         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
684         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
685         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
686         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
687
688 2017-07-23  Alan Modra  <amodra@gmail.com>
689
690         * elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
691         restore of LR.
692
693 2017-07-19  Szabolcs Nagy  <szabolcs.nagy@arm.com>
694
695         PR ld/18841
696         * elfnn-aarch64.c (elfNN_aarch64_reloc_type_class): Return
697         reloc_class_ifunc for ifunc symbols.
698
699 2017-07-19  Nick Clifton  <nickc@redhat.com>
700
701         PR 21787
702         * archive.c (bfd_generic_archive_p): If the bfd does not have the
703         correct magic bytes at the start, set the error to wrong format
704         and clear the format selector before returning NULL.
705
706 2017-07-19  Nick Clifton  <nickc@redhat.com>
707
708         PR 21786
709         * coff-rs6000.c (_bfd_strntol): New function.
710         (_bfd_strntoll): New function.
711         (GET_VALUE_IN_FIELD): New macro.
712         (EQ_VALUE_IN_FIELD): new macro.
713         (_bfd_xcoff_slurp_armap): Use new macros.
714         (_bfd_xcoff_archive_p): Likewise.
715         (_bfd_xcoff_read_ar_hdr): Likewise.
716         (_bfd_xcoff_openr_next_archived_file): Likewise.
717         (_bfd_xcoff_stat_arch_elt): Likewise.
718         * coff64-rs6000.c (_bfd_strntol): New function.
719         (_bfd_strntoll): New function.
720         (GET_VALUE_IN_FIELD): New macro.
721         (xcoff64_slurp_armap): Use new macros.
722
723 2017-07-19  Claudiu Zissulescu  <claziss@synopsys.com>
724             John Eric Martin  <John.Martin@emmicro-us.com>
725
726         * bfd-in2.h: Regenerate.
727         * libbfd.h: Regenerate.
728         * elf32-arc.c (JLI): Define.
729         * reloc.c: Add JLI relocations.
730
731 2017-07-18  Nick Clifton  <nickc@redhat.com>
732
733         PR 21775
734         * coff-sh.c: Fix spelling typos.
735         * compress.c: Likewise.
736         * cpu-pdp11.c: Likewise.
737         * ecofflink.c: Likewise.
738         * elf-m10300.c: Likewise.
739         * elf.c: Likewise.
740         * elf32-arm.c: Likewise.
741         * elf32-m68k.c: Likewise.
742         * elf32-nds32.c: Likewise.
743         * elf32-ppc.c: Likewise.
744         * elf32-sh.c: Likewise.
745         * elf32-v850.c: Likewise.
746         * elf64-ppc.c: Likewise.
747         * elf64-x86-64.c: Likewise.
748         * elflink.c: Likewise.
749         * elfnn-aarch64.c: Likewise.
750         * elfxx-mips.c: Likewise.
751         * som.c: Likewise.
752         * sunos.c: Likewise.
753         * vms-alpha.c: Likewise.
754         * xcofflink.c: Likewise.
755
756 2017-07-18  Nick Clifton  <nickc@redhat.com>
757
758         PR binutils/21781
759         * coffcode.h (handle_COMDAT): Replace abort with an error message
760         and return.
761
762 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
763
764         PR ld/21782
765         * elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
766         to shared library.
767
768 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
769
770         * elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
771
772 2017-07-16  Alan Modra  <amodra@gmail.com>
773
774         * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
775         __tls_index GOT entries when using __tls_get_addr_opt stub.
776         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
777
778 2017-07-12  Alan Modra  <amodra@gmail.com>
779
780         * po/es.po: Update from translationproject.org/latest/bfd/.
781         * po/fi.po: Likewise.
782         * po/fr.po: Likewise.
783         * po/id.po: Likewise.
784         * po/ja.po: Likewise.
785         * po/ro.po: Likewise.
786         * po/ru.po: Likewise.
787         * po/sr.po: Likewise.
788         * po/sv.po: Likewise.
789         * po/tr.po: Likewise.
790         * po/uk.po: Likewise.
791         * po/vi.po: Likewise.
792         * po/zh_CN.po: Likewise.
793         * po/hr.po: New file from translationproject.org.
794         * configure.ac (ALL_LINGUAS): Add hr.  Sort.
795         * configure: Regenerate.
796
797 2017-07-12  Nick Clifton  <nickc@redhat.com>
798
799         Fix compile time warnings using gcc 7.1.1.
800         * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
801         plt_name buffer.
802         (elf_xtensa_get_gotplt_section): Increase length of got_name
803         buffer.
804         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
805         default return of FALSE.
806         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
807         default return of FALSE.
808
809 2017-07-12  Alan Modra  <amodra@gmail.com>
810
811         * binary.c (binary_set_section_contents): Don't print filepos in
812         error message.
813         (coff_write_object_contents): Cast size_t for error message.
814         (coff_slurp_line_table): Don't use bfd_vma symndx.
815         (coff_slurp_reloc_table): Remove unneeded cast.
816         * dwarf2.c (read_section): Cast bfd_int64_t to long long for
817         error message.
818         (find_abstract_instance_name): Likewise.
819         * elf32-arm.c (arm_type_of_stub): Correct error arg order.
820         (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
821         (elf32_arm_check_relocs): Make r_symndx an int.
822         * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
823         format string.
824         * elf32-metag.c (elf_metag_relocate_section): Delete extra error
825         message arg.
826         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
827         error message.
828         * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
829         * elf32-s390.c (elf_s390_check_relocs): Likewise.
830         * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
831         * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
832         * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
833         * elf64-s390.c (elf_s390_check_relocs): Likewise.
834         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
835         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
836         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
837         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
838         * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
839         * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
840         and use %lu for error message.
841         * elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
842         * mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
843         error message.
844
845         * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
846         in error message.
847         (elf32_arm_final_link_relocate): Likewise.
848         * coff-arm.c (bfd_arm_process_before_allocation): Likewise.
849         * coffcode.h (styp_to_sec_flags): Likewise.
850         * cofflink.c (_bfd_coff_write_global_sym): Likewise.
851         * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
852         * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
853         * elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
854         (elf32_bfin_merge_private_bfd_data): Likewise.
855         * elf32-cris.c (cris_elf_relocate_section): Likewise.
856         * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
857         * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
858         (i370_elf_relocate_section): Likewise.
859         * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
860         * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
861         * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
862         * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
863         * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
864         * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
865         * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
866         * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
867         (_bfd_mips_elf_merge_private_bfd_data): Likewise.
868         * ieee.c (ieee_write_id, read_id): Likewise.
869         * mach-o.c (bfd_mach_o_write_contents): Likewise.
870         (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
871         (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
872         (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
873         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
874         * stabs.c (_bfd_link_section_stabs): Likewise.
875
876         * coff-arm.c (coff_arm_relocate_section): Use L modifier in error
877         format.
878         * coff-mcore.c (coff_mcore_relocate_section): Likewise.
879         * coff-ppc.c (coff_ppc_relocate_section): Likewise.
880         * coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
881         * coff-sh.c (sh_relax_section): Likewise.
882         (sh_relax_delete_bytes, sh_swap_insns): Likewise.
883         * coff-tic80.c (coff_tic80_relocate_section): Likewise.
884         * coffcode.h (coff_slurp_reloc_table): Likewise.
885         * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
886         (_bfd_coff_read_string_table): Likewise.
887         * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
888         * compress.c (bfd_get_full_section_contents): Likewise.
889         * dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
890         * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
891         * elf.c (bfd_elf_string_from_elf_section): Likewise.
892         * elf32-arc.c (arc_special_overflow_checks): Likewise.
893         * elf32-arm.c (elf32_arm_tls_relax): Likewise.
894         (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
895         (elf32_arm_write_section): Likewise.
896         * elf32-bfin.c (bfin_relocate_section): Likewise.
897         (bfinfdpic_relocate_section): Likewise.
898         * elf32-hppa.c (hppa_build_one_stub): Likewise.
899         (final_link_relocate, elf32_hppa_relocate_section): Likewise.
900         * elf32-i386.c (elf_i386_tls_transition): Likewise.
901         (elf_i386_relocate_section): Likewise.
902         * elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
903         * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
904         * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
905         * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
906         * elf32-metag.c (elf_metag_relocate_section): Likewise.
907         * elf32-nds32.c (unrecognized_reloc_msg): Likewise.
908         (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
909         (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
910         (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
911         (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
912         (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
913         (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
914         (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
915         (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
916         * elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
917         * elf32-rx.c (UNSAFE_FOR_PID): Likewise.
918         * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
919         * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
920         * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
921         * elf32-sh.c (sh_elf_relax_section): Likewise.
922         (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
923         (sh_elf_relocate_section): Likewise.
924         * elf32-sh64.c (shmedia_prepare_reloc): Likewise.
925         * elf32-spu.c (spu_elf_relocate_section): Likewise.
926         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
927         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
928         * elf32-v850.c (v850_elf_relax_section): Likewise.
929         * elf32-vax.c (elf_vax_check_relocs): Likewise.
930         (elf_vax_relocate_section): Likewise.
931         * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
932         (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
933         (compute_text_actions, compute_ebb_proposed_actions): Likewise.
934         (do_fix_for_relocatable_link): Likewise.
935         * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
936         (elf64_alpha_relax_with_lituse): Likewise.
937         * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
938         (elf_hppa_final_link_relocate): Likewise.
939         * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
940         (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
941         (elf64_vms_link_add_object_symbols): Likewise.
942         * elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
943         (mmix_final_link_relocate): Likewise.
944         * elf64-s390.c (invalid_tls_insn): Likewise.
945         (elf_s390_relocate_section): Likewise.
946         * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
947         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
948         (elf_x86_64_relocate_section): Likewise.
949         * elfcode.h (elf_slurp_symbol_table): Likewise.
950         * elfcore.h (elf_core_file_p): Likewise.
951         * elflink.c (elf_link_read_relocs_from_section): Likewise.
952         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
953         (elfNN_aarch64_relocate_section): Likewise.
954         * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
955         (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
956         * elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
957         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
958         (_bfd_mips_elf_relocate_section): Likewise.
959         (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
960         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
961         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
962         * ieee.c (ieee_slurp_external_symbols): Likewise.
963         * ihex.c (ihex_write_object_content): Likewise.
964         * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
965         * merge.c (_bfd_merged_section_offset): Likewise.
966         * mmo.c (mmo_write_loc_chunk): Likewise.
967         (mmo_write_object_contents): Likewise.
968         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
969         * stabs.c (_bfd_link_section_stabs): Likewise.
970         * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
971
972 2017-07-11  Alan Modra  <amodra@gmail.com>
973
974         * elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
975
976 2017-07-11  Alan Modra  <amodra@gmail.com>
977
978         * elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
979         instruction" error using _bfd_error_handler, not einfo.
980
981 2017-07-10  Nick Clifton  <nickc@redhat.com>
982
983         * coffcode.h (coff_slurp_symbol_table): Do not include an entry
984         for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
985
986 2017-07-07  John Baldwin  <jhb@FreeBSD.org>
987
988         * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
989
990 2017-07-07  Alan Modra  <amodra@gmail.com>
991
992         * coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
993
994 2017-07-07  Alan Modra  <amodra@gmail.com>
995
996         * bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
997         as long long.  Move code replacing "ll" with "I64", and simplify.
998
999 2017-07-06  H.J. Lu  <hongjiu.lu@intel.com>
1000
1001         * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
1002         to 1.
1003
1004 2017-07-05  H.J. Lu  <hongjiu.lu@intel.com>
1005
1006         * dwarf2.c (line_info_add_include_dir_stub): Replace time with
1007         xtime.
1008         (line_info_add_file_name): Likewise.
1009         (decode_line_info): Likewise.
1010
1011 2017-07-04  Tristan Gingold  <gingold@adacore.com>
1012
1013         * version.m4: Bump version to 2.29.51
1014         * configure: Regenerate.
1015
1016 2017-07-04  Jiong Wang  <jiong.wang@arm.com>
1017
1018         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
1019         sanity check at the head of this function.
1020
1021 2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
1022
1023         * dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
1024         dwarf_line_str_size.
1025         (struct attr_abbrev): Add field implicit_const.
1026         (dwarf_debug_sections): Add .debug_line_str.
1027         (enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
1028         (dwarf_debug_section_assert): Add static assertion.
1029         (read_indirect_line_string): New.
1030         (read_abbrevs): Support DW_FORM_implicit_const.
1031         (is_str_attr): Support DW_FORM_line_strp.
1032         (read_attribute_value): Support DW_FORM_line_strp and
1033         DW_FORM_implicit_const.
1034         (read_attribute): Support DW_FORM_implicit_const.
1035         (line_info_add_include_dir, line_info_add_include_dir_stub):
1036         (line_info_add_file_name, read_formatted_entries): New.
1037         (decode_line_info, parse_comp_unit): Support DWARF 5.
1038         (_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.
1039
1040 2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
1041
1042         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
1043         abort statement that was put for symbols that are not dynamic.
1044
1045 2017-07-03  Tristan Gingold  <gingold@adacore.com>
1046
1047         * po/bfd.pot: Regenerate
1048
1049 2017-07-03  Alan Modra  <amodra@gmail.com>
1050
1051         * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
1052         __MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
1053         * elf.c (setup_group): Use "Lx" to print sh_size.
1054         (_bfd_elf_setup_sections): Remove unnecessary cast and print
1055         unknown section type in hex.
1056         (copy_special_section_fields): Style fix.
1057         (bfd_section_from_shdr): Correct format for sh_link.  Use a
1058         common error message for all the variants of unrecognized
1059         section types.
1060         (assign_file_positions_for_load_sections): Use "Lx" for lma
1061         adjust error message.
1062         (assign_file_positions_for_non_load_sections): Formatting.
1063         (rewrite_elf_program_header): Formatting.  Use "Lx" for
1064         bfd_vma values in error messages.
1065         * elfcode.h (elf_slurp_reloc_table_from_section): Cast
1066         ELF_R_SYM value to type expected by format.
1067         * elflink.c (elf_link_read_relocs_from_section): Use "Lx"
1068         in error messages.
1069         (elf_link_add_object_symbols): Use "Lu" for symbol sizes.
1070         (elf_link_input_bfd): Use "Lx" for r_info.
1071         (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
1072
1073 2017-07-03  Alan Modra  <amodra@gmail.com>
1074
1075         * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
1076         * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
1077         Microsoft C library variant of long long format specifier.
1078         (PRINT20): Cast value to bfd_uint64_t not long long.
1079         * coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
1080         * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
1081         long long.  Don't cast to bfd_vma.
1082         * elf32-score.c (score3_bfd_getl48): Likewise.
1083         * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.
1084
1085 2017-07-03  Alan Modra  <amodra@gmail.com>
1086
1087         * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
1088         print d_tag.
1089         (bfd_elf_print_symbol): Don't cast symbol->flags.
1090         (_bfd_elf_symbol_from_bfd_symbol): Likewise.
1091         * elf32-ppc.c (ppc_elf_begin_write_processing): Correct
1092         _bfd_error_handler argument order.
1093         (ppc_elf_merge_private_bfd_data): Don't cast flags.
1094
1095 2017-07-03  Alan Modra  <amodra@gmail.com>
1096
1097         * configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
1098         AC_TYPE_LONG_DOUBLE.
1099         * configure: Regenerate.
1100         * config.in: Regenerate.
1101
1102 2017-06-29  Andrew Waterman  <andrew@sifive.com>
1103
1104         * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
1105         relocs.
1106
1107 2017-06-29  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
1108
1109         * elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
1110         unless it is undefined weak.
1111         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
1112         relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
1113         relocation.
1114         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
1115         is not dynamic in PIC, abort.
1116
1117 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
1118
1119         PR ld/21402
1120         * elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
1121         undefined weak symbols into dynamic.
1122         (elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
1123         relocation for non-dynamic symbols.
1124         (elfNN_aarch64_finish_dynamic_symbol): Add sanity check.
1125
1126 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
1127
1128         * elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
1129         (elfNN_aarch64_final_link_relocate): Delete duplicated code for
1130         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
1131         BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
1132         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
1133         support for them.
1134
1135 2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
1136
1137         * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
1138         (elfcore_write_s390_gs_bc): Likewise.
1139         * elf.c (elfcore_grok_s390_gs_cb): New function.
1140         (elfcore_grok_s390_gs_bc): New function.
1141         (elfcore_grok_note): Call them.
1142         (elfcore_write_s390_gs_cb): New function.
1143         (elfcore_write_s390_gs_bc): New function.
1144         (elfcore_write_register_note): Call them.
1145
1146 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
1147
1148         * libbfd.c (_bfd_generic_get_section_contents): Don't call
1149         bfd_get_file_size.  Check archive element size.
1150         (_bfd_generic_get_section_contents_in_window): Likewise.
1151
1152 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
1153
1154         * bfd-in2.h: Regenerated.
1155         * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
1156         (bfd_get_file_size): Likewise.
1157
1158 2017-06-28  Maciej W. Rozycki  <macro@imgtec.com>
1159             Matthew Fortune  <matthew.fortune@imgtec.com>
1160
1161         * archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
1162         * cpu-mips.c (I_interaptiv_mr2): New enum value.
1163         (arch_info_struct): Add "mips:interaptiv-mr2" entry.
1164         * elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
1165         case.
1166         (mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
1167         (bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
1168         (print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
1169         (mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
1170         `bfd_mach_mips_interaptiv_mr2' entries.
1171         * bfd-in2.h: Regenerate.
1172
1173 2017-06-27  Nick Clifton  <nickc@redhat.com>
1174
1175         * tekhex.c (pass_over): Revert accidental conversion of a local
1176         array to a static array.
1177
1178 2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
1179
1180         PR ld/13402
1181         * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
1182         reloc addend if necessary. Adjust diff only if
1183         shrinked_insn_address < end_address.
1184
1185 2017-06-27  Alan Modra  <amodra@gmail.com>
1186
1187         PR binutils/21665
1188         * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
1189         (_bfd_generic_get_section_contents_in_window): Likewise.
1190
1191 2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>
1192
1193         * elfnn-riscv.c (perform_relocation): Support the new
1194         R_RISCV_32_PCREL relocation.
1195         (riscv_elf_relocate_section): Likewise.
1196         * elfxx-riscv.c (howto_table): Likewise.
1197         (riscv_reloc_map): Likewise.
1198         * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
1199         * libbfd.h: Regenerate.
1200
1201 2017-06-27  Alan Modra  <amodra@gmail.com>
1202
1203         PR binutils/21665
1204         * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
1205         Use unsigned file pointer type, and remove cast.
1206         * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
1207         Add "count", not "sz".
1208
1209 2017-06-26  Pedro Alves  <palves@redhat.com>
1210
1211         PR binutils/21665
1212         * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
1213         "sz".
1214
1215 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
1216
1217         PR binutils/21665
1218         * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
1219         a missing line.
1220
1221 2017-06-26  Maciej W. Rozycki  <macro@imgtec.com>
1222
1223         * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
1224         * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
1225         E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
1226         (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
1227         `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
1228
1229 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
1230
1231         PR binutils/21665
1232         * compress.c (bfd_get_full_section_contents): Don't check the
1233         file size here.
1234         * libbfd.c (_bfd_generic_get_section_contents): Check for and
1235         reject a section whose size + offset is greater than the size
1236         of the entire file.
1237         (_bfd_generic_get_section_contents_in_window): Likewise.
1238
1239 2017-06-26  Nick Clifton  <nickc@redhat.com>
1240
1241         PR binutils/21670
1242         * tekhex.c (getvalue): Check for the source pointer exceeding the
1243         end pointer before the first byte is read.
1244
1245 2017-06-26  Nick Clifton  <nickc@redhat.com>
1246
1247         PR binutils/21665
1248         * opncls.c (get_build_id): Check that the section is big enough
1249         to contain the whole note.
1250         * compress.c (bfd_get_full_section_contents): Check for and reject
1251         a section whose size is greater than the size of the entire file.
1252         * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
1253         contain a notes section.
1254
1255 2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1256
1257         * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
1258         pointer checks.
1259         (elf_s390_modify_segment_map): Likewise.
1260         (bfd_elf_s390_set_options): Lisewise.
1261
1262 2017-06-26  Alan Modra  <amodra@gmail.com>
1263
1264         * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
1265         a --just-syms bfd.
1266         (_bfd_elf_size_group_sections): Skip --just-syms bfds.
1267         (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
1268         .preinit_array on --just-syms bfds.
1269         (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
1270         (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
1271         (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
1272
1273 2017-06-25  Sergei Trofimovich  <slyfox@gentoo.org>
1274
1275         * elf.c (find_link): Bounds check "hint".
1276
1277 2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1278
1279         * elf32-arm.c (using_thumb_only): Update list of architectures in
1280         BFD_ASSERT for which the logic is valid.
1281         (using_thumb2_bl): Likewise.
1282         (using_thumb2): Likewise and return true for ARMv8-R.
1283         (arch_has_arm_nop): Likewise.
1284         (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
1285         merging logic.  Update commentis for value 15 of v8m_baseline,
1286         v8m_mainline and v4t_plus_v6_m arrays.  Use v8r array to decide
1287         merging of value 15 of Tag_CPU_arch.
1288
1289 2017-06-23  Jiong Wang  <jiong.wang@arm.com>
1290
1291         * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
1292         BFD_RELOC_AARCH64_ADR_GOT_PAGE
1293         * bfd-in2.h: Regenerate.
1294
1295 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1296
1297         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
1298         the error_alignment label forward.  Properly align program
1299         property note section.
1300
1301 2017-06-22  Eric Christopher  <echristo@gmail.com>
1302
1303         * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
1304         abs to fix a truncation warning.
1305
1306 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1307
1308         * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
1309         local undefined weak symbol to 0.
1310         * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
1311
1312 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1313
1314         * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
1315         is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
1316         (elf_i386_link_setup_gnu_properties): If info->shstk is set,
1317         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
1318         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
1319         info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
1320         (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
1321         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
1322
1323 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1324
1325         * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
1326         (elf_i386_lazy_ibt_plt_entry): Likewise.
1327         (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
1328         (elf_i386_non_lazy_ibt_plt_entry): Likewise.
1329         (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
1330         (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
1331         (elf_i386_lazy_plt_layout): Likewise.
1332         (elf_i386_non_lazy_plt_layout): Likewise.
1333         (elf_i386_link_hash_entry): Add plt_second.
1334         (elf_i386_link_hash_table): Add plt_second and
1335         plt_second_eh_frame.
1336         (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
1337         (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
1338         the second PLT.  Check the second PLT.
1339         (elf_i386_relocate_section): Use the second PLT to resolve
1340         PLT reference if needed.
1341         (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
1342         needed.
1343         (elf_i386_finish_dynamic_sections): Set sh_entsize on the
1344         second PLT.  Generate unwind info for the second PLT.
1345         (elf_i386_plt_type): Add plt_second.
1346         (elf_i386_get_synthetic_symtab): Support the second PLT.
1347         (elf_i386_parse_gnu_properties): Support
1348         GNU_PROPERTY_X86_FEATURE_1_AND.
1349         (elf_i386_merge_gnu_properties): Support
1350         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
1351         on GNU_PROPERTY_X86_FEATURE_1_IBT
1352         (elf_i386_link_setup_gnu_properties): If info->ibt is set,
1353         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
1354         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
1355         is set on all relocatable inputs.
1356         * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
1357         (elf_x32_lazy_ibt_plt_entry): Likewise.
1358         (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
1359         (elf_x32_non_lazy_ibt_plt_entry): Likewise.
1360         (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
1361         (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
1362         (elf_x86_64_lazy_ibt_plt): Likewise.
1363         (elf_x32_lazy_ibt_plt): Likewise.
1364         (elf_x86_64_non_lazy_ibt_plt): Likewise.
1365         (elf_x32_non_lazy_ibt_plt): Likewise.
1366         (elf_x86_64_get_synthetic_symtab): Support the second PLT.
1367         (elf_x86_64_parse_gnu_properties): Support
1368         GNU_PROPERTY_X86_FEATURE_1_AND.
1369         (elf_x86_64_merge_gnu_properties): Support
1370         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
1371         on GNU_PROPERTY_X86_FEATURE_1_IBT
1372         (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
1373         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
1374         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
1375         is set on all relocatable inputs.
1376
1377 2017-06-22  Nick Clifton  <nickc@redhat.com>
1378
1379         PR binutils/21649
1380         * som.c (setup_sections): NUL terminate the space_strings buffer.
1381         Check that the space.name field does not index beyond the end of
1382         the space_strings buffer.
1383
1384 2017-06-21  Nick Clifton  <nickc@redhat.com>
1385
1386         PR binutils/21646
1387         * coff-sh.c (sh_reloc): Check for an out of range reloc.
1388
1389 2017-06-21  Nick Clifton  <nickc@redhat.com>
1390
1391         PR binutils/21639
1392         * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
1393         type of the size parameter.
1394         (_bfd_vms_save_counted_string): Add second parameter - the maximum
1395         length of the counted string.
1396         * vms.h (_bfd_vms_save_sized_string): Update prototype.
1397         (_bfd_vms_save_counted_string): Likewise.
1398         * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
1399         _bfd_vms_save_counted_string.
1400         (_bfd_vms_slurp_ehdr): Likewise.
1401         (_bfd_vms_slurp_egsd): Likewise.
1402         (Parse_module): Likewise.
1403
1404 2017-06-21  Alan Modra  <amodra@gmail.com>
1405
1406         * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
1407         calls before tocsave calls.
1408         (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
1409         following nop.
1410
1411 2017-06-21  Nick Clifton  <nickc@redhat.com>
1412
1413         PR binutils/21645
1414         * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
1415         bfd_get_full_section_contents returns no contents.
1416
1417 2017-06-21  Nick Clifton  <nickc@redhat.com>
1418
1419         PR binutils/21638
1420         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
1421         record.
1422
1423 2017-06-21  Nick Clifton  <nickc@redhat.com>
1424
1425         PR binutils/21637
1426         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
1427         list.
1428         (image_set_ptr): Likewise.
1429         (alpha_vms_fix_sec_rel): Likewise.
1430         (alpha_vms_slurp_relocs): Likewise.
1431
1432 2017-06-21  Nick Clifton  <nickc@redhat.com>
1433
1434         PR binutils/21633
1435         * ieee.c (ieee_slurp_sections): Check for a NULL return from
1436         read_id.
1437         (ieee_archive_p): Likewise.
1438         (ieee_object_p): Likewise.
1439
1440 2017-06-21  Nick Clifton  <nickc@redhat.com>
1441
1442         PR binutils/21640
1443         * elf.c (setup_group): Zero the group section pointer list after
1444         allocation so that loops can be caught.  Check for NULL pointers
1445         when processing a group list.
1446
1447 2017-06-20  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1448
1449         * elf-s390.h: New file.
1450         * elf64-s390.c (struct elf_s390_link_hash_table): Add params
1451         field.
1452         (elf_s390_additional_program_headers): New function.
1453         (elf_s390_modify_segment_map): New function.
1454         (bfd_elf_s390_set_options): New function.
1455         (elf_backend_additional_program_headers)
1456         (elf_backend_modify_segment_map): Add macro definitions.
1457
1458 2017-06-19  H.J. Lu  <hongjiu.lu@intel.com>
1459
1460         PR ld/21626
1461         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
1462         the DYNAMIC bit instead of bfd_count_sections.
1463
1464 2017-06-19  Nick Clifton  <nickc@redhat.com>
1465
1466         PR binutils/21618
1467         * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
1468         length.
1469         (evax_bfd_print_eeom): Likewise.
1470         (evax_bfd_print_egsd): Check for an overlarge record length.
1471         (evax_bfd_print_etir): Likewise.
1472
1473 2017-06-19  Nick Clifton  <nickc@redhat.com>
1474
1475         PR binutils/21612
1476         * libieee.h (struct common_header_type): Add end_p field.
1477         * ieee.c (this_byte_and_next): Do not advance input_p beyond
1478         end_p.
1479         (read_id): Check for a length that exceeds the remaining bytes in
1480         the input buffer.
1481         (ieee_seek): Initialise end_p.
1482         (ieee_archive_p): Likewise.
1483         (ieee_object_p): Likewise.
1484
1485 2017-06-19  Nick Clifton  <nickc@redhat.com>
1486
1487         PR binutils/21611
1488         * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
1489         before reading the EIHS structure entries.
1490
1491 2017-06-19  Nick Clifton  <nickc@redhat.com>
1492
1493         PR binutils/21615
1494         * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
1495         gsd_size.  Check that there are enough bytes remaining to read the
1496         type and size of the next egsd.  Check that the size of the egsd
1497         does not exceed the size of the record.
1498
1499 2017-06-19  Alan Modra  <amodra@gmail.com>
1500
1501         * config.bfd: Correct targ_underscore for cris.
1502
1503 2017-06-18  Alan Modra  <amodra@gmail.com>
1504
1505         * config.bfd: Correct targ_underscore for epiphany, ip2k,
1506         m32c, mn10200, pru, rl78, rx, crisv32 and v850.
1507
1508 2017-06-16  Nick Clifton  <nickc@redhat.com>
1509
1510         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
1511         bucketlist is empty because there are no symbols to add to the
1512         list.
1513
1514 2017-06-16  Alan Modra  <amodra@gmail.com>
1515
1516         PR ld/20022
1517         PR ld/21557
1518         PR ld/21562
1519         PR ld/21571
1520         * targets.c (struct bfd_target): Add _bfd_define_start_stop.
1521         (BFD_JUMP_TABLE_LINK): Likewise.
1522         * elf-bfd.h (bfd_elf_define_start_stop): Declare.
1523         * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
1524         (bfd_elf_define_start_stop): New function.
1525         * linker.c (bfd_generic_define_start_stop): New function.
1526         * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
1527         new field.
1528         * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
1529         * aout-target.h (MY_bfd_define_start_stop): Define.
1530         * aout-tic30.c (MY_bfd_define_start_stop): Define.
1531         * binary.c (binary_bfd_define_start_stop): Define.
1532         * bout.c (b_out_bfd_define_start_stop): Define.
1533         * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
1534         * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
1535         * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
1536         * coffcode.h (coff_bfd_define_start_stop): Define.
1537         * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
1538         * i386msdos.c (msdos_bfd_define_start_stop): Define.
1539         * i386os9k.c (os9k_bfd_define_start_stop): Define.
1540         * ieee.c (ieee_bfd_define_start_stop): Define.
1541         * ihex.c (ihex_bfd_define_start_stop): Define.
1542         * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
1543         * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
1544         * mmo.c (mmo_bfd_define_start_stop): Define.
1545         * nlm-target.h (nlm_bfd_define_start_stop): Define.
1546         * oasys.c (oasys_bfd_define_start_stop): Define.
1547         * pef.c (bfd_pef_bfd_define_start_stop): Define.
1548         * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
1549         * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
1550         * som.c (som_bfd_define_start_stop): Define.
1551         * srec.c (srec_bfd_define_start_stop): Define.
1552         * tekhex.c (tekhex_bfd_define_start_stop): Define.
1553         * versados.c (versados_bfd_define_start_stop): Define.
1554         * vms-alpha.c (vms_bfd_define_start_stop): Define.
1555         (alpha_vms_bfd_define_start_stop): Define.
1556         * xsym.c (bfd_sym_bfd_define_start_stop): Define.
1557         * bfd-in2.h: Regenerate.
1558         * libbfd.h: Regenerate.
1559
1560 2017-06-16  Jiong Wang  <jiong.wang@arm.com>
1561
1562         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
1563         SYMBOL_REFERENCES_LOCAL.
1564
1565 2017-06-15  Jiong Wang  <jiong.wang@arm.com>
1566
1567         PR ld/21532
1568         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
1569         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
1570         runtime for if there needs copy relocation elimination.
1571         (need_copy_relocation_p): New function.  Return true for symbol with
1572         pc-relative references and if it's against read-only sections.
1573         (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
1574         (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
1575         that are related with accessing external objects.
1576         (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
1577         in elfNN_aarch64_check_relocs.
1578
1579 2017-06-15  Nick Clifton  <nickc@redhat.com>
1580
1581         PR binutils/21582
1582         * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
1583         bugs.
1584         PR binutils/21581
1585         (ieee_archive_p): Likewise.
1586
1587 2017-06-15  Nick Clifton  <nickc@redhat.com>
1588
1589         PR binutils/21579
1590         * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
1591
1592 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
1593
1594         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
1595         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
1596         keep both windowed and call0 ABI PLT definitions.
1597         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
1598         elf_xtensa_*_plt_entry endex.
1599         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
1600
1601 2017-06-14  Nick Clifton  <nickc@redhat.com>
1602
1603         PR binutils/21578
1604         * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
1605         flag value.
1606
1607 2017-06-14  Nick Clifton  <nickc@redhat.com>
1608
1609         PR binutils/21589
1610         * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
1611         maximum value for the ascic pointer.  Check that name processing
1612         does not read beyond this value.
1613         (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
1614         end of etir record.
1615
1616 2017-06-14  Nick Clifton  <nickc@redhat.com>
1617
1618         PR binutils/21591
1619         * versados.c (versados_mkobject): Zero the allocated tdata structure.
1620         (process_otr): Check for an invalid offset in the otr structure.
1621
1622 2017-06-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
1623
1624         * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
1625
1626 2017-06-13  H.J. Lu  <hongjiu.lu@intel.com>
1627
1628         PR ld/20022
1629         PR ld/21557
1630         PR ld/21562
1631         PR ld/21571
1632         * elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
1633         vtable field to a union.
1634         (_bfd_elf_is_start_stop): Removed.
1635         * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
1636         __start_SECNAME and __stop_SECNAME symbols.
1637         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
1638         * elflink.c (_bfd_elf_is_start_stop): Removed.
1639         (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
1640         _bfd_elf_is_start_stop.
1641         (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
1642         __stop_SECNAME symbols.  Updated.
1643         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1644         (bfd_elf_gc_record_vtinherit): Likewise.
1645         (bfd_elf_gc_record_vtentry): Likewise.
1646
1647 2017-06-13  Nick Clifton  <nickc@redhat.com>
1648
1649         PR ld/21524
1650         * elflink.c (elf_link_adjust_relocs): Generate an error when
1651         encountering a reloc against a symbol removed by garbage
1652         collection.
1653
1654 2017-06-12  H.J. Lu  <hongjiu.lu@intel.com>
1655
1656         * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
1657         to merge_gnu_properties.
1658         * elf-properties.c (elf_merge_gnu_properties): Add struct
1659         bfd_link_info * and pass it to merge_gnu_properties.
1660         (elf_merge_gnu_property_list): Add struct bfd_link_info *
1661         and pass it to elf_merge_gnu_properties.
1662         (_bfd_elf_link_setup_gnu_properties): Pass info to
1663         elf_merge_gnu_property_list.
1664         * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
1665         bfd_link_info *.
1666         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
1667
1668 2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
1669
1670         PR 21564
1671         * binary.c (binary_set_section_contents): Scale lma by octets
1672         per byte to set filepos.
1673
1674 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1675
1676         * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
1677         dynamic sections.
1678
1679 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1680
1681         * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
1682         require TEXTREL.
1683
1684 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1685
1686         * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
1687         patched section contents for TLS IE reloc.
1688         * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
1689
1690 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1691
1692         * elf32-arc.c (elf_arc_relocate_section): Added "call" to
1693         RELOC_FOR_GLOBAL_SYMBOL macro.
1694
1695 2018-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1696
1697         * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
1698         changes.
1699
1700 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1701
1702         * config/tc-arc.c (md_undefined_symbol): Changed.
1703         * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
1704
1705 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1706
1707         * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
1708         symbols.
1709
1710 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1711
1712         * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
1713         warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
1714
1715 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1716
1717         * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
1718         object is created.
1719
1720 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
1721
1722         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
1723         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
1724         is non-zero.  Add clarifying comments.
1725
1726 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
1727
1728         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
1729         name.  Use local IFUNC symbol name string to report unsupported
1730         non-PIC call to IFUNC function.
1731         (elf_i386_relocate_section): Dump local IFUNC name with minfo
1732         when generating R_386_IRELATIVE relocation.
1733         (elf_i386_finish_dynamic_symbol): Likewise.
1734         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
1735         IFUNC symbol name.
1736         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
1737         when generating R_X86_64_IRELATIVE relocation.
1738         (elf_x86_64_finish_dynamic_symbol): Likewise.
1739
1740 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1741
1742         * elf.c (setup_group): Make sure BFD sections are created for all
1743         group sections in the input file when processing SHF_GROUP
1744         sections.
1745         (bfd_section_from_shdr): Avoid duplicating logic already
1746         implemented in `setup_group'.
1747
1748 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
1749
1750         PR binutils/21546
1751         * peXXigen.c (pe_print_idata): Use the address of the first thunk
1752         if the hint address is zero.
1753
1754 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
1755
1756         PR ld/19579
1757         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
1758         ELF_COMMON_DEF_P for common symbols.
1759
1760 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
1761
1762         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
1763         SEC_GROUP sections as SEC_EXCLUDE.
1764         (bfd_elf_set_group_contents): Replace use of abort with an assert.
1765         (assign_section_numbers): Use resolve_section_groups flag instead
1766         of relocatable link type.
1767         (_bfd_elf_init_private_section_data): Use resolve_section_groups
1768         flag instead of checking the final_link flag for part of the
1769         checks in here.  Fix white space as a result.
1770         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
1771         instead of relocatable link type.
1772         (bfd_elf_final_link): Likewise.
1773
1774 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1775
1776         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
1777         variable `bed'.
1778         * elf32-score.c (score_elf_final_link_relocate): Likewise.
1779         (s3_bfd_score_elf_check_relocs): Likewise.
1780         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1781         (score_elf_final_link_relocate): Likewise.
1782         (s7_bfd_score_elf_check_relocs): Likewise.
1783
1784 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1785
1786         * elflink.c (init_reloc_cookie_rels): Remove unused variable
1787         `bed'.
1788
1789 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
1790
1791         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
1792         from `reloc_count' rather than decrementing it.
1793         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
1794         `reloc_count' by `int_rels_per_ext_rel'.
1795         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
1796         `reloc_count' by `int_rels_per_ext_rel' for last relocation
1797         entry determination.
1798         (s3_bfd_score_elf_check_relocs): Likewise.
1799         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
1800         (s7_bfd_score_elf_relocate_section): Likewise.
1801         (s7_bfd_score_elf_check_relocs): Likewise.
1802         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
1803         prototype and function.
1804         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
1805         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
1806         triple rather than once the sum of REL and RELA relocation entry
1807         counts.
1808         (bfd_elf64_get_reloc_upper_bound): Remove macro.
1809         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
1810         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
1811         storage allocation size determination.
1812         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
1813         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
1814         by `int_rels_per_ext_rel' for last relocation entry
1815         determination.
1816         (bfd_elf_final_link): Do not multiply `reloc_count' by
1817         `int_rels_per_ext_rel' for internal relocation storage
1818         allocation size determination.
1819         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
1820         `int_rels_per_ext_rel' for last relocation entry determination.
1821         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1822         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
1823         (_bfd_mips_elf_relocate_section): Likewise.
1824
1825 2017-06-05  Alan Modra  <amodra@gmail.com>
1826
1827         PR 21529
1828         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
1829
1830 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
1831
1832         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
1833         determine structure sizes.
1834         (elfcore_grok_freebsd_prstatus): Likewise.
1835
1836 2017-06-01  Alan Modra  <amodra@gmail.com>
1837
1838         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
1839         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
1840         dynamic objects.
1841         (is_elfv2_localentry0): New function.
1842         (ppc64_elf_tls_setup): Default params->plt_localentry0.
1843         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
1844         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
1845         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
1846         optimized localentry:0 stubs.
1847         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
1848         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
1849         localentry:0 stubs.
1850         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
1851         DT_PPC64_OPT.
1852         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
1853
1854 2017-05-30  Casey Smith  <clegg89@gmail.com>
1855
1856         PR ld/21523
1857         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
1858         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
1859
1860 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
1861
1862         * cpu-arc.c (arc_compatible): New function.
1863
1864 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
1865
1866         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
1867
1868 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
1869
1870         PR binutils/21519
1871         * bfdio.c (bfd_get_file_size): New function.
1872         * bfd-in2.h: Regenerated.
1873
1874 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
1875
1876         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
1877         comments.
1878
1879 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
1880
1881         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
1882         dynobj instead of htab->elf.dynobj.
1883
1884 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
1885
1886         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
1887         and function.
1888         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
1889         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
1890         actual number of internal relocations retrieved.  Adjust
1891         function description.
1892         (bfd_elf64_canonicalize_reloc): Remove macro.
1893         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
1894
1895 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
1896
1897         * archures.c (bfd_mach_sparc_v9m8): Define.
1898         (bfd_mach_sparc_v8plusm8): Likewise.
1899         (bfd_mach_sparc_v9_p): Adjust to M8.
1900         (bfd_mach_sparc_64bit_p): Likewise.
1901         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
1902         bfd_mach_sparc_v8plusm8.
1903         * bfd-in2.h: Regenerated.
1904         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
1905         sparc:v8plusm8.
1906         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
1907         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
1908         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
1909         SHA3.
1910         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
1911         bfd_mach_sparc_v8plusm8.
1912
1913 2017-05-19  Alan Modra  <amodra@gmail.com>
1914
1915         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
1916         debug and special sections when no non-note alloc sections in an
1917         object are kept.
1918
1919 2017-05-18  Alan Modra  <amodra@gmail.com>
1920
1921         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
1922         * elf-m10300.c: Likewise.
1923         * elf.c: Likewise.
1924         * elf32-arc.c: Likewise.
1925         * elf32-bfin.c: Likewise.
1926         * elf32-m68k.c: Likewise.
1927         * elf32-nds32.c: Likewise.
1928         * elf32-tilepro.c: Likewise.
1929         * elflink.c: Likewise.
1930         * elfnn-aarch64.c: Likewise.
1931         * elfnn-riscv.c: Likewise.
1932         * elfxx-tilegx.c: Likewise.
1933         * mach-o.c: Likewise.
1934         * peXXigen.c: Likewise.
1935         * vms-alpha.c: Likewise.
1936         * vms-lib.c: Likewise.
1937
1938 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
1939
1940         PR ld/20882
1941         * elflink.c (elf_gc_mark_debug_section): New function.
1942         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
1943         referenced by kept debug sections.
1944
1945 2017-05-16  Alan Modra  <amodra@gmail.com>
1946
1947         * elf-m10300.c: Rename occurrences of non_ir_ref.
1948         * elf32-arm.c: Likewise.
1949         * elf32-bfin.c: Likewise.
1950         * elf32-cr16.c: Likewise.
1951         * elf32-cris.c: Likewise.
1952         * elf32-d10v.c: Likewise.
1953         * elf32-dlx.c: Likewise.
1954         * elf32-fr30.c: Likewise.
1955         * elf32-frv.c: Likewise.
1956         * elf32-hppa.c: Likewise.
1957         * elf32-i370.c: Likewise.
1958         * elf32-i386.c: Likewise.
1959         * elf32-iq2000.c: Likewise.
1960         * elf32-lm32.c: Likewise.
1961         * elf32-m32c.c: Likewise.
1962         * elf32-m32r.c: Likewise.
1963         * elf32-m68hc1x.c: Likewise.
1964         * elf32-m68k.c: Likewise.
1965         * elf32-mcore.c: Likewise.
1966         * elf32-metag.c: Likewise.
1967         * elf32-microblaze.c: Likewise.
1968         * elf32-moxie.c: Likewise.
1969         * elf32-msp430.c: Likewise.
1970         * elf32-mt.c: Likewise.
1971         * elf32-nios2.c: Likewise.
1972         * elf32-or1k.c: Likewise.
1973         * elf32-ppc.c: Likewise.
1974         * elf32-rl78.c: Likewise.
1975         * elf32-s390.c: Likewise.
1976         * elf32-score.c: Likewise.
1977         * elf32-score7.c: Likewise.
1978         * elf32-sh.c: Likewise.
1979         * elf32-tic6x.c: Likewise.
1980         * elf32-tilepro.c: Likewise.
1981         * elf32-v850.c: Likewise.
1982         * elf32-vax.c: Likewise.
1983         * elf32-xstormy16.c: Likewise.
1984         * elf32-xtensa.c: Likewise.
1985         * elf64-alpha.c: Likewise.
1986         * elf64-hppa.c: Likewise.
1987         * elf64-ia64-vms.c: Likewise.
1988         * elf64-mmix.c: Likewise.
1989         * elf64-ppc.c: Likewise.
1990         * elf64-s390.c: Likewise.
1991         * elf64-sh64.c: Likewise.
1992         * elf64-x86-64.c: Likewise.
1993         * elflink.c: Likewise.
1994         * elfnn-aarch64.c: Likewise.
1995         * elfnn-ia64.c: Likewise.
1996         * elfnn-riscv.c: Likewise.
1997         * elfxx-mips.c: Likewise.
1998         * elfxx-sparc.c: Likewise.
1999         * elfxx-tilegx.c: Likewise.
2000         * linker.c: Likewise.
2001
2002 2017-05-16  Alan Modra  <amodra@gmail.com>
2003
2004         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
2005         * elflink.c (elf_link_add_object_symbols): Update to use
2006         non_ir_ref_dynamic.
2007         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
2008         non_ir_ref.
2009         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
2010
2011 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
2012
2013         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
2014
2015 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
2016
2017         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
2018         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
2019         properties.
2020         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2021
2022 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
2023
2024         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
2025         to plt_second.
2026         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
2027         to plt_second/plt_second_eh_frame.
2028         (elf_x86_64_link_hash_newfunc): Updated.
2029         (elf_x86_64_allocate_dynrelocs): Likewise.
2030         (elf_x86_64_size_dynamic_sections): Likewise.
2031         (elf_x86_64_relocate_section): Likewise.
2032         (elf_x86_64_finish_dynamic_symbol): Likewise.
2033         (elf_x86_64_finish_dynamic_sections): Likewise.
2034         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
2035         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
2036         .plt.sec section.
2037         (elf_backend_setup_gnu_properties): Updated.  Create the
2038         .plt.sec section instead of the .plt.sec section.
2039
2040 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
2041
2042         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
2043         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
2044         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
2045
2046 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
2047
2048         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
2049         (bfd_elf64_set_reloc): Define.
2050         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
2051
2052 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
2053
2054         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
2055         (struct bfd_target): New field _bfd_set_reloc.
2056         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
2057         * reloc.c (_bfd_generic_set_reloc): New function.
2058         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
2059         * nlm-target.h (nlm_set_reloc): Likewise.
2060         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
2061         * aout-tic30.c (MY_set_reloc): Likewise.
2062         * aout-target.h (MY_set_reloc): Likewise.
2063         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
2064         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
2065         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
2066         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
2067         * aout-adobe.c (aout_32_set_reloc): Likewise.
2068         * bout.c (b_out_set_reloc): Likewise.
2069         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
2070         * i386os9k.c (aout_32_set_reloc): Likewise.
2071         * ieee.c (ieee_set_reloc): Likewise.
2072         * oasys.c (oasys_set_reloc): Likewise.
2073         * som.c (som_set_reloc): Likewise.
2074         * versados.c (versados_set_reloc): Likewise.
2075         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
2076         _bfd_generic_set_reloc.
2077         (rs6000_xcoff64_aix_vec): LIkewise.
2078         * libbfd.c (_bfd_norelocs_set_reloc): New function.
2079         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
2080         * i386msdos.c (msdos_set_reloc): Define to
2081         _bfd_norelocs_set_reloc.
2082         * elfcode.h (elf_set_reloc): Define.
2083         * bfd-in2.h: Regenerated.
2084
2085 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2086
2087         PR ld/21481
2088         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
2089         for IFUNC function address.
2090
2091 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
2092
2093         * elf32-arc.c (FEATURE_LIST_NAME): Define.
2094         (CONFLICT_LIST): Likewise.
2095         (opcode/arc-attrs.h): Include.
2096         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
2097         (arc_extract_features): New file.
2098         (arc_stralloc): Likewise.
2099         (arc_elf_merge_attributes): Likewise.
2100         (arc_elf_merge_private_bfd_data): Use object attributes.
2101         (bfd_arc_get_mach_from_attributes): New function.
2102         (arc_elf_object_p): Use object attributes.
2103         (arc_elf_final_write_processing): Likewise.
2104         (elf32_arc_obj_attrs_arg_type): New function.
2105         (elf32_arc_obj_attrs_handle_unknown): Likewise.
2106         (elf32_arc_section_from_shdr): Likewise.
2107         (elf_backend_obj_attrs_vendor): Define.
2108         (elf_backend_obj_attrs_section): Likewise.
2109         (elf_backend_obj_attrs_arg_type): Likewise.
2110         (elf_backend_obj_attrs_section_type): Likewise.
2111         (elf_backend_obj_attrs_handle_unknown): Likewise.
2112         (elf_backend_section_from_shdr): Likewise.
2113
2114 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
2115
2116         PR ld/21458
2117         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
2118         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
2119         and the destination is a Thumb symbol.
2120
2121 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
2122
2123         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
2124         initializer to silence GCC 4.2.
2125         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
2126
2127 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
2128
2129         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
2130         (LAZY_PLT_ENTRY_SIZE): This.
2131         (NON_LAZY_PLT_ENTRY_SIZE): New.
2132         (elf_x86_64_plt0_entry): Renamed to ...
2133         (elf_x86_64_lazy_plt0_entry): This.
2134         (elf_x86_64_plt_entry): Renamed to ...
2135         (elf_x86_64_lazy_plt_entry): This.
2136         (elf_x86_64_bnd_plt0_entry): Renamed to ...
2137         (elf_x86_64_lazy_bnd_plt0_entry): This.
2138         (elf_x86_64_legacy_plt_entry): Removed.
2139         (elf_x86_64_bnd_plt_entry): Renamed to ...
2140         (elf_x86_64_lazy_bnd_plt_entry): This.
2141         (elf_x86_64_legacy_plt2_entry): Renamed to ...
2142         (elf_x86_64_non_lazy_plt_entry): This.
2143         (elf_x86_64_bnd_plt2_entry): Renamed to ...
2144         (elf_x86_64_non_lazy_bnd_plt_entry): This.
2145         (elf_x86_64_eh_frame_plt): Renamed to ...
2146         (elf_x86_64_eh_frame_lazy_plt): This.
2147         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
2148         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
2149         (elf_x86_64_eh_frame_plt_got): Renamed to ...
2150         (elf_x86_64_eh_frame_non_lazy_plt): This.
2151         (elf_x86_64_lazy_plt_layout): New.
2152         (elf_x86_64_non_lazy_plt_layout): Likewise.
2153         (elf_x86_64_plt_layout): Likewise.
2154         (elf_x86_64_backend_data): Remove PLT layout information.  Add
2155         os for target system.
2156         (GET_PLT_ENTRY_SIZE): Removed.
2157         (elf_x86_64_lazy_plt): New.
2158         (elf_x86_64_non_lazy_plt): Likewise.
2159         (elf_x86_64_lazy_bnd_plt): Likewise.
2160         (elf_x86_64_non_lazy_bnd_plt): Likewise.
2161         (elf_x86-64_arch_bed): Updated.
2162         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
2163         (elf_x86_64_create_dynamic_sections): Removed.
2164         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
2165         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
2166         (elf_x86-64_adjust_dynamic_symbol): Updated.
2167         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
2168         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
2169         size for PLT0 if there is no PLT0.  Get plt_entry_size from
2170         non_lazy_plt for non-lazy PLT entries.
2171         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
2172         from non_lazy_plt for non-lazy PLT entries.
2173         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
2174         if there is no PLT0.
2175         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
2176         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
2177         entries with non-lazy PLT layout.  Don't fill the second and third
2178         slots in the PLT entry if there is no PLT0.
2179         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
2180         if there is no PLT0.  Set sh_entsize on the .plt.got section.
2181         (compare_relocs): New.
2182         (elf_x86_64_plt_type): Likewise.
2183         (elf_x86_64_plt): Likewise.
2184         (elf_x86_64_nacl_plt): New. Forward declaration.
2185         (elf_x86_64_get_plt_sym_val): Removed.
2186         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
2187         against all dynamic relocations.
2188         (elf_x86_64_link_setup_gnu_properties): New function.
2189         (elf_backend_create_dynamic_sections): Updated.
2190         (elf_backend_setup_gnu_properties): New.
2191         (elf_x86_64_nacl_plt): New.
2192         (elf_x86_64_nacl_arch_bed): Updated.
2193
2194 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
2195
2196         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
2197         (LAZY_PLT_ENTRY_SIZE): This.
2198         (NON_LAZY_PLT_ENTRY_SIZE): New.
2199         (elf_i386_plt0_entry): Renamed to ...
2200         (elf_i386_lazy_plt0_entry): This.
2201         (elf_i386_plt_entry): Renamed to ...
2202         (elf_i386_lazy_plt_entry): This.
2203         (elf_i386_pic_plt0_entry): Renamed to ...
2204         (elf_i386_pic_lazy_plt0_entry): This.
2205         (elf_i386_pic_plt_entry): Renamed to ...
2206         (elf_i386_pic_lazy_plt_entry): This.
2207         (elf_i386_got_plt_entry): Renamed to ...
2208         (elf_i386_non_lazy_plt_entry): This.
2209         (elf_i386_pic_got_plt_entry): Renamed to ...
2210         (elf_i386_pic_non_lazy_plt_entry): This.
2211         (elf_i386_eh_frame_plt): Renamed to ...
2212         (elf_i386_eh_frame_lazy_plt): This.
2213         (elf_i386_eh_frame_plt_got): Renamed to ...
2214         (elf_i386_eh_frame_non_lazy_plt): This.
2215         (elf_i386_plt_layout): Renamed to ...
2216         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
2217         eh_frame_plt_got_size.
2218         (elf_i386_non_lazy_plt_layout): New.
2219         (elf_i386_plt_layout): Likewise.
2220         (elf_i386_non_lazy_plt): Likewise.
2221         (GET_PLT_ENTRY_SIZE): Removed.
2222         (elf_i386_plt): Renamed to ...
2223         (elf_i386_lazy_plt): This.
2224         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
2225         (elf_i386_arch_bed): Updated.
2226         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
2227         (elf_i386_create_dynamic_sections): Removed.
2228         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
2229         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
2230         (elf_i386_adjust_dynamic_symbol): Updated.
2231         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
2232         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
2233         size for PLT0 if there is no PLT0.
2234         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
2235         output section is discarded only if GOT isn't empty.
2236         (elf_i386_relocate_section): Updated.  Properly get PLT index
2237         if there is no PLT0.
2238         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
2239         second and third slots in the PLT entry if there is no PLT0.
2240         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
2241         if there is no PLT0.  Set sh_entsize on the .plt.got section.
2242         (elf_i386_nacl_plt): Forward declaration.
2243         (elf_i386_get_plt_sym_val): Removed.
2244         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
2245         against all dynamic relocations.
2246         (elf_i386_link_setup_gnu_properties): New function.
2247         (elf_backend_create_dynamic_sections): Updated.
2248         (elf_backend_setup_gnu_properties): New.
2249         (elf_i386_nacl_plt): Updated.
2250         (elf_i386_nacl_arch_bed): Likewise.
2251         (elf_i386_vxworks_arch_bed): Likewise.
2252
2253 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
2254
2255         * elflink.c (elf_output_implib): Remove executable flag from import
2256         library bfd.
2257         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
2258         library is a relocatable object file.
2259
2260 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
2261
2262         PR ld/21404
2263         * elf32-avr.c (avr_should_move_sym): New function.
2264         (avr_should_reduce_sym_size): Likewise.
2265         (avr_should_increase_sym_size): Likewise.
2266         (elf32_avr_relax_delete_bytes): Adjust symbol values
2267         and sizes by calling new functions.
2268
2269 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
2270
2271         * config.bfd (riscv32-*): Enable rv64.
2272
2273 2017-05-02  Alan Modra  <amodra@gmail.com>
2274
2275         PR 21384
2276         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
2277         rather than h->root.type == bfd_link_hash_new.
2278         (bfd_elf_record_link_assignment): Similarly, call
2279         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
2280
2281 2017-04-29  Alan Modra  <amodra@gmail.com>
2282
2283         PR 21432
2284         * reloc.c (reloc_offset_in_range): New function.
2285         (bfd_perform_relocation, bfd_install_relocation): Use it.
2286         (_bfd_final_link_relocate): Likewise.
2287
2288 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
2289
2290         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
2291         before using .plt.got.
2292         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2293
2294 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2295
2296         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
2297         instead of "+=" to update 0.
2298
2299 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2300
2301         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
2302         .plt.got section here.
2303         (elf_i386_check_relocs): Don't create the .plt.got section.
2304         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
2305         the .plt.got and .plt.bnd sections here.
2306         (elf_x86_64_check_relocs): Don't create the .plt.got nor
2307         .plt.bnd sections.
2308
2309 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2310
2311         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
2312         has_bnd_reloc.
2313         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
2314         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
2315         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
2316         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
2317         has_bnd_reloc.
2318
2319 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2320
2321         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
2322         to return bfd *.
2323         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
2324         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
2325         the first relocatable ELF input with GNU properties.
2326
2327 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2328
2329         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
2330         VxWorks for non-PIC.
2331
2332 2017-04-27  Alan Modra  <amodra@gmail.com>
2333
2334         * elf-bfd.h (struct elf_backend_data): Make asection param of
2335         elf_backend_eh_frame_address_size const.
2336         (_bfd_elf_eh_frame_address_size): Likewise.
2337         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
2338         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
2339         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
2340         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
2341         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
2342         (next_cie_fde_offset): Constify params.
2343         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
2344
2345 2017-04-27  Alan Modra  <amodra@gmail.com>
2346
2347         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
2348         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
2349         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
2350         aug_data_len.
2351         (offset_adjust): New function.
2352         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
2353         (adjust_eh_frame_local_symbols): Likewise.
2354         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
2355         after changing anything.  Return true if anything changed.
2356         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
2357         _bfd_elf_adjust_eh_frame_global_symbol for globals.
2358
2359 2017-04-27  Alan Modra  <amodra@gmail.com>
2360
2361         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
2362         when force_local.
2363
2364 2017-04-27  Alan Modra  <amodra@gmail.com>
2365
2366         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
2367         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
2368         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
2369         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
2370         for undef and undefweak dyn_relocs.
2371         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
2372         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
2373         (allocate_got, allocate_dynrelocs): Likewise.
2374         (ppc64_elf_relocate_section): Likewise.
2375
2376 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
2377
2378         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
2379         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
2380         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
2381         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
2382
2383 2017-04-26  Nick Clifton  <nickc@redhat.com>
2384
2385         PR binutils/21434
2386         * reloc.c (bfd_perform_relocation): Check for a negative address
2387         in the reloc.
2388
2389 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
2390
2391         PR ld/21334
2392         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
2393         member.
2394         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
2395         (elf_backend_always_renumber_dynsyms): Define.
2396         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
2397         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
2398         * elflink.c (bfd_elf_size_dynamic_sections): Also call
2399         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
2400         it.
2401         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
2402
2403 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
2404
2405         * elflink.c (bfd_elf_size_dynamic_sections): Only call
2406         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
2407         sections have been created.
2408
2409 2017-04-26  Nick Clifton  <nickc@redhat.com>
2410
2411         PR binutils/21431
2412         * compress.c (bfd_init_section_compress_status): Check the return
2413         value from bfd_malloc.
2414
2415 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2416
2417         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
2418         no_finish_dynamic_symbol.
2419         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
2420         0.
2421         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
2422         weak symbol, don't make it dynamic.
2423         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
2424         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
2425         relocation for GOT reference.
2426         (elf_x86_64_finish_dynamic_symbol): Abort if
2427         no_finish_dynamic_symbol isn't 0.
2428
2429 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2430
2431         PR ld/21402
2432         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
2433         undefined weak symbol, don't make it dynamic.
2434         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
2435         set no_finish_dynamic_symbol and generate R_386_RELATIVE
2436         relocation for R_386_GOT32.
2437
2438 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2439
2440         PR ld/21425
2441         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
2442
2443 2017-04-23  Alan Modra  <amodra@gmail.com>
2444
2445         PR 21414
2446         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
2447         * elf.c (lcomm_sym): New.
2448         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
2449         * bfd-in2.h: Regenerate.
2450
2451 2017-04-23  Alan Modra  <amodra@gmail.com>
2452
2453         PR 21412
2454         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
2455         parameters and comment.
2456         (_bfd_elf_get_reloc_section): Delete.
2457         (_bfd_elf_plt_get_reloc_section): Declare.
2458         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
2459         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
2460         Extracted from..
2461         (_bfd_elf_get_reloc_section): ..here.  Delete.
2462         (assign_section_numbers): Call elf_get_reloc_section.
2463         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
2464         * elfxx-target.h (elf_backend_get_reloc_section): Update.
2465
2466 2017-04-23  Alan Modra  <amodra@gmail.com>
2467
2468         PR 21409
2469         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
2470         no symbols.
2471
2472 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
2473
2474         PR ld/21402
2475         * elf32-i386.c (elf_i386_link_hash_entry): Add
2476         no_finish_dynamic_symbol.
2477         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
2478         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
2479         symbol, don't make it dynamic in PIE.
2480         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
2481         set no_finish_dynamic_symbol and generate R_386_RELATIVE
2482         relocation for R_386_GOT32
2483         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
2484         isn't 0.
2485
2486 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
2487
2488         PR ld/19617
2489         PR ld/21086
2490         * elflink.c (elf_link_add_object_symbols): Require
2491         --no-dynamic-linker with -E/--dynamic-list when creating
2492         dynamic sections.
2493
2494 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
2495
2496         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
2497         if forced local.
2498
2499 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
2500
2501         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
2502         dynamic symbol sorting.
2503
2504 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
2505
2506         PR ld/21382
2507         * elflink.c (elf_link_add_object_symbols): Preserve
2508         dynamic_ref_after_ir_def when restoring the symbol table for
2509         unneeded dynamic object.
2510
2511 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
2512
2513         PR ld/21401
2514         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
2515         on on undefined IFUNC symbol in the second PLT.
2516
2517 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
2518
2519         * peXXigen.c (pe_print_reloc): Correct chunk_end.
2520
2521 2017-04-19  Alan Modra  <amodra@gmail.com>
2522
2523         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
2524         or make dynamic for info->dynamic_undefined_weak 0 and 1.
2525         * elf32-ppc.c:Formatting.
2526         (ensure_undefweak_dynamic): Don't make dynamic when
2527         info->dynamic_undefined_weak is zero.
2528         (allocate_dynrelocs): Discard undefweak dyn_relocs for
2529         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
2530         not default visibility.  Discard undef and undefweak
2531         dyn_relocs earlier.
2532         (ppc_elf_relocate_section): Adjust to suit.
2533         * elf64-ppc.c: Formatting.
2534         (ensure_undefweak_dynamic): Don't make dynamic when
2535         info->dynamic_undefined_weak is zero.
2536         (allocate_dynrelocs): Discard undefweak dyn_relocs for
2537         info->dynamic_undefined_weak.  Discard them earlier.
2538
2539 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
2540
2541         PR ld/21389
2542         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
2543         before generating the version definition section.
2544
2545 2017-04-17  Alan Modra  <amodra@gmail.com>
2546
2547         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
2548         state when a regular object file defines a symbol with
2549         incompatible type to that defined by an earlier shared lib.
2550
2551 2017-04-13  Alan Modra  <amodra@gmail.com>
2552
2553         * coffcode.h: Wrap some overly long _bfd_error_handler args.
2554         * elf.c: Likewise.
2555         * elf32-arm.c: Likewise.
2556         * elf32-i386.c: Likewise.
2557         * elf32-mep.c: Likewise.
2558         * elf64-ia64-vms.c: Likewise.
2559         * elf64-x86-64.c: Likewise.
2560         * elflink.c: Likewise.
2561         * elfnn-ia64.c: Likewise.
2562         * elfxx-mips.c: Likewise.
2563
2564 2017-04-13  Alan Modra  <amodra@gmail.com>
2565
2566         * aoutx.h: Use %B and %A in error messages throughout file.
2567         * aout-cris.c: Likewise.
2568         * archive.c: Likewise.
2569         * binary.c: Likewise.
2570         * coff-rs6000.c: Likewise.
2571         * coff-tic4x.c: Likewise.
2572         * coffcode.h: Likewise.
2573         * coffgen.c: Likewise.
2574         * cofflink.c: Likewise.
2575         * coffswap.h: Likewise.
2576         * cpu-arm.c: Likewise.
2577         * elf-eh-frame.c: Likewise.
2578         * elf-m10300.c: Likewise.
2579         * elf.c: Likewise.
2580         * elf32-arc.c: Likewise.
2581         * elf32-arm.c: Likewise.
2582         * elf32-bfin.c: Likewise.
2583         * elf32-frv.c: Likewise.
2584         * elf32-iq2000.c: Likewise.
2585         * elf32-m32c.c: Likewise.
2586         * elf32-microblaze.c: Likewise.
2587         * elf32-nds32.c: Likewise.
2588         * elf32-rl78.c: Likewise.
2589         * elf32-rx.c: Likewise.
2590         * elf32-score.c: Likewise.
2591         * elf32-score7.c: Likewise.
2592         * elf32-sh64.c: Likewise.
2593         * elf32-v850.c: Likewise.
2594         * elf32-vax.c: Likewise.
2595         * elf32-visium.c: Likewise.
2596         * elf64-ia64-vms.c: Likewise.
2597         * elf64-mmix.c: Likewise.
2598         * elf64-sh64.c: Likewise.
2599         * elfcode.h: Likewise.
2600         * elfnn-aarch64.c: Likewise.
2601         * elfnn-ia64.c: Likewise.
2602         * elfxx-mips.c: Likewise.
2603         * hpux-core.c: Likewise.
2604         * ieee.c: Likewise.
2605         * ihex.c: Likewise.
2606         * linker.c: Likewise.
2607         * merge.c: Likewise.
2608         * mmo.c: Likewise.
2609         * oasys.c: Likewise.
2610         * pdp11.c: Likewise.
2611         * peXXigen.c: Likewise.
2612         * rs6000-core.c: Likewise.
2613         * vms-alpha.c: Likewise.
2614         * xcofflink.c: Likewise.
2615
2616 2017-04-13  Alan Modra  <amodra@gmail.com>
2617
2618         * bfd.c (PRINT_TYPE): Define.
2619         (_doprnt): New function.
2620         (error_handler_internal): Use _doprnt.
2621         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
2622         calls in their natural order, throughout file.
2623         * coff-mcore.c: Likewise.
2624         * coff-ppc.c: Likewise.
2625         * coff-tic80.c: Likewise.
2626         * cofflink.c: Likewise.
2627         * elf-s390-common.c: Likewise.
2628         * elf.c: Likewise.
2629         * elf32-arm.c: Likewise.
2630         * elf32-i386.c: Likewise.
2631         * elf32-m32r.c: Likewise.
2632         * elf32-msp430.c: Likewise.
2633         * elf32-spu.c: Likewise.
2634         * elf64-ia64-vms.c: Likewise.
2635         * elf64-sparc.c: Likewise.
2636         * elf64-x86-64.c: Likewise.
2637         * elflink.c: Likewise.
2638         * elfnn-aarch64.c: Likewise.
2639         * elfnn-ia64.c: Likewise.
2640         * elfxx-mips.c: Likewise.
2641
2642 2017-04-13  Alan Modra  <amodra@gmail.com>
2643
2644         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
2645         branch veneers" error.  Fix double space and format message.
2646         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
2647         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
2648
2649 2017-04-13  Alan Modra  <amodra@gmail.com>
2650
2651         * bfd-in2.h: Regenerate.
2652
2653 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2654
2655         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
2656         extra `\n' in warning/error messages.
2657         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
2658         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2659
2660 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2661
2662         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
2663         processor-specific properties with generic ELF target vector.
2664
2665 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
2666
2667         * elf32-sparc.c (elf_backend_fixup_symbol): New.
2668         * elf64-sparc.c (elf_backend_fixup_symbol): New.
2669         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
2670         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
2671         has_non_got_reloc.
2672         (link_hash_newfunc): Initialize has_got_reloc and
2673         has_non_got_reloc.
2674         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
2675         section.
2676         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
2677         has_non_got_reloc.
2678         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
2679         has_non_got_reloc.
2680         (_bfd_sparc_elf_fixup_symbol): New function.
2681         (allocate_dynrelocs): Don't allocate space for dynamic
2682         relocations and discard relocations against resolved undefined
2683         weak symbols in executable.  Don't make resolved undefined weak
2684         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
2685         relocation against undefined weak symbols in PIE.
2686         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
2687         relocations against resolved undefined weak symbols in PIE
2688         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
2689         without ynamic PLT/GOT relocations for resolved undefined weak
2690         symbols.
2691         Don't generate dynamic relocation against resolved undefined
2692         weak symbol in executable.
2693         (pie_finish_undefweak_symbol): New function.
2694         (_bfd_sparc_elf_finish_dynamic_sections): Call
2695         pie_finish_undefweak_symbol on all symbols in PIE.
2696         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
2697         (_bfd_sparc_elf_fixup_symbol): New function.
2698
2699 2017-04-10  Nick Clifton  <nickc@redhat.com>
2700
2701         * config.bfd: Remove ns32k from obsolete list.
2702
2703 2017-04-10  Alan Modra  <amodra@gmail.com>
2704
2705         PR 21287
2706         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
2707         (special_sections_i): Likewise for .init_array.
2708         (special_sections_p): Likewise for .preinit_array.
2709
2710 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
2711
2712         PR ld/19579
2713         PR ld/21306
2714         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
2715         ELF_COMMON_DEF_P for common symbols.
2716         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2717         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2718         * elflink.c (_bfd_elf_merge_symbol): Revert commits
2719         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
2720         07492f668d2173da7a2bda3707ff0985e0f460b6.
2721
2722 2017-04-07  Pedro Alves  <palves@redhat.com>
2723
2724         * opncls.c (bfd_get_debug_link_info): Rename to...
2725         (bfd_get_debug_link_info_1): ... this.  Change type of second
2726         parameter to void pointer.  Adjust.
2727         (bfd_get_debug_link_info): Reimplement on top of
2728         bfd_get_debug_link_info_1.
2729         (separate_debug_file_exists, separate_alt_debug_file_exists):
2730         Change type of second parameter to void pointer.  Adjust.
2731         (get_func_type, check_func_type): Change type of second parameter
2732         to void pointer.
2733         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
2734         the callback functions instead of passing the address of a local.
2735         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
2736         find_separate_debug_file.
2737         (get_alt_debug_link_info_shim): Change type of second parameter to
2738         void pointer.  Adjust.
2739         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
2740         find_separate_debug_file.
2741         (get_build_id_name, bfd_boolean check_build_id_file): Change type
2742         of second parameter to void pointer.  Adjust.
2743         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
2744         pointer local to find_separate_debug_file.
2745
2746 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
2747
2748         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
2749         external symbols with a definition.
2750         (_bfd_coff_gc_mark_extra_sections): Fix typo.
2751
2752 2017-04-07  Alan Modra  <amodra@gmail.com>
2753
2754         * po/SRC-POTFILES.in: Regenerate.
2755
2756 2017-04-05  Alan Modra  <amodra@gmail.com>
2757
2758         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
2759         reference counting.
2760
2761 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
2762
2763         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
2764         numbers for DataDirectory entry indicies passed to
2765         add_data_entry().
2766
2767 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2768
2769         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
2770         each GNU_MBIND section and align GNU_MBIND section to page size.
2771         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
2772         segment for each GNU_MBIND section.
2773         (_bfd_elf_init_private_section_data): Copy sh_info from input
2774         for GNU_MBIND section.
2775
2776 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
2777
2778         * elfnn-riscv.c (GP_NAME): Delete.
2779         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
2780         (_bfd_riscv_relax_lui): Likewise.
2781
2782 2017-04-04  Nick Clifton  <nickc@redhat.com>
2783
2784         PR binutils/21342
2785         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
2786         dereference.
2787         (bfd_elf_final_link): Only initialize the extended symbol index
2788         section if there are extended symbol tables to list.
2789
2790 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
2791
2792         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
2793         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
2794         * configure.ac (elf): Add elf-properties.lo.
2795         * Makefile.in: Regenerated.
2796         * configure: Likewise.
2797         * elf-bfd.h (elf_property_kind): New.
2798         (elf_property): Likewise.
2799         (elf_property_list): Likewise.
2800         (elf_properties): Likewise.
2801         (_bfd_elf_parse_gnu_properties): Likewise.
2802         (_bfd_elf_get_property): Likewise.
2803         (_bfd_elf_link_setup_gnu_properties): Likewise.
2804         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
2805         and setup_gnu_properties.
2806         (elf_obj_tdata): Add properties.
2807         * elf-properties.c: New file.
2808         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
2809         (elf_i386_merge_gnu_properties): Likewise.
2810         (elf_backend_parse_gnu_properties): Likewise.
2811         (elf_backend_merge_gnu_properties): Likewise.
2812         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2813         (elf_x86_64_merge_gnu_properties): Likewise.
2814         (elf_backend_parse_gnu_properties): Likewise.
2815         (elf_backend_merge_gnu_properties): Likewise.
2816         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
2817         (elf_backend_parse_gnu_properties): Likewise.
2818         (elf_backend_setup_gnu_properties): Likewise.
2819         (elfNN_bed): Add elf_backend_parse_gnu_properties,
2820         elf_backend_merge_gnu_properties and
2821         elf_backend_setup_gnu_properties.
2822
2823 2017-03-30  Pip Cet  <pipcet@gmail.com>
2824
2825         * elf32-wasm32.c: Add relocation code, two relocs.
2826         * reloc.c: Add wasm32 relocations.
2827         * libbfd.h: Regenerate.
2828         * bfd-in2.h: Regenerate.
2829         * bfd/po/bfd.pot: Regenerate.
2830
2831 2017-03-29  Nick Clifton  <nickc@redhat.com>
2832
2833         PR binutils/18025
2834         * coff-bfd.h (struct coff_section_data): Add new fields:
2835         saved_bias and bias.
2836         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
2837         computed for PE binaries.
2838         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
2839         missing abbrev.
2840
2841 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
2842
2843         PR ld/16044
2844         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
2845         to handle a local symbol with a hash-symbol-entry; without PLT.
2846         Add BFD_ASSERT for an incidental case with GOT entry present.
2847         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
2848         isn't forced-or-set local.
2849
2850 2017-03-27  Pip Cet  <pipcet@gmail.com>
2851
2852         * wasm-module.c: New file to support WebAssembly modules.
2853         * wasm-module.h: New file to support WebAssembly modules.
2854         * doc/webassembly.texi: Start documenting wasm-module.c.
2855         * config.bfd: Add wasm_vec.
2856         * targets.c: Likewise.
2857         * configure.ac: Likewise.
2858         * Makefile.am: Add entries for wasm-module.c.
2859         * Makefile.in: Regenerate.
2860         * configure: Regenerate.
2861         * po/SRC-POTFILES.in: Regenerate.
2862
2863 2017-03-27  Pip Cet  <pipcet@gmail.com>
2864
2865         * cpu-wasm32.c: New file to support wasm32 architecture.
2866         * elf32-wasm32.c: New file to support wasm32 architecture.
2867         * Makefile.am: Add wasm32 architecture.
2868         * archures.c: Likewise.
2869         * config.bfd: Likewise.
2870         * configure.ac: Likewise.
2871         * targets.c: Likewise.
2872         * Makefile.in: Regenerate.
2873         * bfd-in2.h: Regenerate.
2874         * configure: Regenerate.
2875         * po/SRC-POTFILES.in: Regenerate.
2876
2877 2017-03-20  Alan Modra  <amodra@gmail.com>
2878
2879         PR 21266
2880         * elf64-ppc.c (compare_symbols): Stabilize sort.
2881
2882 2017-03-18  Alan Modra  <amodra@gmail.com>
2883
2884         * elf64-ppc.c (struct ppc_link_hash_table): Add
2885         local_ifunc_resolver and maybe_local_ifunc_resolver.
2886         (ppc_build_one_stub): Set flags on emitting dynamic
2887         relocation to ifunc.
2888         (ppc64_elf_relocate_section): Likewise.
2889         (ppc64_elf_finish_dynamic_symbol): Likewise.
2890         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
2891         local dynamic relocs to ifuncs.
2892         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
2893         local_ifunc_resolver and maybe_local_ifunc_resolver.
2894         (ppc_elf_relocate_section): Set flag on emitting dynamic
2895         relocation to ifuncs.
2896         (ppc_elf_finish_dynamic_symbol): Likewise.
2897         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
2898         dynamic relocs to ifuncs.
2899
2900 2017-03-13  Nick Clifton  <nickc@redhat.com>
2901
2902         PR binutils/21202
2903         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
2904         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
2905         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
2906         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
2907         * bfd-in2.h: Regenerate.
2908         * libbfd.h: Regenerate.
2909         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
2910         names.
2911         (IS_AARCH64_TLSDESC_RELOC): Likewise.
2912         (elfNN_aarch64_howto_table): Likewise.
2913         (aarch64_tls_transition_without_check): Likewise.
2914         (aarch64_reloc_got_type): Likewise.
2915         (elfNN_aarch64_final_link_relocate): Likewise.
2916         (elfNN_aarch64_tls_relax): Likewise.
2917         (elfNN_aarch64_relocate_section): Likewise.
2918         (elfNN_aarch64_gc_sweep_hook): Likewise.
2919         (elfNN_aarch64_check_relocs): Likewise.
2920         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
2921         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2922
2923 2017-03-11  Alan Modra  <amodra@gmail.com>
2924
2925         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
2926         parameter is in fact used.  Whitespace fixes.
2927         * elf64-ppc.c: Likewise.
2928
2929 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
2930
2931         * rs6000-core.c (CORE_NEW): Simplify macro when
2932         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
2933
2934 2017-03-07  Alan Modra  <amodra@gmail.com>
2935
2936         PR 21224
2937         PR 20519
2938         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
2939         dyn_relocs check.
2940
2941 2017-03-05  Alan Modra  <amodra@gmail.com>
2942
2943         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
2944         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
2945         (next_cie_fde_offset): New function.
2946         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
2947         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
2948         four bytes.  Align CIEs to four or eight bytes depending on
2949         per_encoding_aligned8.  Align FDEs according to their encoding.
2950         Pad last FDE to output section alignment.
2951         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
2952         assertion.
2953         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
2954         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
2955         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
2956
2957 2017-03-02  Martin Bickel  <binutils@ineranves.de>
2958
2959         PR ld/21212
2960         * elf.c (rewrite_elf_program_header): Do not issue a warning for
2961         empty segments which have a zero filesz, but a non-zero memsz.
2962
2963 2017-03-02  Alan Modra  <amodra@gmail.com>
2964
2965         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
2966
2967 2017-02-28  Alan Modra  <amodra@gmail.com>
2968
2969         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
2970         (ppc64_elf_relocate_section): Likewise.
2971
2972 2017-02-28  Alan Modra  <amodra@gmail.com>
2973
2974         PR 20995
2975         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
2976         rather than elf32_nios2_hash_table or elf_hash_table.
2977         (create_got_section): Likewise.
2978         (nios2_elf32_finish_dynamic_symbol): Likewise.
2979         (nios2_elf32_adjust_dynamic_symbol): Likewise.
2980         (nios2_elf32_size_dynamic_sections): Likewise.
2981         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
2982         vars.  Use htab equivalents directly instead.  Don't create
2983         all dynamic sections on needing just the GOT.  Use a goto
2984         rather than a fall-through with reloc test.  Ensure
2985         htab->dynobj is set when making dynamic sreloc section.
2986         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
2987         equivalent directly instead.  Don't segfault on looking for
2988         .dynamic when dynamic sections have not been created.  Don't
2989         segfault on .got.plt being discarded.
2990         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
2991         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
2992         fixme and another not so relevant comment.
2993         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
2994         already set, set hash table dynobj on creating .sbss.
2995
2996 2017-02-28  Alan Modra  <amodra@gmail.com>
2997
2998         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
2999         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
3000         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
3001         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
3002         (ppc64_elf_relocate_section): Likewise.
3003         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
3004         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
3005         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
3006         * libbfd.h: Regenerate.
3007         * bfd-in2.h: Regenerate.
3008
3009 2017-02-28  Alan Modra  <amodra@gmail.com>
3010
3011         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
3012         dynamic .data.rel.ro read-only.
3013         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
3014         rather than section flags when deciding where copy reloc goes.
3015         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
3016         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
3017         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
3018         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
3019         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
3020         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
3021         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
3022         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
3023         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3024         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
3025         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
3026         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
3027         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3028         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
3029         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
3030         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
3031         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
3032         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
3033         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
3034
3035 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
3036
3037         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
3038         `jalr $0, $25' instruction encoding.
3039
3040 2017-02-27  Nick Clifton  <nickc@redhat.com>
3041
3042         PR ld/21180
3043         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
3044         generating a seg-fault when encountering a symbol that has been
3045         deleted by garbage collection.
3046
3047 2017-02-25  Alan Modra  <amodra@gmail.com>
3048
3049         * elf32-arc.c (struct dynamic_sections): Delete.
3050         (enum dyn_section_types): Delete.
3051         (dyn_section_names): Delete.
3052         (arc_create_dynamic_sections): Delete.
3053         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
3054         segfault on discarded .rela.plt section.
3055         (elf_arc_size_dynamic_sections): Formatting.  Don't call
3056         arc_create_dynamic_sections.  Don't allocate memory for sections
3057         handled by the generic linker.  Correct code finding relocs in
3058         read-only sections.  Set SEC_EXCLUDE on zero size .got,
3059         .got.plt, and .dynbss sections.  Do set .interp for pies.
3060
3061 2017-02-24  Andrew Waterman  <andrew@sifive.com>
3062
3063         * elfnn-riscv.c (GP_NAME): New macro.
3064         (riscv_global_pointer_value): Use it.
3065         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
3066         output section, consider only that section's alignment.
3067
3068 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
3069
3070         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
3071         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
3072         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
3073         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
3074
3075 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
3076
3077         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
3078         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
3079         or misaligned.
3080
3081 2017-02-23  Alan Modra  <amodra@gmail.com>
3082
3083         PR 20744
3084         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
3085         16D relocations.
3086         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
3087         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
3088         relocs.
3089
3090 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
3091
3092         PR ld/20828
3093         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
3094         processing ahead of the call to `elf_gc_sweep_symbol'.
3095
3096 2017-02-22  Nick Clifton  <nickc@redhat.com>
3097
3098         PR binutils/21193
3099         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
3100         created section 4-byte alignment.
3101
3102 2017-02-22  Alan Modra  <amodra@gmail.com>
3103
3104         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
3105         on .got or .plt output section being discarded by script.
3106         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
3107         vxworks splt temp.
3108
3109 2017-02-21  Alan Modra  <amodra@gmail.com>
3110
3111         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
3112         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
3113
3114 2017-02-20  Alan Modra  <amodra@gmail.com>
3115
3116         PR 21181
3117         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
3118         if DT_RELSZ/DT_RELASZ is zero.
3119
3120 2017-02-17  Nick Clifton  <nickc@redhat.com>
3121
3122         * compress.c (bfd_get_full_section_contents): Remember to reduce
3123         compressed size by the sizeof the compression header when
3124         decompressing the contents.
3125
3126 2017-02-17  Pedro Alves  <palves@redhat.com>
3127
3128         * srec.c (Chunk): Rename to ...
3129         (_bfd_srec_len): ... this.
3130         (S3Forced): Rename to ...
3131         (_bfd_srec_forceS3): ... this.
3132         * objcopy.c: Adjust all references.
3133
3134 2017-02-17  Pedro Alves  <palves@redhat.com>
3135
3136         * archive.c (bsd_write_armap): Rename to ...
3137         (_bfd_bsd_write_armap): ... this.
3138         (coff_write_armap): Rename to ...
3139         (_bfd_coff_write_armap): ... this.
3140         * libbfd-in.h (bsd_write_armap): Rename to ...
3141         (_bfd_bsd_write_armap): ... this.
3142         (coff_write_armap): Rename to ...
3143         (_bfd_coff_write_armap): ... this.
3144         * aout-target.h, aout-tic30.c: Adjust all users.
3145         * libbfd.h: Regenerate.
3146
3147 2017-02-17  Pedro Alves  <palves@redhat.com>
3148
3149         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
3150         (warn_deprecated): Rename to ...
3151         (_bfd_warn_deprecated): ... this.
3152         * libbfd.c (warn_deprecated): Rename to ...
3153         (_bfd_warn_deprecated): ... this.
3154         * bfd-in2.h: Regenerate.
3155
3156 2017-02-17  Pedro Alves  <palves@redhat.com>
3157
3158         * bfdio.c (real_ftell): Rename to ...
3159         (_bfd_real_ftell): ... this.
3160         (real_fseek): Rename to ...
3161         (_bfd_real_fseek): ... this.
3162         (real_fopen): Rename to ...
3163         (_bfd_real_fopen): ... this.
3164         * libbfd-in.h (real_ftell): Rename to ...
3165         (_bfd_real_ftell): ... this.
3166         (real_fseek): Rename to ...
3167         (_bfd_real_fseek): ... this.
3168         (real_fopen): Rename to ...
3169         (_bfd_real_fopen): ... this.
3170         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
3171         * libbfd.h: Regenerate.
3172
3173 2017-02-17  Pedro Alves  <palves@redhat.com>
3174
3175         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
3176         * libbfd.c (read_unsigned_leb128): Rename to ...
3177         (_bfd_read_unsigned_leb128): ... this.
3178         (read_signed_leb128): Rename to ...
3179         (_bfd_read_signed_leb128): ... this.
3180         (safe_read_leb128): Rename to ...
3181         (_bfd_safe_read_leb128): ... this.
3182         * libbfd-in.h (read_unsigned_leb128): Rename to ...
3183         (_bfd_read_unsigned_leb128): ... this.
3184         (read_signed_leb128): Rename to ...
3185         (_bfd_read_signed_leb128): ... this.
3186         (safe_read_leb128): Rename to ...
3187         (_bfd_safe_read_leb128): ... this.
3188         * libbfd.h: Renegerate.
3189
3190 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
3191
3192         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
3193         before trying to fine matching file and line information.
3194
3195 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
3196
3197         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
3198         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
3199         not match current bfd, then reload debug information.  Record bfd
3200         we're loading debug info for in the stash.  If we have debug
3201         informatin in the cache then perform section placement before
3202         returning.
3203
3204 2017-02-16  Alan Modra  <amodra@gmail.com>
3205
3206         PR 21000
3207         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
3208         * elfxx-target.h (elf_backend_no_page_alias): Define.
3209         (elfNN_bed): Init new field.
3210         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
3211         ensure PT_LOAD segment starts on a new page.
3212         * elf32-hppa.c (elf_backend_no_page_alias): Define.
3213
3214 2017-02-16  Alan Modra  <amodra@gmail.com>
3215
3216         PR 21132
3217         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
3218         if pic.
3219
3220 2017-02-16  Jiong Wang <jiong.wang@arm.com>
3221
3222         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
3223         * bfd-in2.h: Regenerated.
3224
3225 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
3226
3227         PR ld/21168
3228         * elf32-i386.c (elf_i386_relocate_section): Allow
3229         "lea foo@GOT, %reg" in PIC.
3230
3231 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
3232
3233         PR ld/20244
3234         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
3235         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
3236         error against local IFUNC symbol without a base register for
3237         PIC.
3238
3239 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
3240
3241         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
3242         `%P: %H:' with `info->callbacks->einfo'.
3243         (ppc_elf_relocate_section): Likewise.
3244         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
3245         (ppc64_elf_edit_toc): Likewise.
3246         (ppc64_elf_relocate_section): Likewise.
3247
3248 2017-02-14  Alan Modra  <amodra@gmail.com>
3249
3250         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
3251         --gc-keep-exported, and test versioned field of sym rather than
3252         looking for @ in name.
3253
3254 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
3255
3256         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
3257         __global_pointer$.
3258
3259 2017-02-13  Nick Clifton  <nickc@redhat.com>
3260
3261         PR binutils/21151
3262         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
3263         unit length field.
3264
3265 2017-02-07  Andrew Waterman  <andrew@sifive.com>
3266
3267         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
3268         entry size if PLT header is written.
3269
3270 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
3271
3272         Fix sparc64 dynamic relocation processing to use the dynamic
3273         symbol count.
3274         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
3275         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
3276         should be used.
3277
3278 2017-02-03  Nick Clifton  <nickc@redhat.com>
3279
3280         PR 21096
3281         * coffcode.h (coff_write_object_contents): Enlarge size of
3282         s_name_buf in order to avoid compile time warning about possible
3283         integer truncation.
3284         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
3285         32-bits of insn value before printing into buffer.
3286
3287 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3288
3289         * elfxx-mips.c (mips_elf_hash_sort_data): Add
3290         `max_local_dynindx'.
3291         (mips_elf_sort_hash_table): Handle it.
3292         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
3293         symbols bump up `max_local_dynindx' rather than
3294         `max_non_got_dynindx'.
3295
3296 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3297
3298         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
3299         `min_got_dynindx', `max_unref_got_dynindx' and
3300         `max_non_got_dynindx' members to the `bfd_size_type' data type.
3301         (mips_elf_sort_hash_table): Adjust accordingly.
3302
3303 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3304
3305         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
3306         to access the hash table.
3307
3308 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3309
3310         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
3311         non-NULL `htab' to the beginning.
3312
3313 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3314
3315         * elflink.c (elf_gc_sweep): Wrap overlong line.
3316
3317 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
3318
3319         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
3320         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
3321         * elfxx-mips.c (mips_elf_link_hash_table): Add
3322         `ignore_branch_isa' member.
3323         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
3324         in branch relocation calculation as an error if
3325         `ignore_branch_isa' has been set.
3326         (_bfd_mips_elf_insn32): Rename to...
3327         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
3328         parameter to `insn32' and add an `ignore_branch_isa' parameter.
3329         Handle the new parameter.
3330
3331 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
3332
3333         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
3334         local variable dynobj.
3335
3336         PR ld/20995
3337         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
3338         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
3339         executable from read-only sections into sdynrelro.
3340         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
3341         dynamic relocs in sdynrelro.
3342         (elf_backend_want_dynrelro): Define.
3343
3344 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3345
3346         * config.bfd (*-*-rtemsaout*): Mark as removed.
3347
3348 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3349
3350         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
3351         (arm-*-rtems*): Move to (arm*-*-eabi*).
3352         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
3353         (m68-*-rtems*): Move to (m68*-*-elf*).
3354
3355 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3356
3357         * config.bfd (*-*-rtemscoff*): Mark as removed.
3358
3359 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
3360
3361         PR ld/20828
3362         * elflink.c (bfd_elf_record_link_assignment): Revert last
3363         change and don't ever clear `forced_local'.  Set `mark'
3364         unconditionally.
3365         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
3366         file.
3367         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
3368         (bfd_elf_size_dynamic_sections): ... here.
3369         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
3370         and set `mark' instead in `__tls_get_addr_opt' processing.
3371         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
3372
3373 2017-01-24  Alan Modra  <amodra@gmail.com>
3374
3375         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
3376         where dynamic relocs are preferable.  Allow ifunc too.
3377         (ensure_undefweak_dynamic): New function.
3378         (allocate_dynrelocs): Use it here.  Move plt handling last and
3379         don't make symbols dynamic, simplifying loop.  Only make undef
3380         weak symbols with GOT entries dynamic.  Correct condition
3381         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
3382         comments.  Remove goto.
3383         (ppc_elf_relocate_section): Correct test for using dynamic
3384         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
3385         to suit.  Set up explicit tls_index entries and implicit GOT
3386         tls_index entries resolvable at link time for
3387         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
3388         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
3389         (ensure_undefweak_dynamic): New function.
3390         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
3391         with GOT entries dynamic.  Remove unnecessary test of
3392         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
3393         (ppc64_elf_relocate_section): Correct test for using dynamic
3394         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
3395         to suit.  Set up explicit tls_index entries and implicit GOT
3396         tls_index entries resolvable at link time for __tls_get_addr_opt.
3397         Simplify expression to clear mem for prelink.
3398
3399 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
3400
3401         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
3402
3403 2017-01-20  Jiong Wang <jiong.wang@arm.com>
3404
3405         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
3406         (elf_backend_hash_symbol): Define.
3407
3408 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
3409
3410         PR ld/20828
3411         * elflink.c (bfd_elf_record_link_assignment): Clear any
3412         `forced_local' marking for DSO symbols that are not being
3413         provided.
3414
3415 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3416
3417         * elfnn-riscv.c (riscv_elf_object_p): New function.
3418
3419 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
3420
3421         PR ld/21038
3422         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
3423         plt_bnd_eh_frame.
3424         (elf_x86_64_check_relocs): Create .eh_frame section for the
3425         .plt.bnd section.
3426         (elf_x86_64_size_dynamic_sections): Allocate and initialize
3427         .eh_frame section for the .plt.bnd section.
3428         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3429         for the .plt.bnd section.
3430
3431 2017-01-12  Nick Clifton  <nickc@redhat.com>
3432
3433         PR binutils/20876
3434         * opncls.c (find_separate_debug_file): Add include_dirs
3435         parameter.  Only include the directory part of the bfd's filename
3436         in search paths if include_dirs is true.  Add a couple of extra
3437         locations for looking for debug files.
3438         ( bfd_follow_gnu_debuglink): Update invocation of
3439         find_separate_debug_file.
3440         (bfd_follow_gnu_debugaltlink): Likewise.
3441         (get_build_id): New function: Finds the build-id of the given bfd.
3442         (get_build_id_name): New function: Computes the name of the
3443         separate debug info file for a bfd, based upon its build-id.
3444         (check_build_id_file): New function: Checks to see if a separate
3445         debug info file exists at the given location, and that its
3446         build-id matches that of the original bfd.
3447         (bfd_follow_build_id_debuglink): New function: Finds a separate
3448         debug info file for a given bfd by using the build-id method.
3449         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
3450         method of locating a separate debug info file before using the
3451         debuglink method.
3452         * bfd-in2.h: Regenerate.
3453
3454 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
3455
3456         PR ld/21038
3457         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
3458         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
3459         elf_x86_64_eh_frame_plt_got.
3460         (elf_x86_64_size_dynamic_sections): Get unwind info from
3461         elf_x86_64_bnd_arch_bed for the BND PLT.
3462
3463 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
3464
3465         * config.bfd: Add entries for i686-redox and x86_64-redox.
3466
3467 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3468
3469         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
3470         to 4 bytes.
3471         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
3472         .eh_frame section to 4 bytes for x32.
3473         (elf_x86_64_check_relocs): Likewise.
3474
3475 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3476
3477         PR ld/20830
3478         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
3479         (PLT_GOT_FDE_LENGTH): Likewise.
3480         (elf_i386_plt_layout): Add eh_frame_plt_got and
3481         eh_frame_plt_got_size.
3482         (elf_i386_plt): Updated.
3483         (elf_i386_link_hash_table): Add plt_got_eh_frame.
3484         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
3485         (elf_i386_size_dynamic_sections): Allocate and initialize
3486         .eh_frame section for .plt.got.
3487         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
3488         .plt.got.
3489         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
3490         eh_frame_plt_got_size.
3491         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
3492         (PLT_GOT_FDE_LENGTH): Likewise.
3493         (elf_x86_64_backend_data): Add eh_frame_plt_got and
3494         eh_frame_plt_got_size.
3495         (elf_x86_64_arch_bed): Updated.
3496         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
3497         eh_frame_plt_got_size.
3498         (elf_x86_64_nacl_arch_bed): Likewise.
3499         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
3500         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
3501         (elf_x86_64_size_dynamic_sections): Allocate and initialize
3502         .eh_frame section for .plt.got.
3503         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3504         for .plt.got.
3505
3506 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3507
3508         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
3509         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
3510
3511 2017-01-09  Nick Clifton  <nickc@redhat.com>
3512
3513         * dwarf2.c (lookup_address_in_function_table): Return early if
3514         there are no functions in the given comp unit, or if the high
3515         address of the last function in the comp unit is less than the
3516         desired address.
3517
3518 2017-01-09  Nick Clifton  <nickc@redhat.com>
3519
3520         PR binutils/21013
3521         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
3522         message if there are too many symbols to load.
3523
3524 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
3525
3526         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
3527         if relocs are cached.
3528
3529 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
3530
3531         PR ld/21017
3532         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
3533         for R_MICROBLAZE_GOTOFF_64.
3534
3535 2017-01-03  Nick Clifton  <nickc@redhat.com>
3536
3537         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
3538         warning about using a possibly uninitialised variable.
3539
3540 2017-01-02  Alan Modra  <amodra@gmail.com>
3541
3542         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
3543         (allocate_plt_static, allocate_dynrelocs): Use it.
3544
3545 2017-01-02  Alan Modra  <amodra@gmail.com>
3546
3547         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
3548         .PARISC.unwind section.
3549
3550 2017-01-02  Alan Modra  <amodra@gmail.com>
3551
3552         PR ld/20989
3553         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
3554         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
3555         indirect to GOT pointer relative code edit.
3556
3557 2017-01-02  Alan Modra  <amodra@gmail.com>
3558
3559         Update year range in copyright notice of all files.
3560
3561 For older changes see ChangeLog-2016
3562 \f
3563 Copyright (C) 2017 Free Software Foundation, Inc.
3564
3565 Copying and distribution of this file, with or without modification,
3566 are permitted in any medium without royalty provided the copyright
3567 notice and this notice are preserved.
3568
3569 Local Variables:
3570 mode: change-log
3571 left-margin: 8
3572 fill-column: 74
3573 version-control: never
3574 End: