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