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