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