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