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