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