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