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