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