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