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